diff --git a/scenario/arkui/arkui_capi_demo/.gitignore b/scenario/arkui/arkui_capi_demo/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fbabf771011fe78f9919db0b1195ab6cadffc2b0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/.gitignore @@ -0,0 +1,11 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/AppScope/app.json5 b/scenario/arkui/arkui_capi_demo/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5ff6b7cabfbd38de7eb8e5bef44b341c6f1c979b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.openharmony.arkui_capi_demo", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/scenario/arkui/arkui_capi_demo/AppScope/resources/base/element/string.json b/scenario/arkui/arkui_capi_demo/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0053930df2a5d99cd3bcd6bbd91defc4995799c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ArkUI_CAPI_Demo" + } + ] +} diff --git a/scenario/arkui/arkui_capi_demo/AppScope/resources/base/media/app_icon.png b/scenario/arkui/arkui_capi_demo/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/AppScope/resources/base/media/app_icon.png differ diff --git a/scenario/arkui/arkui_capi_demo/build-profile.json5 b/scenario/arkui/arkui_capi_demo/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..5e38f64dc2b6500f7c33d21cc791dc4e97a8da97 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/build-profile.json5 @@ -0,0 +1,40 @@ +{ + "app": { + "signingConfigs": [ + { + "name": "default", + "material": { + "certpath": "C:\\Users\\admin\\.ohos\\config\\openharmony\\auto_ohos_default_arkui_capi_demo_com.openharmony.arkui_capi_demo.cer", + "storePassword": "0000001A5FE5C44F0987C64BB557773C3AF6424B90DCB8A783343E8CB40B92268C86E142512A1FF6F3FA", + "keyAlias": "debugKey", + "keyPassword": "0000001A66ECE31C470F5377F42EAFF3A945A579A4608B610F29A65D8250DDDC0EE1A73358B96C883D3B", + "profile": "C:\\Users\\admin\\.ohos\\config\\openharmony\\auto_ohos_default_arkui_capi_demo_com.openharmony.arkui_capi_demo.p7b", + "signAlg": "SHA256withECDSA", + "storeFile": "C:\\Users\\admin\\.ohos\\config\\openharmony\\auto_ohos_default_arkui_capi_demo_com.openharmony.arkui_capi_demo.p12" + } + } + ], + "compileSdkVersion": 12, + "compatibleSdkVersion": 12, + "products": [ + { + "name": "default", + "signingConfig": "default", + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/.gitignore b/scenario/arkui/arkui_capi_demo/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/build-profile.json5 b/scenario/arkui/arkui_capi_demo/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..99771329c95fa2156a54b62bdc1c06efa264c7a6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/build-profile.json5 @@ -0,0 +1,19 @@ +{ + "apiType": 'stageMode', + "buildOption": { + "externalNativeOptions": { + "path": "./src/main/cpp/CMakeLists.txt", + "arguments": "", + "cppFlags": "", + } + }, + "targets": [ + { + "name": "default", + "runtimeOS": "OpenHarmony" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/hvigorfile.ts b/scenario/arkui/arkui_capi_demo/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..80e4ec5b81689f238c34614b167a0b9e9c83e8d9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/scenario/arkui/arkui_capi_demo/entry/oh-package.json5 b/scenario/arkui/arkui_capi_demo/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..6f851a79ebe31f104ce352d7dd6f7b0ce313fd26 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "license": "", + "devDependencies": { + "@types/libnativerender.so": "file:./src/main/cpp/types/libnativerender" + }, + "author": "", + "name": "entry", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dependencies": {} +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/CMakeLists.txt b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..d565102f7ca6f9218ba06ebb176ab0fb9d41c499 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/CMakeLists.txt @@ -0,0 +1,603 @@ +# the minimum version of CMake. +cmake_minimum_required(VERSION 3.4.1) +project(XComponent) + +set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +add_definitions(-DOHOS_PLATFORM) + +include_directories( + ${NATIVERENDER_ROOT_PATH} + ${NATIVERENDER_ROOT_PATH}/include +) + +add_library(nativerender SHARED + manager/plugin_manager.cpp + napi_init.cpp + button/button_onclick_test.cpp + button/button_fontsize_test.cpp + button/button_fontcolor_test.cpp + button/button_fontweight_test.cpp + button/button_backgroundcolor_test.cpp + checkbox/checkbox_select_test.cpp + checkbox/checkbox_selectedcolor_test.cpp + checkbox/checkbox_unselectedcolor_test.cpp + checkbox/checkbox_mark_test.cpp + checkbox/checkbox_shape_test.cpp + checkbox/checkbox_onchange_test.cpp + commonattrs/commonattrs_align_test.cpp + commonattrs/commonattrs_direction_test.cpp + commonattrs/commonattrs_enabled_test.cpp + commonattrs/commonattrs_focusable_test.cpp + commonattrs/commonattrs_foregroundblurstyle_test.cpp + commonevent/commonevent_onappear_test.cpp + commonevent/commonevent_onareachange_test.cpp + commonevent/commonevent_onblur_test.cpp + commonevent/commonevent_ontouch_test.cpp + commonevent/commonevent_onfocus_test.cpp + commonevent/commonevent_onclick_test.cpp + commonattrs/commonattrs_flexbasis_test.cpp + commonattrs/commonattrs_flexgrow_test.cpp + commonattrs/commonattrs_flexshrink_test.cpp + commonattrs/commonattrs_alignself_test.cpp + commonattrs/commonattrs_aligncontent_test.cpp + commonattrs/commonattrs_justifycontent_test.cpp + commonattrs/commonattrs_alignitems_test.cpp + commonattrs/commonattrs_radialgradient_test.cpp + commonattrs/commonattrs_sweepgradient_test.cpp + commonattrs/commonattrs_grayscale_test.cpp + commonattrs/commonattrs_hittestbehavior_test.cpp + commonattrs/commonattrs_id_test.cpp + commonattrs/commonattrs_opacity_test.cpp + commonattrs/commonattrs_invert_test.cpp + commonattrs/commonattrs_sepia_test.cpp + commonattrs/commonattrs_contrast_test.cpp + commonattrs/commonattrs_clip_test.cpp + commonattrs/commonattrs_lineargradient_test.cpp + commonattrs/commonattrs_scale_test.cpp + commonattrs/commonattrs_shadow_test.cpp + commonattrs/commonattrs_margin_test.cpp + commonattrs/commonattrs_constraintsize_test.cpp + commonattrs/commonattrs_transform_test.cpp + commonattrs/commonattrs_mask_test.cpp + commonattrs/commonattrs_blendmode_test.cpp + commonattrs/commonattrs_height_test.cpp + commonattrs/commonattrs_width_test.cpp + commonattrs/commonattrs_backgroundcolor_test.cpp + commonattrs/commonattrs_position_test.cpp + commonattrs/commonattrs_borderwidth_test.cpp + commonattrs/commonattrs_bordercolor_test.cpp + commonattrs/commonattrs_borderradius_test.cpp + commonattrs/commonattrs_borderstyle_test.cpp + customcomponent/customcomponent_onmeasure_test.cpp + customcomponent/customcomponent_onlayout_test.cpp + customcomponent/customcomponent_ondraw_test.cpp + list/list_height_test.cpp + list/list_width_test.cpp + list/list_cachedcount_test.cpp + list/list_backgroundcolor_test.cpp + list/list_borderwidth_test.cpp + list/list_bordercolor_test.cpp + list/list_borderradius_test.cpp + list/list_opacity_test.cpp + list/list_clip_test.cpp + list/list_hittestbehavior_test.cpp + list/list_translate_test.cpp + list/list_scale_test.cpp + list/list_rotate_test.cpp + list/list_brightness_test.cpp + list/list_saturate_test.cpp + list/list_blur_test.cpp + list/list_shadow_test.cpp + list/list_lineargradient_test.cpp + list/list_scrollbar_test.cpp + list/list_listdirection_test.cpp + list/list_sticky_test.cpp + list/list_friction_test.cpp + list/list_enablescrollinteraction_test.cpp + listitem/listitem_height_test.cpp + listitem/listitem_width_test.cpp + listitem/listitem_backgroundcolor_test.cpp + listitem/listitem_borderwidth_test.cpp + listitem/listitem_bordercolor_test.cpp + listitem/listitem_borderradius_test.cpp + listitem/listitem_opacity_test.cpp + listitem/listitem_clip_test.cpp + listitem/listitem_hittestbehavior_test.cpp + listitem/listitem_translate_test.cpp + listitem/listitem_scale_test.cpp + listitem/listitem_rotate_test.cpp + listitem/listitem_brightness_test.cpp + listitem/listitem_saturate_test.cpp + listitem/listitem_blur_test.cpp + listitem/listitem_shadow_test.cpp + listitem/listitem_lineargradient_test.cpp + scroll/scroll_common.cpp + scroll/scroll_width_test.cpp + scroll/scroll_height_test.cpp + scroll/scroll_position_test.cpp + scroll/scroll_nestedscroll_test.cpp + scroll/scroll_scrollbar_test.cpp + scroll/scroll_scrollbarcolor_test.cpp + scroll/scroll_scrollable_test.cpp + scroll/scroll_enablescrollinteraction_test.cpp + scroll/scroll_clip_test.cpp + scroll/scroll_backgroundcolor_test.cpp + scroll/scroll_borderwidth_test.cpp + scroll/scroll_bordercolor_test.cpp + scroll/scroll_borderradius_test.cpp + scroll/scroll_opacity_test.cpp + scroll/scroll_translate_test.cpp + scroll/scroll_scale_test.cpp + scroll/scroll_rotate_test.cpp + scroll/scroll_brightness_test.cpp + scroll/scroll_blur_test.cpp + scroll/scroll_shadow_test.cpp + scroll/scroll_onscroll_test.cpp + scroll/scroll_onscrollframebegin_test.cpp + scroll/scroll_onscrollstart_test.cpp + scroll/scroll_onscrollstop_test.cpp + scroll/scroll_onappear_test.cpp + scroll/scroll_onscrolledge_test.cpp + scroll/scroll_scrolledge_test.cpp + scroll/scroll_edgeeffect_test.cpp + scroll/scroll_friction_test.cpp + scroll/scroll_saturate_test.cpp + scroll/scroll_scrollsnap_test.cpp + scroll/scroll_scrollto_test.cpp + scroll/scroll_currentoffset_test.cpp + scroll/scroll_overlay_test.cpp + scroll/scroll_hittestbehavior_test.cpp + scroll/scroll_lineargradient_test.cpp + scroll/scroll_pageenable_test.cpp + swiper/swiper_common.cpp + swiper/swiper_vertical_test.cpp + swiper/swiper_displayarrow_test.cpp + swiper/swiper_itemspace_test.cpp + swiper/swiper_displaycount_test.cpp + swiper/swiper_index_test.cpp + swiper/swiper_backgroundcolor_test.cpp + swiper/swiper_autoplay_test.cpp + swiper/swiper_backgroundimage_test.cpp + swiper/swiper_width_test.cpp + swiper/swiper_height_test.cpp + swiper/swiper_position_test.cpp + swiper/swiper_clip_test.cpp + swiper/swiper_indicator_test.cpp + swiper/swiper_disableswipe_test.cpp + swiper/swiper_cachedcount_test.cpp + toggle/toggle_width_test.cpp + toggle/toggle_height_test.cpp + toggle/toggle_backgroundcolor_test.cpp + toggle/toggle_switchpointcolor_test.cpp + toggle/toggle_selectedcolor_test.cpp + toggle/toggle_margin_test.cpp + toggle/toggle_position_test.cpp + toggle/toggle_onchange_test.cpp + toggle/toggle_focusable_test.cpp + toggle/toggle_enabled_test.cpp + toggle/toggle_clip_test.cpp + stack/stack_backgroundcolor_test.cpp + stack/stack_bordercolor_test.cpp + stack/stack_opacity_test.cpp + stack/stack_scale_test.cpp + stack/stack_clip_test.cpp + toggle/toggle_switch_test.cpp + stack/stack_rotate_test.cpp + stack/stack_translate_test.cpp + stack/stack_borderradius_test.cpp + stack/stack_brightness_test.cpp + stack/stack_saturate_test.cpp + stack/stack_transition_test.cpp + stack/stack_backgroundimagesize_test.cpp + stack/stack_backgroundimageposition_test.cpp + stack/stack_borderwidth_test.cpp + stack/stack_backgroundblurstyle_test.cpp + stack/stack_shadow_test.cpp + stack/stack_lineargradient_test.cpp + stack/stack_id_test.cpp + stack/stack_backgroundimage_test.cpp + stack/stack_hittestbehavior_test.cpp + stack/stack_onareachange_test.cpp + stack/stack_ontouch_test.cpp + stack/stack_margin_test.cpp + stack/stack_align_test.cpp + stack/stack_width_test.cpp + stack/stack_height_test.cpp + stack/stack_position_test.cpp + stack/stack_borderstyle_test.cpp + stack/stack_transform_test.cpp + text/text_position_test.cpp + text/text_enabled_test.cpp + text/text_height_test.cpp + text/text_width_test.cpp + image/image_width_test.cpp + image/image_height_test.cpp + image/image_position_test.cpp + image/image_backgroundcolor_test.cpp + image/image_bordercolor_test.cpp + image/image_borderwidth_test.cpp + image/image_borderradius_test.cpp + image/image_hittestbehavior_test.cpp + image/image_opacity_test.cpp + image/image_scale_test.cpp + image/image_rotate_test.cpp + image/image_translate_test.cpp + image/image_blur_test.cpp + image/image_brightness_test.cpp + image/image_saturate_test.cpp + image/image_autoresize_test.cpp + image/image_lineargradient_test.cpp + image/image_shadow_test.cpp + image/image_interpolation_test.cpp + image/image_objectfit_test.cpp + image/image_objectrepeat_test.cpp + image/image_src_test.cpp + image/image_colorfilter_test.cpp + image/image_borderstyle_test.cpp + image/image_id_test.cpp + image/image_clip_test.cpp + image/image_transform_test.cpp + image/image_alt_test.cpp + image/image_oncomplete_test.cpp + image/image_onerror_test.cpp + image/image_radialgradient_test.cpp + image/image_sweepgradient_test.cpp + text/text_backgroundcolor_test.cpp + text/text_backgroundimage_test.cpp + text/text_borderwidth_test.cpp + text/text_bordercolor_test.cpp + text/text_borderradius_test.cpp + text/text_opacity_test.cpp + text/text_fontcolor_test.cpp + text/text_fontsize_test.cpp + text/text_maxlines_test.cpp + text/text_lineheight_test.cpp + text/text_textoverflow_test.cpp + text/text_textalign_test.cpp + text/text_decoration_test.cpp + text/text_fontweight_test.cpp + text/text_fontstyle_test.cpp + text/text_padding_test.cpp + text/text_baselineoffset_test.cpp + text/text_textshadow_test.cpp + text/text_letterspacing_test.cpp + text/text_textcase_test.cpp + text/text_visibility_test.cpp + text/text_offset_test.cpp + text/text_mask_test.cpp + text/text_shadow_test.cpp + text/text_lineargradient_test.cpp + text/text_scale_test.cpp + text/text_transform_test.cpp + text/text_textindent_test.cpp + text/text_minfontsize_test.cpp + text/text_maxfontsize_test.cpp + text/text_heightadaptivepolicy_test.cpp + text/text_overlay_test.cpp + text/text_fontfamily_test.cpp + text/text_clip_test.cpp + text/text_radialgradient_test.cpp + text/text_sweepgradient_test.cpp + text/text_font_test.cpp + text/text_align_test.cpp + text/text_copyoption_test.cpp + text/text_linebreakstrategy_test.cpp + text/text_alignrules_test.cpp + column/column_width_test.cpp + column/column_foregroundblurstyle_test.cpp + row/row_height_test.cpp + slider/slider_height_test.cpp + slider/slider_width_test.cpp + column/column_height_test.cpp + column/column_padding_test.cpp + textarea/textarea_width_test.cpp + textarea/textarea_height_test.cpp + textarea/textarea_position_test.cpp + textarea/textarea_enabled_test.cpp + textinput/textinput_width_test.cpp + textinput/textinput_height_test.cpp + slider/slider_enabled_test.cpp + textinput/textinput_position_test.cpp + textinput/textinput_showpasswordicon_test.cpp + textinput/textinput_selectedbackgroundcolor_test.cpp + textinput/textinput_caretstyle_test.cpp + textinput/textinput_enabled_test.cpp + textinput/textinput_enterkeytype_test.cpp + textinput/textinput_type_test.cpp + textinput/textinput_onchange_test.cpp + textinput/textinput_enablekeyboardonfocus_test.cpp + span/span_textcase_test.cpp + span/span_letterspacing_test.cpp + span/span_decoration_test.cpp + span/span_lineheight_test.cpp + calendarpicker/calendarpicker_width_test.cpp + calendarpicker/calendarpicker_enabled_test.cpp + datepicker/datepicker_width_test.cpp + datepicker/datepicker_enabled_test.cpp + checkbox/checkbox_width_test.cpp + checkbox/checkbox_height_test.cpp + checkbox/checkbox_enabled_test.cpp + xcomponent/xcomponent_width_test.cpp + xcomponent/xcomponent_height_test.cpp + textpicker/textpicker_width_test.cpp + textpicker/textpicker_height_test.cpp + flex/flex_width_test.cpp + flex/flex_height_test.cpp + imagespan/imagespan_width_test.cpp + imagespan/imagespan_height_test.cpp + imagespan/imagespan_objectfit_test.cpp + imagespan/imagespan_verticalalign_test.cpp + imagespan/imagespan_padding_test.cpp + span/span_fontstyle_test.cpp + span/span_fontweight_test.cpp + span/span_fontcolor_test.cpp + span/span_fontsize_test.cpp + calendarpicker/calendarpicker_edgealign_test.cpp + calendarpicker/calendarpicker_textstyle_test.cpp + calendarpicker/calendarpicker_onchange_test.cpp + customdialog/customdialog_open_test.cpp + datepicker/datepicker_lunar_test.cpp + textpicker/textpicker_range_test.cpp + textpicker/textpicker_selected_test.cpp + textpicker/textpicker_value_test.cpp + textpicker/textpicker_disappeartextstyle_test.cpp + textpicker/textpicker_textstyle_test.cpp + textpicker/textpicker_selectedtextstyle_test.cpp + textpicker/textpicker_selectedindex_test.cpp + textpicker/textpicker_canloop_test.cpp + textpicker/textpicker_defaultpickeritemheight_test.cpp + textpicker/textpicker_onchange_test.cpp + xcomponent/xcomponent_sourceid_test.cpp + xcomponent/xcomponent_type_test.cpp + xcomponent/xcomponent_surface_render.cpp + xcomponent/xcomponent_surface_egl_core.cpp + customdialog/customdialog_close_test.cpp + text/text_linebreakstrategy_test.cpp + text/text_alignrules_test.cpp + timepicker/timepicker_usemilitarytime_test.cpp + customdialog/customdialog_alignment_test.cpp + customdialog/customdialog_customstyle_test.cpp + customdialog/customdialog_maskcolor_test.cpp + datepicker/datepicker_ondatechange_test.cpp + datepicker/datepicker_start_test.cpp + datepicker/datepicker_end_test.cpp + datepicker/datepicker_selected_test.cpp + datepicker/datepicker_selectedtextstyle_test.cpp + datepicker/datepicker_disappeartextstyle_test.cpp + datepicker/datepicker_textstyle_test.cpp + timepicker/timepicker_onchange_test.cpp + timepicker/timepicker_height_test.cpp + timepicker/timepicker_selected_test.cpp + timepicker/timepicker_selectedtextstyle_test.cpp + timepicker/timepicker_disappeartextstyle_test.cpp + timepicker/timepicker_textstyle_test.cpp + customcomponent/customcomponent_align_test.cpp + customcomponent/customcomponent_direction_test.cpp + customcomponent/customcomponent_enabled_test.cpp + customcomponent/customcomponent_focusable_test.cpp + customcomponent/customcomponent_onappear_test.cpp + customcomponent/customcomponent_onareachange_test.cpp + customcomponent/customcomponent_onblur_test.cpp + customcomponent/customcomponent_ontouch_test.cpp + customcomponent/customcomponent_onfocus_test.cpp + customcomponent/customcomponent_onclick_test.cpp + customcomponent/customcomponent_flexbasis_test.cpp + customcomponent/customcomponent_flexgrow_test.cpp + customcomponent/customcomponent_flexshrink_test.cpp + customcomponent/customcomponent_alignself_test.cpp + customcomponent/customcomponent_radialgradient_test.cpp + customcomponent/customcomponent_sweepgradient_test.cpp + customcomponent/customcomponent_grayscale_test.cpp + customcomponent/customcomponent_hittestbehavior_test.cpp + customcomponent/customcomponent_id_test.cpp + customcomponent/customcomponent_opacity_test.cpp + customcomponent/customcomponent_invert_test.cpp + customcomponent/customcomponent_sepia_test.cpp + customcomponent/customcomponent_contrast_test.cpp + customcomponent/customcomponent_clip_test.cpp + customcomponent/customcomponent_lineargradient_test.cpp + customcomponent/customcomponent_scale_test.cpp + customcomponent/customcomponent_shadow_test.cpp + customcomponent/customcomponent_margin_test.cpp + customcomponent/customcomponent_constraintsize_test.cpp + customcomponent/customcomponent_transform_test.cpp + customcomponent/customcomponent_mask_test.cpp + customcomponent/customcomponent_blendmode_test.cpp + customcomponent/customcomponent_height_test.cpp + customcomponent/customcomponent_width_test.cpp + customcomponent/customcomponent_backgroundcolor_test.cpp + customcomponent/customcomponent_position_test.cpp + customcomponent/customcomponent_borderwidth_test.cpp + customcomponent/customcomponent_bordercolor_test.cpp + customcomponent/customcomponent_borderradius_test.cpp + customcomponent/customcomponent_borderstyle_test.cpp + customcomponent/customcomponent_accessibilitygroup_test.cpp + customcomponent/customcomponent_accessibilitytext_test.cpp + customcomponent/customcomponent_accessibilitylevel_test.cpp + customcomponent/customcomponent_accessibilitydescription_test.cpp + customcomponent/customcomponent_foregroundblurstyle_test.cpp + accessibility/textinput_accessibilitygroup_test.cpp + accessibility/textinput_accessibilitytext_test.cpp + accessibility/textinput_accessibilitylevel_test.cpp + accessibility/textinput_accessibilitydescription_test.cpp + accessibility/textarea_accessibilitygroup_test.cpp + accessibility/textarea_accessibilitytext_test.cpp + accessibility/textarea_accessibilitylevel_test.cpp + accessibility/textarea_accessibilitydescription_test.cpp + accessibility/swiper_accessibilitygroup_test.cpp + accessibility/swiper_accessibilitytext_test.cpp + accessibility/swiper_accessibilitylevel_test.cpp + accessibility/swiper_accessibilitydescription_test.cpp + accessibility/scroll_accessibilitygroup_test.cpp + accessibility/scroll_accessibilitytext_test.cpp + accessibility/scroll_accessibilitylevel_test.cpp + accessibility/scroll_accessibilitydescription_test.cpp + accessibility/list_accessibilitygroup_test.cpp + accessibility/list_accessibilitytext_test.cpp + accessibility/list_accessibilitylevel_test.cpp + accessibility/list_accessibilitydescription_test.cpp + accessibility/toggle_accessibilitygroup_test.cpp + accessibility/toggle_accessibilitytext_test.cpp + accessibility/toggle_accessibilitylevel_test.cpp + accessibility/toggle_accessibilitydescription_test.cpp + accessibility/text_accessibilitygroup_test.cpp + accessibility/text_accessibilitytext_test.cpp + accessibility/text_accessibilitylevel_test.cpp + accessibility/text_accessibilitydescription_test.cpp + accessibility/refresh_accessibilitygroup_test.cpp + accessibility/refresh_accessibilitytext_test.cpp + accessibility/refresh_accessibilitylevel_test.cpp + accessibility/refresh_accessibilitydescription_test.cpp + accessibility/datepicker_accessibilitygroup_test.cpp + accessibility/datepicker_accessibilitytext_test.cpp + accessibility/datepicker_accessibilitylevel_test.cpp + accessibility/datepicker_accessibilitydescription_test.cpp + accessibility/timepicker_accessibilitygroup_test.cpp + accessibility/timepicker_accessibilitytext_test.cpp + accessibility/timepicker_accessibilitylevel_test.cpp + accessibility/timepicker_accessibilitydescription_test.cpp + accessibility/slider_accessibilitygroup_test.cpp + accessibility/slider_accessibilitytext_test.cpp + accessibility/slider_accessibilitylevel_test.cpp + accessibility/slider_accessibilitydescription_test.cpp + accessibility/button_accessibilitygroup_test.cpp + accessibility/button_accessibilitytext_test.cpp + accessibility/button_accessibilitylevel_test.cpp + accessibility/button_accessibilitydescription_test.cpp + accessibility/textpicker_accessibilitygroup_test.cpp + accessibility/textpicker_accessibilitytext_test.cpp + accessibility/textpicker_accessibilitylevel_test.cpp + accessibility/textpicker_accessibilitydescription_test.cpp + accessibility/checkbox_accessibilitygroup_test.cpp + accessibility/checkbox_accessibilitytext_test.cpp + accessibility/checkbox_accessibilitylevel_test.cpp + accessibility/checkbox_accessibilitydescription_test.cpp + accessibility/progress_accessibilitygroup_test.cpp + accessibility/progress_accessibilitytext_test.cpp + accessibility/progress_accessibilitylevel_test.cpp + accessibility/progress_accessibilitydescription_test.cpp + textinput/textinput_backgroundcolor_test.cpp + textinput/textinput_backgroundimage_test.cpp + textinput/textinput_clip_test.cpp + textinput/textinput_fontcolor_test.cpp + textinput/textinput_caretcolor_test.cpp + textinput/textinput_fontsize_test.cpp + textinput/textinput_fontstyle_test.cpp + textinput/textinput_fontweight_test.cpp + textinput/textinput_padding_test.cpp + textinput/textinput_showunderline_test.cpp + textinput/textinput_textalign_test.cpp + textinput/textinput_onfocus_test.cpp + textinput/textinput_onblur_test.cpp + textinput/textinput_onsubmit_test.cpp + textinput/textinput_oncut_test.cpp + textinput/textinput_onpaste_test.cpp + textinput/textinput_defaultfocus_test.cpp + slider/slider_blockcolor_test.cpp + slider/slider_blockstyle_test.cpp + slider/slider_direction_test.cpp + slider/slider_value_test.cpp + slider/slider_min_test.cpp + slider/slider_max_test.cpp + slider/slider_reverse_test.cpp + slider/slider_selectedcolor_test.cpp + slider/slider_showsteps_test.cpp + slider/slider_step_test.cpp + slider/slider_style_test.cpp + slider/slider_trackcolor_test.cpp + slider/slider_onchange_test.cpp + textinput/textinput_stopediting_test.cpp + textinput/textinput_lineheight_test.cpp + textarea/textarea_fontcolor_test.cpp + textarea/textarea_onblur_test.cpp + textarea/textarea_fontsize_test.cpp + textarea/textarea_fontfamily_test.cpp + textarea/textarea_fontstyle_test.cpp + textarea/textarea_fontweight_test.cpp + textarea/textarea_maxlength_test.cpp + textarea/textarea_placeholdercolor_test.cpp + textarea/textarea_placeholderfont_test.cpp + textarea/textarea_textalign_test.cpp + textarea/textarea_padding_test.cpp + textarea/textarea_backgroundcolor_test.cpp + textarea/textarea_borderradius_test.cpp + textarea/textarea_caretcolor_test.cpp + textarea/textarea_lineheight_test.cpp + textarea/textarea_stopediting_test.cpp + textarea/textarea_onfocus_test.cpp + textarea/textarea_onchange_test.cpp + loadingprogress/loadingprogress_color_test.cpp + loadingprogress/loadingprogress_enableloading_test.cpp + progress/progress_color_test.cpp + progress/progress_style_test.cpp + progress/progress_backgroundcolor_test.cpp + refresh/refresh_onstatechange_test.cpp + refresh/refresh_onrefreshing_test.cpp + textinput/textinput_maxlength_test.cpp + textinput/textinput_placeholdercolor_test.cpp + textinput/textinput_placeholderfont_test.cpp + textinput/textinput_fontfamily_test.cpp + textinput/textinput_clearbuttonmode_test.cpp + textinput/textinput_responseregion_test.cpp + textarea/textarea_responseregion_test.cpp + textarea/textarea_defaultfocus_test.cpp + textarea/textarea_key_test.cpp + textinput/textinput_key_test.cpp + listitem/listitem_edgeEffect_test.cpp + list/list_edgeEffect_test.cpp + swiper/swiper_loop_test.cpp + swiper/swiper_curve_test.cpp + swiper/swiper_interval_test.cpp + swiper/swiper_duration_test.cpp +) + +find_library( + # Sets the name of the path variable. + hilog-lib + # Specifies the name of the NDK library that + # you want CMake to locate. + hilog_ndk.z +) + +find_library( + # Sets the name of the path variable. + libace-lib + # Specifies the name of the NDK library that + # you want CMake to locate. + ace_ndk.z +) + +find_library( + # Sets the name of the path variable. + libnapi-lib + # Specifies the name of the NDK library that + # you want CMake to locate. + ace_napi.z +) + +find_library( + # Sets the name of the path variable. + libuv-lib + # Specifies the name of the NDK library that + # you want CMake to locate. + uv +) + +find_library( + # Sets the name of the path variable. + EGL-lib + # Specifies the name of the NDK library that + # you want CMake to locate. + EGL +) + +find_library( + # Sets the name of the path variable. + GLES-lib + # Specifies the name of the NDK library that + # you want CMake to locate. + GLESv3 +) + +target_link_libraries(nativerender PUBLIC + libnative_drawing.so ${EGL-lib} ${GLES-lib} ${hilog-lib} ${libace-lib} ${libnapi-lib} ${libuv-lib}) \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a851f47018b369d996998ae34eec9186354fddc6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "button_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ButtonAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ButtonAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3f7f43e950324fba1808e2be641b9d4316d9dc7b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ButtonAccessibilityDescriptionTest { +public: + ~ButtonAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..193d9c57ef65bc73cb599856db7a0634929f57d1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "button_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ButtonAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ButtonAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2ce94a2f0f84f1fac3e3108f4639b7357f3507c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ButtonAccessibilityGroupTest { +public: + ~ButtonAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..32f06144363a8b9c4e263a8fc9c63515bcf4c344 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "button_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ButtonAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ButtonAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ButtonAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ButtonAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ButtonAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ButtonAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0fa323fbc8a17a1b64a548ce1b4da7afde4bf907 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ButtonAccessibilityLevelTest { +public: + ~ButtonAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1df78e73bcf05d84b121784ea55d0dcb180c1db2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "button_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ButtonAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ButtonAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(button, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0af3539df017312b04c6eef97ff43bdfc5c05f9b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/button_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ButtonAccessibilityTextTest { +public: + ~ButtonAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BUTTON_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8390c604d90205d3f43236cfea54b7d545cb786d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CheckboxAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CheckboxAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..992e02374a7cdd35836756e4d0409ca250b86a74 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxAccessibilityDescriptionTest { +public: + ~CheckboxAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ae65a0883c55c605e2f649534a3661974a8d0f73 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CheckboxAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CheckboxAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..91d56f65f8858d7d699a95d2e5f9fe29495a3437 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxAccessibilityGroupTest { +public: + ~CheckboxAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5eee09c168d5e13921a952811bc2113bbaa2ed0e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CheckboxAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CheckboxAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CheckboxAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CheckboxAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CheckboxAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CheckboxAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bca41af04edae16d258ac20980d9c860e19da3ac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxAccessibilityLevelTest { +public: + ~CheckboxAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..819deb747057d70d2f82ac69e995eb28f5e5623d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CheckboxAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CheckboxAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->addChild(column, checkbox); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(checkbox, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bd3afca8e02dba84b9e6f9c77f23fc0ae6539c7b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/checkbox_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxAccessibilityTextTest { +public: + ~CheckboxAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fa223e4687dbece459f9af05646633878c54ad1e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitydescription_test.cpp @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value DatePickerAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2e3af74860a308a4b9709285ce65d9c73ed4a883 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerAccessibilityDescriptionTest { +public: + ~DatePickerAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d06da2512b1e561584279d535c05a06c4950e074 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitygroup_test.cpp @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value DatePickerAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9dcc566648e1a40c01f189acb86f1eddc7ca7f3d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerAccessibilityGroupTest { +public: + ~DatePickerAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f7ef41653abc26a8dea2f158fbb1d66f2773987b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitylevel_test.cpp @@ -0,0 +1,537 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value DatePickerAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1a47f5943441757409227090c3e61959c1ec74c9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerAccessibilityLevelTest { +public: + ~DatePickerAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e3ce99aed9bad5838961f0c7197a096f00a0b90a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitytext_test.cpp @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value DatePickerAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->addChild(column, datePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_value[] = {}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + selected_item.string = "2024-01-22"; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(datePicker, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..4166f358b1bb86d8bc2192cbe571842a0167ccc2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/datepicker_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerAccessibilityTextTest { +public: + ~DatePickerAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1cc73ff74a0597fd44bf489293f9f7e9d89d9348 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..46a00e733a067fc7770e4ceffca8cce0ed238157 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListAccessibilityDescriptionTest { +public: + ~ListAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7b0d64c075afafb464386e04f4cfaf82d710dfc1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..76fa448c72f66e4d27baf930a2d21bbcdd268f79 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListAccessibilityGroupTest { +public: + ~ListAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c7cad9374bf22a70078d3645007578d3955ee815 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3b704d1b7b21faae8840a650de964bab2dd8b15b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListAccessibilityLevelTest { +public: + ~ListAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d6aa67e4588453418eb3622f9bf009c3bf98292c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(list, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..df16fa901e7ab2a2c55346410201c92d16a0fd75 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/list_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListAccessibilityTextTest { +public: + ~ListAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1a7bb61a0b40cbddaf83d482dba8ba7566d8502f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "progress_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ProgressAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ProgressAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c09e8aa13c88e29b9390495a772a58038243ab27 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ProgressAccessibilityDescriptionTest { +public: + ~ProgressAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..756864b6e352ab92dcc2442eda159bff8b53a20c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "progress_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ProgressAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ProgressAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f53d4e48aace8a6e044850b436fc048ef9f07ba0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ProgressAccessibilityGroupTest { +public: + ~ProgressAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..94b8da92a371895d7f39a4141bdf287d5664bebd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "progress_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ProgressAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ProgressAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ProgressAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ProgressAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ProgressAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ProgressAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..81f09f228d175fde422580f961fa0294cf2fc454 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ProgressAccessibilityLevelTest { +public: + ~ProgressAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..94ba0d545f02d64f5f8fca010a107499051a4b3e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "progress_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ProgressAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ProgressAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + nodeAPI->addChild(column, progress); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(progress, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ProgressAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1ca65c1d6a3c23860e14b374e008b1785ebc2e26 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/progress_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ProgressAccessibilityTextTest { +public: + ~ProgressAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_PROGRESS_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..793d842b0655dafd58e47f878f47360251e18d82 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "refresh_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value RefreshAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value RefreshAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..08ab49e590adcb5e1aa065380f56f17d37d76f73 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class RefreshAccessibilityDescriptionTest { +public: + ~RefreshAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..abdb9d8c601267f177e4edfb90cdac71ab47b8db --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "refresh_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value RefreshAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value RefreshAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..73f6d2c4159f3156fb60101d11c368fe54048f7b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class RefreshAccessibilityGroupTest { +public: + ~RefreshAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9fdb929d74268341c49c02df1ec4f14bbbff3a21 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "refresh_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value RefreshAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value RefreshAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value RefreshAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value RefreshAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value RefreshAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value RefreshAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f8b565828dbe31fbfb6b3f3f2d7788d44fa9a855 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class RefreshAccessibilityLevelTest { +public: + ~RefreshAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..505d82cd29e7167d5628a20f86fd9155ffca44fe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "refresh_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value RefreshAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value RefreshAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + nodeAPI->addChild(column, refresh); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(refresh, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fb9188565a71d4be3a86f032b01de684351dbd14 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/refresh_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class RefreshAccessibilityTextTest { +public: + ~RefreshAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_REFRESH_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..948e929790683262c387077f362093b19d60691e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "scroll_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ScrollAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b57e862cb96ae532a715bf3195ef847e126c2fbd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollAccessibilityDescriptionTest { +public: + ~ScrollAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7f8f02ad30d64bba057e149d10d253f11d135aea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "Scroll_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ScrollAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..249c826f10b80fa94f9e86e3b68528235cf8e74f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollAccessibilityGroupTest { +public: + ~ScrollAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c8ee835ff493f2e66d2d497f5c8c26a1c7367949 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "scroll_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ScrollAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..533569122fa0123a98091cc4c9e0fecbc9cb2e31 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollAccessibilityLevelTest { +public: + ~ScrollAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f85b7c5e959b34726d1ee3183cac06bc43412df9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "scroll_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ScrollAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + nodeAPI->addChild(column, scroll); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(scroll, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8b2970ac1e63341b2fc55ea482b8b9ef46281305 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/scroll_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollAccessibilityTextTest { +public: + ~ScrollAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1708f35b1c965bad4b67840e4eabde7e8820ff13 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..dd89020ea4d46df60d57c52a0eb3e2c71990a9f3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderAccessibilityDescriptionTest { +public: + ~SliderAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fe81e3e5321e9d7a69bfe5cef4de1ebd5f11f096 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..866dceb47578d9a607c9e1dae3e5bcd810b8ffa8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderAccessibilityGroupTest { +public: + ~SliderAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2e8531e380d5fb76b0f45304584ec90e73efa75e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5276cb63c9edad268cc3197abe554b30b696c66d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderAccessibilityLevelTest { +public: + ~SliderAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..60f6182c902bba059143310af361015a711fa959 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->addChild(column, slider); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(slider, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a9fef3378a32a7b715ecf2bf01c51ea9a5d3a16c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/slider_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderAccessibilityTextTest { +public: + ~SliderAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..03ab9f3a4119506540bd4654580f43925fb27dff --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..87f84e252e42bcc11c4ec619e90d8ddc46161400 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperAccessibilityDescriptionTest { +public: + ~SwiperAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..773cffe0f2054b6a2855097b553075a405abf588 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..09eef05659c3f8ac80726279cf776bf906c9a708 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperAccessibilityGroupTest { +public: + ~SwiperAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c327941a5a30de8a14452d17454abefc14213457 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3e6b0ac66f3edcd38f65b8f9b9c24ac822ca257e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperAccessibilityLevelTest { +public: + ~SwiperAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..450abc4f8c2521039074db091126a33d8030506c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + nodeAPI->addChild(column, swiper); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(swiper, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f850ab476fd039520fba44c7689689dd73c5890e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/swiper_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperAccessibilityTextTest { +public: + ~SwiperAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..898ea656d6a7cfb88532bdb2ec7e0e9cc510e49b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..63bbbe99e825429f3be4065308cf9ec57cdc3507 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAccessibilityDescriptionTest { +public: + ~TextAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..32d5aea73890386408fceaaf81223b554b1227a3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..16d59c43e977c0458d8b0e47fe06a4be50d3d912 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAccessibilityGroupTest { +public: + ~TextAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6b6d617de798146fd91c8c1a1254abb19f9a03aa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0e814578fcc6e2d6f946bb6dbd2957ff2b1f3317 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAccessibilityLevelTest { +public: + ~TextAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1201c0c8be9cc0f5874c7f5aacbcce9ee442d612 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(column, text); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(text, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e2eec0e4847c21a41f1e776bb5e607fb3ddb2027 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/text_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAccessibilityTextTest { +public: + ~TextAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5a62769acbdc2d665d3582925bd111bcc8f9ccc7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textarea_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAreaAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAreaAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..dc1f14b3b65c8eebd267c492e2534eb7b19879af --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaAccessibilityDescriptionTest { +public: + ~TextAreaAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c2c9d1dbe8a63b002611e152d254dffcc5abf52b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textarea_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAreaAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAreaAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1b7e34e6576514cd8ecd04b25ff11e9d1f134ac5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaAccessibilityGroupTest { +public: + ~TextAreaAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8299d08c1444160899126de0d83dc2d38765d4c7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textarea_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAreaAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAreaAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAreaAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAreaAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAreaAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAreaAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..4b6c63ee770714e07b554a62af15657cb63796d3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaAccessibilityLevelTest { +public: + ~TextAreaAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5e2051f4d70959a10ee44a89928a0927ea301ad7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textarea_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAreaAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAreaAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->addChild(column, textArea); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(textArea, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9296cc577150785ec26ea50705b257b03156c0e2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textarea_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaAccessibilityTextTest { +public: + ~TextAreaAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e49d4f4076533d740957134d5226b263cfa30464 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextInputAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d65492b43dbea9de74347edadf1a24ff73cf8b79 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputAccessibilityDescriptionTest { +public: + ~TextInputAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d6f316ab9edbc676e838fd77b7d04ea15ad2d57d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextInputAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..77f31e98988a367f2bc32f1434901808daa28aaa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputAccessibilityGroupTest { +public: + ~TextInputAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..47604c5ca2d090d48f6e3009e74d0ba52ac8583f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextInputAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b2a9b6e162be1511654eb376b9afc0183950fafb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputAccessibilityLevelTest { +public: + ~TextInputAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..20c13181fbcc7a1d36f11e9f3996c1d3a45aab28 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextInputAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->addChild(column, textInput); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(textInput, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7ceddd34fb662ca23eb730519de0988bc39188d9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textinput_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputAccessibilityTextTest { +public: + ~TextInputAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d980ffcea28df4c3ee3bc9af03823bae9db1ab2c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextPickerAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..16fd1eedc16a90e9024958e039a84c9dfddfc3ba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerAccessibilityDescriptionTest { +public: + ~TextPickerAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..747f345b33f831d65df0d2afcb76b52e7f767810 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextPickerAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..75def55e99c0834a9f98a381f8a296c083c6913b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerAccessibilityGroupTest { +public: + ~TextPickerAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e042ac7560334b520681c08044e5f6718aed5e68 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextPickerAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fbf5bb26eb9650d3e95b138df23bbb41de6ccc0c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerAccessibilityLevelTest { +public: + ~TextPickerAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ab65d5e5fac2bf65be6ac31ab39ec557f56cdd25 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextPickerAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->addChild(column, textPicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(textPicker, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e418c807e8c9dcb06bcfafd22e4f620d4b0c2c67 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/textpicker_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerAccessibilityTextTest { +public: + ~TextPickerAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cb96533923724c93d90c4ae05a66aedef33badf2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "timepicker_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TimePickerAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e360c61b8c31b1fb355c2b64feb6e7199509f0d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerAccessibilityDescriptionTest { +public: + ~TimePickerAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bcc05eefb471d0634f2b1e55d702598884e06af5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "timepicker_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TimePickerAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c4df1489432ef74318edb431d60baec0b8fd353a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerAccessibilityGroupTest { +public: + ~TimePickerAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..36c0876e093a214e79adfc37edc1304f2d09d761 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "timepicker_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TimePickerAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0c7a1d1ed1c6fd03afae5aa36b8c5496fac83357 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerAccessibilityLevelTest { +public: + ~TimePickerAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aa690b368e62eca3338ba0dd8a445f176441ee98 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "timepicker_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TimePickerAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + nodeAPI->addChild(column, timePicker); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(timePicker, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..4711207f78596aa46afec024cd59138e0d9a8fce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/timepicker_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerAccessibilityTextTest { +public: + ~TimePickerAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..58e01d45e4e0c659248be4e0e5823f12031aaf6a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitydescription_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityDescriptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f94805b1953f7ea8137b8df7979ae492cf2c1571 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleAccessibilityDescriptionTest { +public: + ~ToggleAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0a84aa3eb1a165e8a053b733974b2118eb4bc912 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1b83748956e921275e2bddec6251e3394c01c926 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleAccessibilityGroupTest { +public: + ~ToggleAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..adef305a5ff86ee51c9d31625c5918462932ffd2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitylevel_test.cpp @@ -0,0 +1,507 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleAccessibilityLevelTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleAccessibilityLevelTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6d8e76e99b952a4a8f333a5dd5309b5156f0bd3a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitylevel_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleAccessibilityLevelTest { +public: + ~ToggleAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ffa2b859affdb6163ef4fef8ede1a61d2d508ab4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->addChild(column, toggle); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(toggle, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e16918a301d7e010ff3ad86549c03a4f261d274c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/accessibility/toggle_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleAccessibilityTextTest { +public: + ~ToggleAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..03854332dfee3cfa29a50228162de8cedf2b8c2d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_backgroundcolor_test.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "button_backgroundcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t backgroundColor) +{ + auto nodeHandler = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + + return nodeHandler; +} + +napi_value ButtonBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0xFFFF0000)); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0xFFFFFFFF)); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0x00000000)); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..96f70adb001896679d79aaba8efa2ffa3ff7227b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_backgroundcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BUTTON_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_BUTTON_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ButtonBackgroundColorTest { +public: + ~ButtonBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BUTTON_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bd69368b2c4ced986ea61d2bb26d3365b973c23a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontcolor_test.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "button_fontcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t fontColor) +{ + auto nodeHandler = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_HEIGHT, &height_item); + + // 设置button组件text + ArkUI_NumberValue text_value[] = {}; + ArkUI_AttributeItem text_item = {text_value, sizeof(text_value) / sizeof(ArkUI_NumberValue)}; + text_item.string = "fontColor"; + nodeAPI->setAttribute(nodeHandler, NODE_BUTTON_LABEL, &text_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = fontColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_FONT_COLOR, &background_color_item); + + return nodeHandler; +} + +napi_value ButtonFontColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonFontColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonFontColorTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0xFFFF0000)); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0xFFFFFFFF)); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0x00000000)); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonFontColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..69ad06fff309eb7e1d99b4e9b48b91df398aac61 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BUTTON_FONTCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_BUTTON_FONTCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ButtonFontColorTest { +public: + ~ButtonFontColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BUTTON_FONTCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontsize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontsize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ce0f0cf5bc24fdf28671425955b4f3ab1811759a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontsize_test.cpp @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "button_fontsize_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ButtonFontSizeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonFontSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonFontSizeTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建button节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto largeButton = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto smallButton = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto abnormalButton = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + nodeAPI->addChild(column, largeButton); + nodeAPI->addChild(column, smallButton); + nodeAPI->addChild(column, abnormalButton); + + // 设置button组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置button组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置button组件text + ArkUI_NumberValue text_value[] = {}; + ArkUI_AttributeItem text_item = {text_value, sizeof(text_value) / sizeof(ArkUI_NumberValue)}; + text_item.string = "normal"; + nodeAPI->setAttribute(button, NODE_BUTTON_LABEL, &text_item); + + // 设置button组件fontSize + ArkUI_NumberValue font_value[] = {{.f32 = 16}}; + ArkUI_AttributeItem font_item = {font_value, sizeof(font_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_FONT_SIZE, &font_item); + + // 设置largeButton组件宽度 + nodeAPI->setAttribute(largeButton, NODE_WIDTH, &width_item); + + // 设置largeButton组件高度 + nodeAPI->setAttribute(largeButton, NODE_HEIGHT, &height_item); + + // 设置largeButton组件text + ArkUI_NumberValue large_text_value[] = {}; + ArkUI_AttributeItem large_text_item = {large_text_value, sizeof(large_text_value) / sizeof(ArkUI_NumberValue)}; + large_text_item.string = "large"; + nodeAPI->setAttribute(largeButton, NODE_BUTTON_LABEL, &large_text_item); + + // 设置largeButton组件fontSize + ArkUI_NumberValue large_font_value[] = {{.f32 = 72}}; + ArkUI_AttributeItem large_font_item = {large_font_value, sizeof(large_font_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(largeButton, NODE_FONT_SIZE, &large_font_item); + + // 设置smallButton组件宽度 + nodeAPI->setAttribute(smallButton, NODE_WIDTH, &width_item); + + // 设置smallButton组件高度 + nodeAPI->setAttribute(smallButton, NODE_HEIGHT, &height_item); + + // 设置smallButton组件text + ArkUI_NumberValue small_text_value[] = {}; + ArkUI_AttributeItem small_text_item = {small_text_value, sizeof(small_text_value) / sizeof(ArkUI_NumberValue)}; + small_text_item.string = "small"; + nodeAPI->setAttribute(smallButton, NODE_BUTTON_LABEL, &small_text_item); + + // 设置smallButton组件fontSize + ArkUI_NumberValue small_font_value[] = {{.f32 = 8}}; + ArkUI_AttributeItem small_font_item = {small_font_value, sizeof(small_font_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(smallButton, NODE_FONT_SIZE, &small_font_item); + + // 设置abnormalButton组件宽度 + nodeAPI->setAttribute(abnormalButton, NODE_WIDTH, &width_item); + + // 设置abnormalButton组件高度 + nodeAPI->setAttribute(abnormalButton, NODE_HEIGHT, &height_item); + + // 设置abnormalButton组件text + ArkUI_NumberValue abnormal_text_value[] = {}; + ArkUI_AttributeItem abnormal_text_item = {abnormal_text_value, + sizeof(abnormal_text_value) / sizeof(ArkUI_NumberValue)}; + abnormal_text_item.string = "abnormal"; + nodeAPI->setAttribute(abnormalButton, NODE_BUTTON_LABEL, &abnormal_text_item); + + // 设置abnormalButton组件fontSize + ArkUI_NumberValue abnormal_font_value[] = {{.f32 = -10}}; + ArkUI_AttributeItem abnormal_font_item = {abnormal_font_value, + sizeof(abnormal_font_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalButton, NODE_FONT_SIZE, &abnormal_font_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonFontSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontsize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontsize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b4d6b672a8a5cbce8712c940ea05cb9e51c84a08 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontsize_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BUTTON_FONTSIZE_TEST_H +#define ARKUI_CAPI_DEMO_BUTTON_FONTSIZE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ButtonFontSizeTest { +public: + ~ButtonFontSizeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BUTTON_FONTSIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontweight_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontweight_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c36df3a4bde0501f3d751364385f4cea2008e454 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontweight_test.cpp @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "button_fontweight_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ButtonFontWeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonFontWeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonFontWeightTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建button节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button_100 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_200 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_300 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_400 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_500 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_600 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_700 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_800 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_900 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_lighter = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_normal = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_regular = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_medium = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_bold = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_bolder = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button_abnormal = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button_100); + nodeAPI->addChild(column, button_200); + nodeAPI->addChild(column, button_300); + nodeAPI->addChild(column, button_400); + nodeAPI->addChild(column, button_500); + nodeAPI->addChild(column, button_600); + nodeAPI->addChild(column, button_700); + nodeAPI->addChild(column, button_800); + nodeAPI->addChild(column, button_900); + nodeAPI->addChild(column, button_lighter); + nodeAPI->addChild(column, button_normal); + nodeAPI->addChild(column, button_regular); + nodeAPI->addChild(column, button_medium); + nodeAPI->addChild(column, button_bold); + nodeAPI->addChild(column, button_bolder); + nodeAPI->addChild(column, button_abnormal); + + // 设置button组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_100, NODE_WIDTH, &width_item); + + // 设置button组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_100, NODE_HEIGHT, &height_item); + + // 设置button组件text + ArkUI_NumberValue text_value[] = {}; + ArkUI_AttributeItem text_item = {text_value, sizeof(text_value) / sizeof(ArkUI_NumberValue)}; + text_item.string = "fontWeight"; + nodeAPI->setAttribute(button_100, NODE_BUTTON_LABEL, &text_item); + + // 设置button组件fontWeight + ArkUI_NumberValue weight_value[] = {{.i32 = ARKUI_FONT_WEIGHT_W100}}; + ArkUI_AttributeItem weight_item = {weight_value, sizeof(weight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_100, NODE_FONT_WEIGHT, &weight_item); + + // 设置button组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_100, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置button_200组件相关属性 + nodeAPI->setAttribute(button_200, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_200, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_200, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_200, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_200[] = {{.i32 = ARKUI_FONT_WEIGHT_W200}}; + ArkUI_AttributeItem weight_item_200 = {weight_value_200, sizeof(weight_value_200) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_200, NODE_FONT_WEIGHT, &weight_item_200); + + // 设置button_300组件相关属性 + nodeAPI->setAttribute(button_300, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_300, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_300, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_300, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_300[] = {{.i32 = ARKUI_FONT_WEIGHT_W300}}; + ArkUI_AttributeItem weight_item_300 = {weight_value_300, sizeof(weight_value_300) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_300, NODE_FONT_WEIGHT, &weight_item_300); + + // 设置button_400组件相关属性 + nodeAPI->setAttribute(button_400, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_400, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_400, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_400, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_400[] = {{.i32 = ARKUI_FONT_WEIGHT_W400}}; + ArkUI_AttributeItem weight_item_400 = {weight_value_400, sizeof(weight_value_400) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_400, NODE_FONT_WEIGHT, &weight_item_400); + + // 设置button_500组件相关属性 + nodeAPI->setAttribute(button_500, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_500, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_500, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_500, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_500[] = {{.i32 = ARKUI_FONT_WEIGHT_W500}}; + ArkUI_AttributeItem weight_item_500 = {weight_value_500, sizeof(weight_value_500) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_500, NODE_FONT_WEIGHT, &weight_item_500); + + // 设置button_600组件相关属性 + nodeAPI->setAttribute(button_600, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_600, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_600, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_600, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_600[] = {{.i32 = ARKUI_FONT_WEIGHT_W600}}; + ArkUI_AttributeItem weight_item_600 = {weight_value_600, sizeof(weight_value_600) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_600, NODE_FONT_WEIGHT, &weight_item_600); + + // 设置button_700组件相关属性 + nodeAPI->setAttribute(button_700, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_700, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_700, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_700, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_700[] = {{.i32 = ARKUI_FONT_WEIGHT_W700}}; + ArkUI_AttributeItem weight_item_700 = {weight_value_700, sizeof(weight_value_700) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_700, NODE_FONT_WEIGHT, &weight_item_700); + + // 设置button_800组件相关属性 + nodeAPI->setAttribute(button_800, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_800, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_800, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_800, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_800[] = {{.i32 = ARKUI_FONT_WEIGHT_W800}}; + ArkUI_AttributeItem weight_item_800 = {weight_value_800, sizeof(weight_value_800) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_800, NODE_FONT_WEIGHT, &weight_item_800); + + // 设置button_900组件相关属性 + nodeAPI->setAttribute(button_900, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_900, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_900, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_900, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_900[] = {{.i32 = ARKUI_FONT_WEIGHT_W900}}; + ArkUI_AttributeItem weight_item_900 = {weight_value_900, sizeof(weight_value_900) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_900, NODE_FONT_WEIGHT, &weight_item_900); + + // 设置button_lighter组件相关属性 + nodeAPI->setAttribute(button_lighter, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_lighter, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_lighter, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_lighter, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_lighter[] = {{.i32 = ARKUI_FONT_WEIGHT_LIGHTER}}; + ArkUI_AttributeItem weight_item_lighter = {weight_value_lighter, + sizeof(weight_value_lighter) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_lighter, NODE_FONT_WEIGHT, &weight_item_lighter); + + // 设置button_normal组件相关属性 + nodeAPI->setAttribute(button_normal, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_normal, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_normal, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_normal, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_normal[] = {{.i32 = ARKUI_FONT_WEIGHT_NORMAL}}; + ArkUI_AttributeItem weight_item_normal = {weight_value_normal, + sizeof(weight_value_normal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_normal, NODE_FONT_WEIGHT, &weight_item_normal); + + // 设置button_regular组件相关属性 + nodeAPI->setAttribute(button_regular, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_regular, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_regular, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_regular, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_regular[] = {{.i32 = ARKUI_FONT_WEIGHT_REGULAR}}; + ArkUI_AttributeItem weight_item_regular = {weight_value_regular, + sizeof(weight_value_regular) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_regular, NODE_FONT_WEIGHT, &weight_item_regular); + + // 设置button_medium组件相关属性 + nodeAPI->setAttribute(button_medium, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_medium, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_medium, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_medium, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_medium[] = {{.i32 = ARKUI_FONT_WEIGHT_MEDIUM}}; + ArkUI_AttributeItem weight_item_medium = {weight_value_medium, + sizeof(weight_value_medium) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_medium, NODE_FONT_WEIGHT, &weight_item_medium); + + // 设置button_bold组件相关属性 + nodeAPI->setAttribute(button_bold, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_bold, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_bold, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_bold, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_bold[] = {{.i32 = ARKUI_FONT_WEIGHT_BOLD}}; + ArkUI_AttributeItem weight_item_bold = {weight_value_bold, sizeof(weight_value_bold) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_bold, NODE_FONT_WEIGHT, &weight_item_bold); + + // 设置button_bolder组件相关属性 + nodeAPI->setAttribute(button_bolder, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_bolder, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_bolder, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_bolder, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_bolder[] = {{.i32 = ARKUI_FONT_WEIGHT_BOLDER}}; + ArkUI_AttributeItem weight_item_bolder = {weight_value_bolder, + sizeof(weight_value_bolder) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_bolder, NODE_FONT_WEIGHT, &weight_item_bolder); + + // 设置button_abnormal组件相关属性 + nodeAPI->setAttribute(button_abnormal, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(button_abnormal, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(button_abnormal, NODE_BUTTON_LABEL, &text_item); + nodeAPI->setAttribute(button_abnormal, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue weight_value_abnormal[] = {{.i32 = -10}}; + ArkUI_AttributeItem weight_item_abnormal = {weight_value_abnormal, + sizeof(weight_value_abnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button_abnormal, NODE_FONT_WEIGHT, &weight_item_abnormal); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonFontWeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontweight_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontweight_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6d36f0604f10a0dfcabdce5029e2cb330dc0544f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_fontweight_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BUTTON_FONTWEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_BUTTON_FONTWEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ButtonFontWeightTest { +public: + ~ButtonFontWeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BUTTON_FONTWEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_onclick_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_onclick_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..53fb6a73bfda3ea95bd45b9e5f98367a62717472 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_onclick_test.cpp @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "button_onclick_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +using namespace std; +static ArkUI_NodeHandle text; + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue enable_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enable_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enable_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ButtonOnClickTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonOnClickTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ButtonOnClickTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_CLICK_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + if (text != nullptr && result->data[PARAM_2].f32 > 0) { + string str = + "x:" + to_string(result->data[0].f32) + "\n" + "y:" + to_string(result->data[1].f32) + "\n" + + "source:" + to_string(result->data[3].f32) + "\n" + "windowX:" + to_string(result->data[4].f32) + "\n" + + "windowY:" + to_string(result->data[5].f32) + "\n" + "displayX:" + to_string(result->data[6].f32) + + "\n" + "displayY:" + to_string(result->data[7].f32); + ArkUI_AttributeItem content_item = {}; + content_item.string = str.c_str(); + nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &content_item); + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value ButtonOnClickTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ButtonOnClickTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonOnClickTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = createChildNode(nodeAPI, true); + auto buttonDisable = createChildNode(nodeAPI, false); + text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnClickTestButton"; + nodeAPI->setAttribute(button, NODE_ID, &id_item); + id_item.string = "OnClickTestButtonDisable"; + nodeAPI->setAttribute(buttonDisable, NODE_ID, &id_item); + + // 添加子组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(column, buttonDisable); + nodeAPI->addChild(column, text); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ButtonOnClickTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_onclick_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_onclick_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6f8becbf65017c0c4eed7664dc8b1dfa26f9e5df --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/button/button_onclick_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BUTTON_ONCLICK_TEST_H +#define ARKUI_CAPI_DEMO_BUTTON_ONCLICK_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ButtonOnClickTest { +public: + ~ButtonOnClickTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BUTTON_ONCLICK_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_edgealign_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_edgealign_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fe27f126af3b26a3d71e443bfff14da8796cc76d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_edgealign_test.cpp @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "calendarpicker_edgealign_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle calendarPicker; +static ArkUI_NodeHandle column; +static char xComponentID; + +static void BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + } + // 创建组件 + column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + calendarPicker = nodeAPI->createNode(ARKUI_NODE_CALENDAR_PICKER); + // 嵌套组件 + nodeAPI->addChild(column, calendarPicker); + + // 设置calendarPicker组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(calendarPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue selected_date_value[] = {{.u32 = 2024}, {.u32 = 5}, {.u32 = 5}}; + ArkUI_AttributeItem selected_date_item = {selected_date_value, + sizeof(selected_date_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_SELECTED_DATE, &selected_date_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnClick"; + nodeAPI->setAttribute(calendarPicker, NODE_ID, &id_item); +} + +napi_value CalendarPickerEdgeAlignTest::CreateNativeNodeStart(napi_env env, napi_callback_info info) +{ + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsRadialGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + const auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + + BasicSet(env, info, nodeAPI); + + // calendarPicker组件设置选择器与入口组件的对齐方式 + ArkUI_NumberValue start_value[] = {{.i32 = ARKUI_CALENDAR_ALIGNMENT_START}, {.f32 = -50}, {.f32 = 50}}; + ArkUI_AttributeItem start_value_item = {start_value, sizeof(start_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &start_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerEdgeAlignTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CalendarPickerEdgeAlignTest::CreateNativeNodeCenter(napi_env env, napi_callback_info info) +{ + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsRadialGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + const auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + + BasicSet(env, info, nodeAPI); + + // calendarPicker组件设置选择器与入口组件的对齐方式 + ArkUI_NumberValue start_value[] = {{.i32 = ARKUI_CALENDAR_ALIGNMENT_CENTER}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem start_value_item = {start_value, sizeof(start_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &start_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerEdgeAlignTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CalendarPickerEdgeAlignTest::CreateNativeNodeEnd(napi_env env, napi_callback_info info) +{ + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsRadialGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + const auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + + BasicSet(env, info, nodeAPI); + + // calendarPicker组件设置选择器与入口组件的对齐方式 + ArkUI_NumberValue start_value[] = {{.i32 = ARKUI_CALENDAR_ALIGNMENT_END}, {.f32 = 50}, {.f32 = -500}}; + ArkUI_AttributeItem start_value_item = {start_value, sizeof(start_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &start_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerEdgeAlignTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CalendarPickerEdgeAlignTest::CreateNativeNodeDefault(napi_env env, napi_callback_info info) +{ + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsRadialGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + const auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + + BasicSet(env, info, nodeAPI); + + // calendarPicker组件设置选择器与入口组件的对齐方式 + ArkUI_NumberValue start_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem start_value_item = {start_value, sizeof(start_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &start_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerEdgeAlignTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_edgealign_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_edgealign_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d6422fff774346a18c68b4a04612d9af8fd0cfd0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_edgealign_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CALENDARPICKER_EDGEALIGN_TEST_H +#define ARKUI_CAPI_DEMO_CALENDARPICKER_EDGEALIGN_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CalendarPickerEdgeAlignTest { +public: + ~CalendarPickerEdgeAlignTest(); + static napi_value CreateNativeNodeStart(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCenter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnd(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDefault(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CALENDARPICKER_EDGEALIGN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_enabled_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_enabled_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bc59d8eeff88258635db6aeb4fb26a803df0f820 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_enabled_test.cpp @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "calendarpicker_enabled_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CALENDAR_PICKER); + + if (enabled != SIZE_100) { + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + } + + // set background color + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + // set selected date + ArkUI_NumberValue calendar_picker_value[] = {{.u32 = YEAR}, {.u32 = MONTH}, {.u32 = DATE}}; + ArkUI_AttributeItem calendar_picker_value_item = {calendar_picker_value, + sizeof(calendar_picker_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CALENDAR_PICKER_SELECTED_DATE, &calendar_picker_value_item); + + // set focusable + ArkUI_NumberValue focusable_value[] = {{.i32 = FOCUSABLE_TRUE}}; + ArkUI_AttributeItem focusable_item = {focusable_value, sizeof(focusable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOCUSABLE, &focusable_item); + + // set calendarPicker width + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &default_width_item); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CalendarPickerEnabledTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerEnabledTest", + "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + uint32_t color = COLOR_PURPLE; + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CalendarPickerEnabledTest", "OnEventReceive eventId: %{public}d", + eventId); + switch (eventId) { + case ON_CLICK_EVENT_ID: + color = COLOR_GREEN; + break; + case ON_FOCUS_EVENT_ID: + color = COLOR_BLUE; + break; + case ON_BLUR_EVENT_ID: + color = COLOR_YELLOW; + break; + default: + break; + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value CalendarPickerEnabledTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerEnabledTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerEnabledTest", + "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // 设置column组件高度 + ArkUI_NumberValue height_column_value[] = {{.f32 = SIZE_600}}; + ArkUI_AttributeItem height_column_item = {height_column_value, + sizeof(height_column_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_column_item); + + // 设置text组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件id + ArkUI_AttributeItem id_item_text = {}; + id_item_text.string = "TextClick"; + + // 设置text组件获取焦点 + ArkUI_NumberValue focusable_value[] = {{.i32 = FOCUSABLE_TRUE}}; + ArkUI_AttributeItem focusable_item = {focusable_value, sizeof(focusable_value) / sizeof(ArkUI_NumberValue)}; + + // first text + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + ArkUI_NumberValue position_value[] = {{.f32 = PARAM_0}, {.f32 = PARAM_0}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_POSITION, &position_item); + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text, NODE_ID, &id_item_text); + nodeAPI->setAttribute(text, NODE_FOCUSABLE, &focusable_item); + + // first calendarPicker + auto calendarPicker = createChildNode(nodeAPI, PARAM_1); + ArkUI_AttributeItem id_item = {}; + id_item.string = "EnabledCalendarPicker"; + nodeAPI->setAttribute(calendarPicker, NODE_ID, &id_item); + nodeAPI->registerNodeEvent(calendarPicker, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + // second calendarPicker + auto calendarPickerDisabled = createChildNode(nodeAPI, PARAM_0); + ArkUI_AttributeItem id_second_item = {}; + id_second_item.string = "DisabledCalendarPicker"; + nodeAPI->setAttribute(calendarPickerDisabled, NODE_ID, &id_second_item); + nodeAPI->registerNodeEvent(calendarPickerDisabled, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + // third calendarPicker + auto calendarPickerAbnormal = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + ArkUI_AttributeItem id_third_item = {}; + id_third_item.string = "AbnormalCalendarPicker"; + nodeAPI->setAttribute(calendarPickerAbnormal, NODE_ID, &id_third_item); + nodeAPI->registerNodeEvent(calendarPickerAbnormal, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + // calendarPicker for click + auto calendarPickerClick = createChildNode(nodeAPI, PARAM_1); + ArkUI_AttributeItem id_item_click = {}; + id_item_click.string = "OnClickEnabledCalendarPicker"; + nodeAPI->setAttribute(calendarPickerClick, NODE_ID, &id_item_click); + nodeAPI->registerNodeEvent(calendarPickerClick, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // calendarPicker for click + auto calendarPickerDisabledClick = createChildNode(nodeAPI, PARAM_0); + ArkUI_AttributeItem id_second_item_click = {}; + id_second_item_click.string = "OnClickDisabledCalendarPicker"; + nodeAPI->setAttribute(calendarPickerDisabledClick, NODE_ID, &id_second_item_click); + nodeAPI->registerNodeEvent(calendarPickerDisabledClick, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // calendarPicker for click + auto calendarPickerAbnormalClick = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + ArkUI_AttributeItem id_third_item_click = {}; + id_third_item_click.string = "OnClickAbnormalCalendarPicker"; + nodeAPI->setAttribute(calendarPickerAbnormalClick, NODE_ID, &id_third_item_click); + nodeAPI->registerNodeEvent(calendarPickerAbnormalClick, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // calendarPicker for blur + auto calendarPickerBlur = createChildNode(nodeAPI, PARAM_1); + ArkUI_AttributeItem id_item_blur = {}; + id_item_blur.string = "OnBlurEnabledCalendarPicker"; + nodeAPI->setAttribute(calendarPickerBlur, NODE_ID, &id_item_blur); + nodeAPI->registerNodeEvent(calendarPickerBlur, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(calendarPickerBlur, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + // calendarPicker for blur + auto calendarPickerDisabledBlur = createChildNode(nodeAPI, PARAM_0); + ArkUI_AttributeItem id_second_item_blur = {}; + id_second_item_blur.string = "OnBlurDisabledCalendarPicker"; + nodeAPI->setAttribute(calendarPickerDisabledBlur, NODE_ID, &id_second_item_blur); + nodeAPI->registerNodeEvent(calendarPickerDisabledBlur, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(calendarPickerDisabledBlur, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + // calendarPicker for blur + auto calendarPickerAbnormalBlur = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + ArkUI_AttributeItem id_third_item_blur = {}; + id_third_item_blur.string = "OnBlurAbnormalCalendarPicker"; + nodeAPI->setAttribute(calendarPickerAbnormalBlur, NODE_ID, &id_third_item_blur); + nodeAPI->registerNodeEvent(calendarPickerAbnormalBlur, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(calendarPickerAbnormalBlur, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + // row + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(rowFirst, calendarPickerClick); + nodeAPI->addChild(rowFirst, calendarPicker); + nodeAPI->addChild(rowFirst, calendarPickerBlur); + nodeAPI->addChild(rowSecond, calendarPickerDisabledClick); + nodeAPI->addChild(rowSecond, calendarPickerDisabled); + nodeAPI->addChild(rowSecond, calendarPickerDisabledBlur); + nodeAPI->addChild(rowThird, calendarPickerAbnormalClick); + nodeAPI->addChild(rowThird, calendarPickerAbnormal); + nodeAPI->addChild(rowThird, calendarPickerAbnormalBlur); + + nodeAPI->addChild(column, text); + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + + // Bind click event + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_enabled_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_enabled_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2afa36c4b81d33410e7934b2c9e73248410e8cc9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_enabled_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CALENDARPICKER_ENABLED_TEST_H +#define ARKUI_CAPI_DEMO_CALENDARPICKER_ENABLED_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +#define YEAR 2024 +#define MONTH 1 +#define DATE 1 + +#define FOCUSABLE_TRUE 1 + +class CalendarPickerEnabledTest { +public: + ~CalendarPickerEnabledTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CALENDARPICKER_ENABLED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_onchange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_onchange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..494c387120f5a1dcbbed91d51296fb0d356b3c22 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_onchange_test.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "calendarpicker_onchange_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto calendarPicker = nodeAPI->createNode(ARKUI_NODE_CALENDAR_PICKER); + + ArkUI_NumberValue enable_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enable_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_ENABLED, &enable_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = 200}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue selected_date_value[] = {{.u32 = 2024}, {.u32 = 5}, {.u32 = 5}}; + ArkUI_AttributeItem selected_date_item = {selected_date_value, + sizeof(selected_date_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_SELECTED_DATE, &selected_date_item); + + ArkUI_NumberValue start_value[] = {{.i32 = ARKUI_CALENDAR_ALIGNMENT_CENTER}, {.f32 = 0}, {.f32 = -150}}; + ArkUI_AttributeItem start_value_item = {start_value, sizeof(start_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_EDGE_ALIGNMENT, &start_value_item); + + nodeAPI->registerNodeEvent(calendarPicker, NODE_CALENDAR_PICKER_EVENT_ON_CHANGE, ON_CHANGE_EVENT_ID, nullptr); + + return calendarPicker; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_CHANGE_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CalendarPickerOnChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerOnChangeTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + auto calendarPicker = createChildNode(nodeAPI, true); + auto calendarPickerDisable = createChildNode(nodeAPI, false); + nodeAPI->addChild(column, calendarPicker); + nodeAPI->addChild(column, calendarPickerDisable); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "calendarPickerOnChangeTest"; + nodeAPI->setAttribute(calendarPicker, NODE_ID, &id_item); + id_item.string = "calendarPickerOnChangeTestDisable"; + nodeAPI->setAttribute(calendarPickerDisable, NODE_ID, &id_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerOnChangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_onchange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_onchange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..01ba7c3e108c63b4c46363ab7599a97c3efaff2d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_onchange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CALENDARPICKER_ONCHANGE_TEST_H +#define ARKUI_CAPI_DEMO_CALENDARPICKER_ONCHANGE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CalendarPickerOnChangeTest { +public: + ~CalendarPickerOnChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CALENDARPICKER_ONCHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_textstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_textstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7339e8695cb154cd5fc7caf90642a50419ed61fb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_textstyle_test.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "calendarpicker_textstyle_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t color, float fontSize, int32_t fontWeight) +{ + auto calendarPicker = nodeAPI->createNode(ARKUI_NODE_CALENDAR_PICKER); + + ArkUI_NumberValue textStyle_value[] = {{.u32 = color}, {.f32 = fontSize}, {.i32 = fontWeight}}; + ArkUI_AttributeItem textStyle_value_item = {textStyle_value, sizeof(textStyle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_TEXT_STYLE, &textStyle_value_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue selected_date_value[] = {{.u32 = 2024}, {.u32 = 5}, {.u32 = 5}}; + ArkUI_AttributeItem selected_date_item = {selected_date_value, + sizeof(selected_date_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_SELECTED_DATE, &selected_date_item); + + return calendarPicker; +} + +napi_value CalendarPickerTextStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto calendarPicker1 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_W100); + auto calendarPicker2 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_W200); + auto calendarPicker3 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_W300); + auto calendarPicker4 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_W400); + auto calendarPicker5 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_W500); + auto calendarPicker6 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_W600); + auto calendarPicker7 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_W700); + auto calendarPicker8 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_W800); + auto calendarPicker9 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_W900); + auto calendarPicker10 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_BOLD); + auto calendarPicker11 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_NORMAL); + auto calendarPicker12 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_BOLDER); + auto calendarPicker13 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_LIGHTER); + auto calendarPicker14 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_MEDIUM); + auto calendarPicker15 = createChildNode(nodeAPI, COLOR_RED, SIZE_30, ARKUI_FONT_WEIGHT_REGULAR); + auto calendarPicker16 = createChildNode(nodeAPI, 1234, -1, ENUM_ABNORMAL_VALUE); + + nodeAPI->addChild(column, calendarPicker1); + nodeAPI->addChild(column, calendarPicker2); + nodeAPI->addChild(column, calendarPicker3); + nodeAPI->addChild(column, calendarPicker4); + nodeAPI->addChild(column, calendarPicker5); + nodeAPI->addChild(column, calendarPicker6); + nodeAPI->addChild(column, calendarPicker7); + nodeAPI->addChild(column, calendarPicker8); + nodeAPI->addChild(column, calendarPicker9); + nodeAPI->addChild(column, calendarPicker10); + nodeAPI->addChild(column, calendarPicker11); + nodeAPI->addChild(column, calendarPicker12); + nodeAPI->addChild(column, calendarPicker13); + nodeAPI->addChild(column, calendarPicker14); + nodeAPI->addChild(column, calendarPicker15); + nodeAPI->addChild(column, calendarPicker16); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_textstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_textstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e478f51fad65cdeaeb0370c59624fb999e276884 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_textstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CALENDARPICKER_TEXTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_CALENDARPICKER_TEXTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CalendarPickerTextStyleTest { +public: + ~CalendarPickerTextStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CALENDARPICKER_TEXTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..92d97748d6d9ff88f785eda6d89e950bc15a9bee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_width_test.cpp @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "calendarpicker_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define SIZE_NEGATIVE_100 -100 +#define YEAR 2024 +#define MONTH 1 +#define DATE 1 + +napi_value CalendarPickerWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerWidthTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置calendarPicker组件显示日期 + ArkUI_NumberValue calendar_picker_value[] = {{.u32 = YEAR}, {.u32 = MONTH}, {.u32 = DATE}}; + ArkUI_AttributeItem calendar_picker_value_item = {calendar_picker_value, + sizeof(calendar_picker_value) / sizeof(ArkUI_NumberValue)}; + + // 设置calendarPicker组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置calendarPicker组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first calendarPicker + auto calendarPicker = nodeAPI->createNode(ARKUI_NODE_CALENDAR_PICKER); + nodeAPI->setAttribute(calendarPicker, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(calendarPicker, NODE_MARGIN, &margin_item); + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_SELECTED_DATE, &calendar_picker_value_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_WIDTH, &width_item); + + // second calendarPicker + auto calendarPicker_second = nodeAPI->createNode(ARKUI_NODE_CALENDAR_PICKER); + nodeAPI->setAttribute(calendarPicker_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(calendarPicker_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = SIZE_NEGATIVE_100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker_second, NODE_WIDTH, &width_second_item); + nodeAPI->setAttribute(calendarPicker_second, NODE_CALENDAR_PICKER_SELECTED_DATE, &calendar_picker_value_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, calendarPicker); + nodeAPI->insertChildAfter(column, calendarPicker_second, calendarPicker); + + // calendarPicker组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CalendarPickerWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerWidthTest", "CreateNativeNodeLarge"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为500 + auto calendarPicker = nodeAPI->createNode(ARKUI_NODE_CALENDAR_PICKER); + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_WIDTH, &width_item); + + // 设置calendarPicker组件显示日期 + ArkUI_NumberValue calendar_picker_value[] = {{.u32 = YEAR}, {.u32 = MONTH}, {.u32 = DATE}}; + ArkUI_AttributeItem calendar_picker_value_item = {calendar_picker_value, + sizeof(calendar_picker_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(calendarPicker, NODE_CALENDAR_PICKER_SELECTED_DATE, &calendar_picker_value_item); + + nodeAPI->addChild(column, calendarPicker); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CalendarPickerWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..43d1cbbd2519c49025657bcb85d4a24e73a77131 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/calendarpicker/calendarpicker_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CALENDARPICKER_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_CALENDARPICKER_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CalendarPickerWidthTest { +public: + ~CalendarPickerWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CALENDARPICKER_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_enabled_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_enabled_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6a438b2f3f7d43688588d39f91c789d93889aaf1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_enabled_test.cpp @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_enabled_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int enabled, const char *id) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + + if (enabled != SIZE_100) { + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + } + + // set id + ArkUI_AttributeItem id_item = {}; + id_item.string = id; + nodeAPI->setAttribute(nodeHandle, NODE_ID, &id_item); + + // set background color + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + // set width + ArkUI_NumberValue width_value[] = {{.f32 = CHECKBOX_WIDTH_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // set height + ArkUI_NumberValue height_value[] = {{.f32 = CHECKBOX_HEIGHT_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + // set focusable + ArkUI_NumberValue focusable_value[] = {{.i32 = FOCUSABLE_TRUE}}; + ArkUI_AttributeItem focusable_item = {focusable_value, sizeof(focusable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOCUSABLE, &focusable_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CheckboxEnabledTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxEnabledTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CheckboxEnabledTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + uint32_t color = COLOR_RED; + switch (eventId) { + case ON_CLICK_EVENT_ID: + color = COLOR_GREEN; + break; + case ON_FOCUS_EVENT_ID: + color = COLOR_BLUE; + break; + case ON_BLUR_EVENT_ID: + color = COLOR_YELLOW; + break; + default: + break; + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value CheckboxEnabledTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxEnabledTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxEnabledTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // enabled checkbox + auto checkbox_click = createChildNode(nodeAPI, PARAM_1, "OnClickEnabledCheckbox"); + auto checkbox_focus = createChildNode(nodeAPI, PARAM_1, "OnFocusEnabledCheckbox"); + auto checkbox_blur = createChildNode(nodeAPI, PARAM_1, "OnBlurEnabledCheckbox"); + + // disabled checkbox + auto checkbox_disabled_click = createChildNode(nodeAPI, PARAM_0, "OnClickDisabledCheckbox"); + auto checkbox_disabled_focus = createChildNode(nodeAPI, PARAM_0, "OnFocusDisabledCheckbox"); + auto checkbox_disabled_blur = createChildNode(nodeAPI, PARAM_0, "OnBlurDisabledCheckbox"); + + // abnormal checkbox + auto checkbox_abnormal_click = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnClickAbnormalCheckbox"); + auto checkbox_abnormal_focus = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnFocusAbnormalCheckbox"); + auto checkbox_abnormal_blur = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnBlurAbnormalCheckbox"); + + // set row height + ArkUI_NumberValue row_height_value[] = {{.f32 = ROW_HEIGHT_110}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + + // set row width + ArkUI_NumberValue row_width_value[] = {{.f32 = ROW_WIDTH_350}}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + + // set row alignment + ArkUI_NumberValue row_justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem row_justify_content_item = {row_justify_content_value, + sizeof(row_justify_content_value) / sizeof(ArkUI_NumberValue)}; + + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_first, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_fourth, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_fourth, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_fourth, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + nodeAPI->addChild(row_first, checkbox_click); + nodeAPI->insertChildAfter(row_first, checkbox_focus, checkbox_click); + nodeAPI->insertChildAfter(row_first, checkbox_blur, checkbox_focus); + + nodeAPI->addChild(row_second, checkbox_disabled_click); + nodeAPI->insertChildAfter(row_second, checkbox_disabled_focus, checkbox_disabled_click); + nodeAPI->insertChildAfter(row_second, checkbox_disabled_blur, checkbox_disabled_focus); + + nodeAPI->addChild(row_third, checkbox_abnormal_click); + nodeAPI->insertChildAfter(row_third, checkbox_abnormal_focus, checkbox_abnormal_click); + nodeAPI->insertChildAfter(row_third, checkbox_abnormal_blur, checkbox_abnormal_focus); + + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + nodeAPI->insertChildAfter(column, row_fourth, row_third); + + // Bind click event + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_enabled_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_enabled_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8c381c0dd0de75d218f3201dbef9df9cf2cba128 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_enabled_test.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_ENABLED_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_ENABLED_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +#define COLUMN_HEIGHT_700 700 +#define COLUMN_WIDTH_200 200 + +#define ROW_HEIGHT_110 110 +#define ROW_WIDTH_350 350 + +#define CHECKBOX_HEIGHT_100 100 +#define CHECKBOX_WIDTH_100 100 + +#define FOCUSABLE_TRUE 1 + +class CheckboxEnabledTest { +public: + ~CheckboxEnabledTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_ENABLED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c408186d8f35b93fb8ff3e5cefc61bdeaa35f039 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_height_test.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define SIZE_NEGATIVE_50 (-50) + +napi_value CheckboxHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxHeightTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置checkbox组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置checkbox组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置checkbox组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置checkbox组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first checkbox + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(checkbox, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // second checkbox + auto checkbox_second = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->setAttribute(checkbox_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(checkbox_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(checkbox_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(checkbox_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = SIZE_NEGATIVE_50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, checkbox); + nodeAPI->insertChildAfter(column, checkbox_second, checkbox); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CheckboxHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxHeightTest", "CreateNativeNodeLarge"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置高度为500 + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置checkbox组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置宽度为200 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + nodeAPI->addChild(column, checkbox); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1480d671529116c2a0f1391c34eb5d3009f01324 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxHeightTest { +public: + ~CheckboxHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_mark_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_mark_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..908812b39af1a2711ca141c448935a7e3df983a2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_mark_test.cpp @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_mark_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue select_value[] = {{.i32 = true}}; + ArkUI_AttributeItem select_item = {select_value, sizeof(select_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT, &select_item); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t color, float size, float thickness) +{ + auto nodeHandle = createDefaultChildNode(nodeAPI); + + ArkUI_NumberValue mark_value[] = {{.u32 = color}, {.f32 = size}, {.f32 = thickness}}; + ArkUI_AttributeItem mark_item = {mark_value, sizeof(mark_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CHECKBOX_MARK, &mark_item); + + return nodeHandle; +} + +napi_value CheckboxMarkTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CheckboxMarkTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxMarkTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + auto checkboxNormal = createChildNode(nodeAPI, COLOR_RED, 50, 10); + auto checkboxAbnormalSize = createChildNode(nodeAPI, COLOR_RED, -50, 10); + auto checkboxAbnormalThickness = createChildNode(nodeAPI, COLOR_RED, 50, -10); + auto checkboxDefault = createDefaultChildNode(nodeAPI); + + auto checkboxNoSize = createDefaultChildNode(nodeAPI); + ArkUI_NumberValue noSizeMarkValue[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem noSizeMarkItem = {noSizeMarkValue, sizeof(noSizeMarkValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkboxNoSize, NODE_CHECKBOX_MARK, &noSizeMarkItem); + + auto checkboxNoThickness = createDefaultChildNode(nodeAPI); + ArkUI_NumberValue noThicknessMarkValue[] = {{.u32 = COLOR_RED}, {.f32 = 50}}; + ArkUI_AttributeItem noThicknessMarkItem = {noThicknessMarkValue, + sizeof(noThicknessMarkValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkboxNoThickness, NODE_CHECKBOX_MARK, &noThicknessMarkItem); + + nodeAPI->addChild(column, checkboxNormal); + nodeAPI->addChild(column, checkboxAbnormalSize); + nodeAPI->addChild(column, checkboxAbnormalThickness); + nodeAPI->addChild(column, checkboxDefault); + nodeAPI->addChild(column, checkboxNoSize); + nodeAPI->addChild(column, checkboxNoThickness); + + nodeAPI->addChild(row, column); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxMarkTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_mark_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_mark_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fff8b4fd276d5696dec1fd1f97dd887fbdca8464 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_mark_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_MARK_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_MARK_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxMarkTest { +public: + ~CheckboxMarkTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_MARK_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_onchange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_onchange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1fda970ae9aae5b6230f6652b3fee225763d0fb0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_onchange_test.cpp @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_onchange_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define ON_CHANGE_DISABLE_EVENT_ID 7007 + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool select) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + + ArkUI_NumberValue select_value[] = {{.i32 = select}}; + ArkUI_AttributeItem select_item = {select_value, sizeof(select_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT, &select_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CheckboxOnChangeTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxOnChangeTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CheckboxOnChangeTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_CHANGE_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + if (result->data[0].i32) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } + + if (eventId == ON_CHANGE_DISABLE_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + if (!result->data[0].i32) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } +} + +napi_value CheckboxOnChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CheckboxOnChangeTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxOnChangeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkbox = createChildNode(nodeAPI, false); + auto checkboxSelected = createChildNode(nodeAPI, true); + + nodeAPI->registerNodeEvent(checkbox, NODE_CHECKBOX_EVENT_ON_CHANGE, ON_CHANGE_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(checkboxSelected, NODE_CHECKBOX_EVENT_ON_CHANGE, ON_CHANGE_DISABLE_EVENT_ID, nullptr); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnChangeTestCheckBox"; + nodeAPI->setAttribute(checkbox, NODE_ID, &id_item); + id_item.string = "OnChangeTestCheckBoxSelected"; + nodeAPI->setAttribute(checkboxSelected, NODE_ID, &id_item); + + nodeAPI->addChild(column, checkbox); + nodeAPI->addChild(column, checkboxSelected); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxOnChangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_onchange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_onchange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9cdbf3660bb04761c2658b67734ee4a6c6381b83 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_onchange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_ONCHANGE_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_ONCHANGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxOnChangeTest { +public: + ~CheckboxOnChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_ONCHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_select_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_select_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..34b0813a86b4bde81d2a58798b3edfde173701ca --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_select_test.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_select_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t select) +{ + auto nodeHandle = createDefaultChildNode(nodeAPI); + + ArkUI_NumberValue select_value[] = {{.i32 = select}}; + ArkUI_AttributeItem select_item = {select_value, sizeof(select_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT, &select_item); + + return nodeHandle; +} + +napi_value CheckboxSelectTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CheckboxSelectTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxSelectTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkboxTrue = createChildNode(nodeAPI, true); + auto checkboxFalse = createChildNode(nodeAPI, false); + auto checkboxDefault = createDefaultChildNode(nodeAPI); + + nodeAPI->addChild(column, checkboxTrue); + nodeAPI->addChild(column, checkboxFalse); + nodeAPI->addChild(column, checkboxDefault); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxSelectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_select_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_select_test.h new file mode 100644 index 0000000000000000000000000000000000000000..afa0ddc3a014937bb7db4207d625043d949a7f71 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_select_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_SELECT_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_SELECT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxSelectTest { +public: + ~CheckboxSelectTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_SELECT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_selectedcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_selectedcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0f3f44dc52b87aec37a8021290e4f7d9f0849b52 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_selectedcolor_test.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_selectedcolor_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t selected) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue select_value[] = {{.i32 = selected}}; + ArkUI_AttributeItem select_item = {select_value, sizeof(select_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT, &select_item); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t selected, uint32_t selected_color) +{ + auto nodeHandle = createDefaultChildNode(nodeAPI, selected); + + ArkUI_NumberValue selected_color_value[] = {{.u32 = selected_color}}; + ArkUI_AttributeItem selected_color_item = {selected_color_value, + sizeof(selected_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT_COLOR, &selected_color_item); + + return nodeHandle; +} + +napi_value CheckboxSelectedColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CheckboxSelectedColorTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxSelectedColorTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto columnUnselected = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + auto checkboxNormal = createChildNode(nodeAPI, true, COLOR_RED); + auto checkboxMax = createChildNode(nodeAPI, true, 0xFFFFFFFF); + auto checkboxMin = createChildNode(nodeAPI, true, 0x00000000); + auto checkboxDefault = createDefaultChildNode(nodeAPI, true); + nodeAPI->addChild(column, checkboxNormal); + nodeAPI->addChild(column, checkboxMax); + nodeAPI->addChild(column, checkboxMin); + nodeAPI->addChild(column, checkboxDefault); + + auto checkboxNormalUnselected = createChildNode(nodeAPI, false, COLOR_RED); + auto checkboxMaxUnselected = createChildNode(nodeAPI, false, 0xFFFFFFFF); + auto checkboxMinUnselected = createChildNode(nodeAPI, false, 0x00000000); + auto checkboxDefaultUnselected = createDefaultChildNode(nodeAPI, false); + nodeAPI->addChild(columnUnselected, checkboxNormalUnselected); + nodeAPI->addChild(columnUnselected, checkboxMaxUnselected); + nodeAPI->addChild(columnUnselected, checkboxMinUnselected); + nodeAPI->addChild(columnUnselected, checkboxDefaultUnselected); + + nodeAPI->addChild(row, column); + nodeAPI->addChild(row, columnUnselected); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxSelectedColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_selectedcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_selectedcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a82293ae32c22203569383656c833713dfa49d94 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_selectedcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_SELECTED_COLOR_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_SELECTED_COLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxSelectedColorTest { +public: + ~CheckboxSelectedColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_SELECTED_COLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_shape_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_shape_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4250cf1b57fe3b8fac64ce3f05a08ad31a61c792 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_shape_test.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_shape_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue select_value[] = {{.i32 = true}}; + ArkUI_AttributeItem select_item = {select_value, sizeof(select_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT, &select_item); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t shape) +{ + auto nodeHandle = createDefaultChildNode(nodeAPI); + + ArkUI_NumberValue shape_value[] = {{.i32 = shape}}; + ArkUI_AttributeItem shape_item = {shape_value, sizeof(shape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CHECKBOX_SHAPE, &shape_item); + + return nodeHandle; +} + +napi_value CheckboxShapeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CheckboxShapeTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxShapeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkboxSquare = createChildNode(nodeAPI, ArkUI_CHECKBOX_SHAPE_ROUNDED_SQUARE); + auto checkboxCircle = createChildNode(nodeAPI, ArkUI_CHECKBOX_SHAPE_CIRCLE); + auto checkboxDefault = createDefaultChildNode(nodeAPI); + nodeAPI->addChild(column, checkboxSquare); + nodeAPI->addChild(column, checkboxCircle); + nodeAPI->addChild(column, checkboxDefault); + nodeAPI->addChild(row, column); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxShapeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_shape_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_shape_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ba21719475a21e65190bac10e83f143c858f764c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_shape_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_SHAPE_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_SHAPE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxShapeTest { +public: + ~CheckboxShapeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_SHAPE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_unselectedcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_unselectedcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9f0f80e7f27ca6299cec976a9f1a54fdd4afd335 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_unselectedcolor_test.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_unselectedcolor_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t selected) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue select_value[] = {{.i32 = selected}}; + ArkUI_AttributeItem select_item = {select_value, sizeof(select_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CHECKBOX_SELECT, &select_item); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t selected, uint32_t selected_color) +{ + auto nodeHandle = createDefaultChildNode(nodeAPI, selected); + + ArkUI_NumberValue selected_color_value[] = {{.u32 = selected_color}}; + ArkUI_AttributeItem selected_color_item = {selected_color_value, + sizeof(selected_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_CHECKBOX_UNSELECT_COLOR, &selected_color_item); + + return nodeHandle; +} + +napi_value CheckboxUnselectedColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CheckboxUnselectedColorTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxUnselectedColorTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto columnUnselected = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + auto checkboxNormal = createChildNode(nodeAPI, true, COLOR_RED); + auto checkboxMax = createChildNode(nodeAPI, true, 0xFFFFFFFF); + auto checkboxMin = createChildNode(nodeAPI, true, 0x00000000); + auto checkboxDefault = createDefaultChildNode(nodeAPI, true); + nodeAPI->addChild(column, checkboxNormal); + nodeAPI->addChild(column, checkboxMax); + nodeAPI->addChild(column, checkboxMin); + nodeAPI->addChild(column, checkboxDefault); + + auto checkboxNormalUnselected = createChildNode(nodeAPI, false, COLOR_RED); + auto checkboxMaxUnselected = createChildNode(nodeAPI, false, 0xFFFFFFFF); + auto checkboxMinUnselected = createChildNode(nodeAPI, false, 0x00000000); + auto checkboxDefaultUnselected = createDefaultChildNode(nodeAPI, false); + nodeAPI->addChild(columnUnselected, checkboxNormalUnselected); + nodeAPI->addChild(columnUnselected, checkboxMaxUnselected); + nodeAPI->addChild(columnUnselected, checkboxMinUnselected); + nodeAPI->addChild(columnUnselected, checkboxDefaultUnselected); + + nodeAPI->addChild(row, column); + nodeAPI->addChild(row, columnUnselected); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxUnselectedColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_unselectedcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_unselectedcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b4d5b4001387e6254ab9efda3dd2f3de584e957f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_unselectedcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_UNSELECTED_COLOR_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_UNSELECTED_COLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxUnselectedColorTest { +public: + ~CheckboxUnselectedColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_UNSELECTED_COLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..30b4d1b502e5626c69825b61cb3bd3078f4f95bf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_width_test.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "checkbox_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define SIZE_NEGATIVE_100 (-100) + +napi_value CheckboxWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxWidthTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置checkbox组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置checkbox组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置checkbox组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置checkbox组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first checkbox + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(checkbox, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // second checkbox + auto checkbox_second = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + nodeAPI->setAttribute(checkbox_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(checkbox_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(checkbox_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(checkbox_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = SIZE_NEGATIVE_100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, checkbox); + nodeAPI->insertChildAfter(column, checkbox_second, checkbox); + + // checkbox组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CheckboxWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxWidthTest", "CreateNativeNodeLarge"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为500 + auto checkbox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_WIDTH, &width_item); + + // 设置checkbox组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置checkbox组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkbox, NODE_HEIGHT, &default_height_item); + + nodeAPI->addChild(column, checkbox); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CheckboxWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9a651d0e4da3d611892571fb96a073a161e5b05f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/checkbox/checkbox_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CHECKBOX_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_CHECKBOX_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CheckboxWidthTest { +public: + ~CheckboxWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CHECKBOX_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_foregroundblurstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_foregroundblurstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dfbaab37ef5efb84d71872084296c87cb097f468 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_foregroundblurstyle_test.cpp @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "column_foregroundblurstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem background_image_value_item = {.string = "./resources/base/media/rectIcon.png"}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &background_image_value_item); + + return nodeHandle; +} + +static auto createChildNodeWithBlurStyle(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t blurStyle) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = blurStyle}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithThemeColorMode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t themeColorMode) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {.i32 = themeColorMode}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithAdaptiveColor(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t adaptiveColor) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {}, {.i32 = adaptiveColor}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithGrayScaleBlack(ArkUI_NativeNodeAPI_1 *nodeAPI, float grayScale) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {}, {}, {}, {.f32 = grayScale}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithGrayScaleWhite(ArkUI_NativeNodeAPI_1 *nodeAPI, float grayScale) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {}, {}, {}, {}, {.f32 = grayScale}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithNormalValue(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = createChildNode(nodeAPI); + ArkUI_NumberValue values[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_AVERAGE}, + {.f32 = 0.5}, + {.f32 = 20}, + {.f32 = 20}}; + ArkUI_AttributeItem item = {values, sizeof(values) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +napi_value ColumnForegroundBlurStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ColumnForegroundBlurStyleTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnForegroundBlurStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + ArkUI_NumberValue flexOptions[] = {{.i32 = ARKUI_FLEX_DIRECTION_ROW}, + {.i32 = ARKUI_FLEX_WRAP_WRAP}, + {.i32 = ARKUI_FLEX_ALIGNMENT_START}, + {.i32 = ARKUI_ITEM_ALIGNMENT_START}, + {.i32 = ARKUI_FLEX_ALIGNMENT_START}}; + ArkUI_AttributeItem flexOptionsItem = {flexOptions, sizeof(flexOptions) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_FLEX_OPTION, &flexOptionsItem); + + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_REGULAR)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_REGULAR)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_NONE)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_REGULAR)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ENUM_ABNORMAL_VALUE)); + + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ARKUI_COLOR_MODE_SYSTEM)); + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ARKUI_COLOR_MODE_LIGHT)); + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ARKUI_COLOR_MODE_DARK)); + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ENUM_ABNORMAL_VALUE)); + + nodeAPI->addChild(flex, createChildNodeWithAdaptiveColor(nodeAPI, ARKUI_ADAPTIVE_COLOR_DEFAULT)); + nodeAPI->addChild(flex, createChildNodeWithAdaptiveColor(nodeAPI, ARKUI_ADAPTIVE_COLOR_AVERAGE)); + nodeAPI->addChild(flex, createChildNodeWithAdaptiveColor(nodeAPI, ENUM_ABNORMAL_VALUE)); + + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, -1)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 0)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 20)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 127)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 200)); + + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, -1)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 0)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 20)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 127)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 200)); + + nodeAPI->addChild(flex, createChildNodeWithNormalValue(nodeAPI)); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), flex) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnForegroundBlurStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_foregroundblurstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_foregroundblurstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..125280bb8d73174fc7f4439564930444916a4f2c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_foregroundblurstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COLUMN_FOREGROUNDBLURSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_COLUMN_FOREGROUNDBLURSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ColumnForegroundBlurStyleTest { +public: + ~ColumnForegroundBlurStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COLUMN_FOREGROUNDBLURSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..15ec85313b771076d55857b138183ad174ea10a3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_height_test.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "column_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ColumnHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置column组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置column组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置column组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first column,设置高度为200 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(column, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + // second column,设置高度为异常值 + auto column_second = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(column_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(column_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(column_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(column_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(parentColumn, column); + nodeAPI->insertChildAfter(parentColumn, column_second, column); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ColumnHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent parentColumn + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_HEIGHT, &col_height_item); + + // 设置高度为超大值500 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置column组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &default_width_item); + + nodeAPI->addChild(parentColumn, column); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7775c420c6a229b60e584cfcae5d47804b115b2c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COLUMN_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_COLUMN_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ColumnHeightTest { +public: + ~ColumnHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COLUMN_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_padding_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_padding_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..844965ffc25ea2c3576586a321b96dfa3fb1178f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_padding_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "column_padding_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ColumnPaddingTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnPaddingTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnPaddingTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // column宽度设置为100 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + // column高度设置为100 + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + // 设置每行及每个column边框为1 + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + // 设置column组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + // 设置text子组件背景色 + ArkUI_NumberValue text_background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem text_background_color_item = {text_background_color_value, + sizeof(text_background_color_value) / sizeof(ArkUI_NumberValue)}; + // text_first子组件宽高设置为80 + ArkUI_NumberValue text_first_width_value[] = {{.f32 = 80}}; + ArkUI_AttributeItem text_first_width_item = {text_first_width_value, + sizeof(text_first_width_value) / sizeof(ArkUI_NumberValue)}; + // text_second子组件宽高设置为120 + ArkUI_NumberValue text_second_width_value[] = {{.f32 = 120}}; + ArkUI_AttributeItem text_second_width_item = {text_second_width_value, + sizeof(text_second_width_value) / sizeof(ArkUI_NumberValue)}; + // text_third子组件宽高设置为40 + ArkUI_NumberValue text_third_width_value[] = {{.f32 = 40}}; + ArkUI_AttributeItem text_third_width_item = {text_third_width_value, + sizeof(text_third_width_value) / sizeof(ArkUI_NumberValue)}; + // text_fourth子组件宽高设置为160 + ArkUI_NumberValue text_fourth_width_value[] = {{.f32 = 160}}; + ArkUI_AttributeItem text_fourth_width_item = {text_fourth_width_value, + sizeof(text_fourth_width_value) / sizeof(ArkUI_NumberValue)}; + + // column in the left of first row + auto column_first = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(column_first, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(column_first, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(column_first, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue padding_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem padding_item = {padding_value, sizeof(padding_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column_first, NODE_PADDING, &padding_item); + nodeAPI->setAttribute(column_first, NODE_BACKGROUND_COLOR, &background_color_item); + + // column in the left of second row + auto column_second = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(column_second, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(column_second, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(column_second, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue padding_second_value[] = {{.f32 = -10}}; + ArkUI_AttributeItem padding_second_item = {padding_second_value, + sizeof(padding_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column_second, NODE_PADDING, &padding_second_item); + nodeAPI->setAttribute(column_second, NODE_BACKGROUND_COLOR, &background_color_item); + + // column in the left of third row + auto column_third = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(column_third, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(column_third, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(column_third, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue padding_third_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem padding_third_item = {padding_third_value, + sizeof(padding_third_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column_third, NODE_PADDING, &padding_third_item); + nodeAPI->setAttribute(column_third, NODE_BACKGROUND_COLOR, &background_color_item); + + // column in the left of fourth row + auto column_fourth = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(column_fourth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(column_fourth, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(column_fourth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue padding_fourth_value[] = {{.f32 = -10}, {.f32 = -10}, {.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem padding_fourth_item = {padding_fourth_value, + sizeof(padding_fourth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column_fourth, NODE_PADDING, &padding_fourth_item); + nodeAPI->setAttribute(column_fourth, NODE_BACKGROUND_COLOR, &background_color_item); + + // first text + auto text_first = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->setAttribute(text_first, NODE_WIDTH, &text_first_width_item); + nodeAPI->setAttribute(text_first, NODE_HEIGHT, &text_first_width_item); + nodeAPI->setAttribute(text_first, NODE_BACKGROUND_COLOR, &text_background_color_item); + + // second text + auto text_second = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->setAttribute(text_second, NODE_WIDTH, &text_second_width_item); + nodeAPI->setAttribute(text_second, NODE_HEIGHT, &text_second_width_item); + nodeAPI->setAttribute(text_second, NODE_BACKGROUND_COLOR, &text_background_color_item); + + // third text + auto text_third = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->setAttribute(text_third, NODE_WIDTH, &text_third_width_item); + nodeAPI->setAttribute(text_third, NODE_HEIGHT, &text_third_width_item); + nodeAPI->setAttribute(text_third, NODE_BACKGROUND_COLOR, &text_background_color_item); + + // fourth text + auto text_fourth = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->setAttribute(text_fourth, NODE_WIDTH, &text_fourth_width_item); + nodeAPI->setAttribute(text_fourth, NODE_HEIGHT, &text_fourth_width_item); + nodeAPI->setAttribute(text_fourth, NODE_BACKGROUND_COLOR, &text_background_color_item); + + // 创建一个parent node:parentColumn + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为300vp,高度为600vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 600}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(parentColumn, NODE_WIDTH, &col_width_item); + + // 子组件加入到父容器 + nodeAPI->addChild(parentColumn, column_first); + nodeAPI->addChild(parentColumn, column_second); + nodeAPI->addChild(parentColumn, column_third); + nodeAPI->addChild(parentColumn, column_fourth); + nodeAPI->addChild(column_first, text_first); + nodeAPI->addChild(column_second, text_second); + nodeAPI->addChild(column_third, text_third); + nodeAPI->addChild(column_fourth, text_fourth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnPaddingTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_padding_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_padding_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2c6f308518a6fbec79c054f9a2f164188d76673f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_padding_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COLUMN_PADDING_TEST_H +#define ARKUI_CAPI_DEMO_COLUMN_PADDING_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ColumnPaddingTest { +public: + ~ColumnPaddingTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COLUMN_PADDING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5f0fc33b2e84e94c94564ac207b37bc0c49e9719 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_width_test.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "column_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ColumnWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置column组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置column组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置column组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first column,设置宽度为300 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(column, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + // second column,设置宽度为异常值 + auto column_second = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(column_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(column_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(column_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(column_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column_second, NODE_WIDTH, &width_second_item); + + // parent node + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(parentColumn, column); + nodeAPI->insertChildAfter(parentColumn, column_second, column); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ColumnWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnWidthTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent parentColumn + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_HEIGHT, &col_height_item); + + // 设置宽度为超大值500 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue width_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置子组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &default_height_item); + + nodeAPI->addChild(parentColumn, column); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ColumnWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bc5ec6b465d4d204c147ca20d1ebb21399b5a341 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/column/column_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COLUMN_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_COLUMN_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ColumnWidthTest { +public: + ~ColumnWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COLUMN_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/common/common.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/common/common.h new file mode 100644 index 0000000000000000000000000000000000000000..2e1a22ca92d6ba3fa2b38383745128a1472075f3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/common/common.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMON_TEST_H +#define ARKUI_CAPI_DEMO_COMMON_TEST_H + +#include +#include + +namespace ArkUICApiDemo { + +#define PARAM_0 0 +#define PARAM_1 1 +#define PARAM_2 2 +#define PARAM_3 3 +#define PARAM_4 4 +#define PARAM_5 5 +#define PARAM_6 6 +#define PARAM_7 7 +#define PARAM_8 8 +#define PARAM_9 9 +#define PARAM_10 10 +#define PARAM_11 11 +#define PARAM_12 12 +#define PARAM_64 64 +#define DEFAULT_MARGIN 10 +#define SIZE_10 10 +#define SIZE_30 30 +#define SIZE_50 50 +#define SIZE_100 100 +#define SIZE_150 150 +#define SIZE_180 180 +#define SIZE_200 200 +#define SIZE_250 250 +#define SIZE_300 300 +#define SIZE_350 350 +#define SIZE_400 400 +#define SIZE_500 500 +#define SIZE_600 600 +#define DEFAULT_VALUE_TAG 7000 +#define ENUM_ABNORMAL_VALUE 500 +#define INVALID_PARAM 401 +#define COLOR_RED 0xFFFF0000 +#define COLOR_GREEN 0xFF00FF00 +#define COLOR_BLUE 0xFF0000FF +#define COLOR_YELLOW 0xFFFFFF00 +#define COLOR_PURPLE 0xFFFF11FF +#define COLOR_GRAY 0xFFDDDDDD +#define COLOR_TRANSPARENT 0x00000000 +#define COLOR_BLACK 0xFF000000 +#define COLOR_WHITE 0xFFFFFFFF +#define COLOR_LIGHT_BLUE 0xFF00FFFF +#define ON_CLICK_EVENT_ID 6001 +#define ON_FOCUS_EVENT_ID 6002 +#define ON_TOUCH_EVENT_ID 6003 +#define ON_AREA_CHANGE_EVENT_ID 6004 +#define ON_APPEAR_EVENT_ID 6005 +#define ON_BLUR_EVENT_ID 6006 +#define ON_CHANGE_EVENT_ID 6007 +#define ON_SUBMIT_EVENT_ID 6008 +#define ON_CUT_EVENT_ID 6009 +#define ON_PASTE_EVENT_ID 6010 +#define ON_MEASURE_EVENT_ID 6011 +#define ON_LAYOUT_EVENT_ID 6012 +#define ON_DRAW_EVENT_ID 6013 +#define PARAM_NEGATIVE_1 (-1) +#define PARAM_NEGATIVE_100 (-100) + +/** + * Log print domain. + */ +const unsigned int LOG_PRINT_DOMAIN = 0xFF00; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMON_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_align_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_align_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e2bbc867cbe4135c4ac3078a048dace97671af9a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_align_test.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_align_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t align) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + if (DEFAULT_VALUE_TAG != align) { + ArkUI_NumberValue align_value[] = {{.i32 = align}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ALIGNMENT, &align_item); + } + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + auto innerView = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue inner_width_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem inner_width_item = {inner_width_value, sizeof(inner_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView, NODE_WIDTH, &inner_width_item); + nodeAPI->setAttribute(innerView, NODE_HEIGHT, &inner_width_item); + ArkUI_NumberValue inner_background_color_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem inner_background_color_item = { + inner_background_color_value, sizeof(inner_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView, NODE_BACKGROUND_COLOR, &inner_background_color_item); + + nodeAPI->addChild(nodeHandle, innerView); + + return nodeHandle; +} + +napi_value CommonAttrsAlignTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto topRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto centerRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto bottomRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto defaultRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto topStartButton = createChildNode(nodeAPI, ARKUI_ALIGNMENT_TOP_START); + auto topButton = createChildNode(nodeAPI, ARKUI_ALIGNMENT_TOP); + auto topEndButton = createChildNode(nodeAPI, ARKUI_ALIGNMENT_TOP_END); + auto startButton = createChildNode(nodeAPI, ARKUI_ALIGNMENT_START); + auto centerButton = createChildNode(nodeAPI, ARKUI_ALIGNMENT_CENTER); + auto endButton = createChildNode(nodeAPI, ARKUI_ALIGNMENT_END); + auto bottomStartButton = createChildNode(nodeAPI, ARKUI_ALIGNMENT_BOTTOM_START); + auto bottomButton = createChildNode(nodeAPI, ARKUI_ALIGNMENT_BOTTOM); + auto bottomEndButton = createChildNode(nodeAPI, ARKUI_ALIGNMENT_BOTTOM_END); + auto defaultButton = createChildNode(nodeAPI, DEFAULT_VALUE_TAG); + auto abnormalButton = createChildNode(nodeAPI, ENUM_ABNORMAL_VALUE); + + nodeAPI->addChild(topRow, topStartButton); + nodeAPI->addChild(topRow, topButton); + nodeAPI->addChild(topRow, topEndButton); + nodeAPI->addChild(centerRow, startButton); + nodeAPI->addChild(centerRow, centerButton); + nodeAPI->addChild(centerRow, endButton); + nodeAPI->addChild(bottomRow, bottomStartButton); + nodeAPI->addChild(bottomRow, bottomButton); + nodeAPI->addChild(bottomRow, bottomEndButton); + nodeAPI->addChild(defaultRow, defaultButton); + nodeAPI->addChild(defaultRow, abnormalButton); + + nodeAPI->addChild(column, topRow); + nodeAPI->addChild(column, centerRow); + nodeAPI->addChild(column, bottomRow); + nodeAPI->addChild(column, defaultRow); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_align_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_align_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e8369e85642b2d1695a827d1dcbc893e2772ad53 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_align_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_ALIGN_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_ALIGN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsAlignTest { +public: + ~CommonAttrsAlignTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_ALIGN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_aligncontent_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_aligncontent_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2b8f59a2d3368d0dd87eccaff1ed9bac5914049d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_aligncontent_test.cpp @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "commonattrs_aligncontent_test.h" + +#define CHANGETYPEID 7777 +#define PARAM_9 9 +namespace ArkUICApiDemo { + +static int32_t testType; +static ArkUI_NodeHandle parentContainer; +static ArkUI_NodeHandle buttonCompare; +static ArkUI_NodeHandle button; +static int32_t itemAlign; +static char xComponentID[PARAM_64]; + +static void SetAttributes(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle nodeHandle, float width, float height, + uint32_t backgroundColor) +{ + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value CommonAttrsAlignContentTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignContentTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignContentTest", + "GetContext env or info is null"); + return nullptr; + } + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 根据入参创建相应的父容器 + parentContainer = nodeAPI->createNode(ARKUI_NODE_STACK); + + // 创建目标组件 + button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 创建参考组件 + buttonCompare = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 设置目标组件属性 + SetAttributes(nodeAPI, button, SIZE_200, SIZE_200, COLOR_BLUE); + + // 设置父组件属性 + SetAttributes(nodeAPI, parentContainer, SIZE_400, SIZE_400, COLOR_RED); + + // 设置参考组件属性 + SetAttributes(nodeAPI, buttonCompare, SIZE_100, SIZE_100, COLOR_YELLOW); + + nodeAPI->addChild(parentContainer, button); + nodeAPI->addChild(parentContainer, buttonCompare); + + ArkUI_NumberValue align_value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_STACK_ALIGN_CONTENT, &align_item); + + // 挂载组件 + std::string IDParentContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDParentContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignContentTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CommonAttrsAlignContentTest::ChangeType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignContentTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + switch (testType) { + case PARAM_1: + itemAlign = ARKUI_ALIGNMENT_TOP_START; + break; + case PARAM_2: + itemAlign = ARKUI_ALIGNMENT_TOP; + break; + case PARAM_3: + itemAlign = ARKUI_ALIGNMENT_TOP_END; + break; + case PARAM_4: + itemAlign = ARKUI_ALIGNMENT_START; + break; + case PARAM_5: + itemAlign = ARKUI_ALIGNMENT_CENTER; + break; + case PARAM_6: + itemAlign = ARKUI_ALIGNMENT_END; + break; + case PARAM_7: + itemAlign = ARKUI_ALIGNMENT_BOTTOM_START; + break; + case PARAM_8: + itemAlign = ARKUI_ALIGNMENT_BOTTOM; + break; + case PARAM_9: + itemAlign = ARKUI_ALIGNMENT_BOTTOM_END; + break; + default: + itemAlign = ARKUI_ALIGNMENT_TOP_START; + break; + } + + std::string IDParentContainer(xComponentID); + if (OH_NativeXComponent_DetachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDParentContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignContentTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + // 挂载组件 + std::string IDContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignContentTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + ArkUI_NumberValue align_value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_STACK_ALIGN_CONTENT, &align_item); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_aligncontent_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_aligncontent_test.h new file mode 100644 index 0000000000000000000000000000000000000000..09842df24c32c3adfe8ef5178de7f58f64c2d56d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_aligncontent_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_ALIGNCONTENT_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_ALIGNCONTENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsAlignContentTest { +public: + ~CommonAttrsAlignContentTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value ChangeType(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_ALIGNCONTENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignitems_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignitems_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..afcf5d1cde1adfc8c8666d0c641ab5e8d4e461b9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignitems_test.cpp @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "commonattrs_alignitems_test.h" + +#define CHANGETYPEID 9999 + +namespace ArkUICApiDemo { + +static int32_t testType; +static ArkUI_NodeHandle parentContainer; +static ArkUI_NodeHandle rootContainer; +static ArkUI_NodeHandle buttonCompare; +static ArkUI_NodeHandle button; +static int32_t itemAlign; +static char xComponentID[PARAM_64]; + +static void SetAttributes(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle nodeHandle, float width, float height, + uint32_t backgroundColor) +{ + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value CommonAttrsAlignItemsTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", + "GetContext env or info is null"); + return nullptr; + } + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建根节点 + rootContainer = nodeAPI->createNode(ARKUI_NODE_FLEX); + + // 根据入参创建相应的父容器 + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + + // 创建目标组件 + button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 创建参考组件 + buttonCompare = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 设置目标组件属性 + SetAttributes(nodeAPI, button, SIZE_200, SIZE_200, COLOR_BLUE); + + // 设置父组件属性 + SetAttributes(nodeAPI, parentContainer, SIZE_400, SIZE_400, COLOR_RED); + + // 设置参考组件属性 + SetAttributes(nodeAPI, buttonCompare, SIZE_100, SIZE_100, COLOR_YELLOW); + + nodeAPI->addChild(parentContainer, button); + nodeAPI->addChild(parentContainer, buttonCompare); + nodeAPI->addChild(rootContainer, parentContainer); + + ArkUI_NumberValue align_value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_STACK_ALIGN_CONTENT, &align_item); + + // 挂载组件 + std::string IDRootContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDRootContainer), + rootContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CommonAttrsAlignItemsTest::ChangeType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + nodeAPI->removeChild(rootContainer, parentContainer); + switch (testType) { + case PARAM_1: + itemAlign = ARKUI_VERTICAL_ALIGNMENT_TOP; + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", "ChangeTestType1%{public}f", + itemAlign); + break; + case PARAM_2: + itemAlign = ARKUI_VERTICAL_ALIGNMENT_CENTER; + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", "ChangeTestType2%{public}f", + itemAlign); + break; + case PARAM_3: + itemAlign = ARKUI_VERTICAL_ALIGNMENT_BOTTOM; + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", "ChangeTestType3%{public}f", + itemAlign); + break; + case PARAM_4: + itemAlign = ARKUI_HORIZONTAL_ALIGNMENT_START; + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", "ChangeTestType4%{public}f", + itemAlign); + break; + case PARAM_5: + itemAlign = ARKUI_HORIZONTAL_ALIGNMENT_CENTER; + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", "ChangeTestType5%{public}f", + itemAlign); + break; + case PARAM_6: + itemAlign = ARKUI_HORIZONTAL_ALIGNMENT_END; + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", "ChangeTestType6%{public}f", + itemAlign); + break; + + default: + itemAlign = ARKUI_VERTICAL_ALIGNMENT_TOP; + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", + "DefaultChangeTestType9%{public}f", itemAlign); + break; + } + + nodeAPI->addChild(parentContainer, button); + nodeAPI->addChild(parentContainer, buttonCompare); + nodeAPI->addChild(rootContainer, parentContainer); + + // 设置父组件属性 + SetAttributes(nodeAPI, parentContainer, SIZE_400, SIZE_400, COLOR_RED); + + if (testType < PARAM_4) { + ArkUI_NumberValue align_value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_ROW_ALIGN_ITEMS, &align_item); + } else { + ArkUI_NumberValue align_value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_COLUMN_ALIGN_ITEMS, &align_item); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignitems_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignitems_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cc2a0030dce0700ab1fe211f45a097882dc54a6d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignitems_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_ALIGNITEMS_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_ALIGNITEMS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsAlignItemsTest { +public: + ~CommonAttrsAlignItemsTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value ChangeType(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_ALIGNITEMS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignself_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignself_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..188bddef811484cdbd2e0d7bc331e91078d93e32 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignself_test.cpp @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "commonattrs_alignself_test.h" + +#define CHANGETYPEID 6666 +#define PARAM_12 12 +#define PARAM_18 18 +#define PARAM_24 24 +#define PARAM_30 30 +#define PARAM_36 36 + +namespace ArkUICApiDemo { + +static int32_t testType; +static ArkUI_NodeHandle parentContainer; +static ArkUI_NodeHandle button; +static ArkUI_NodeHandle rootContainer; +static ArkUI_NodeHandle buttonCompare; +static int32_t direction = INVALID_PARAM; +static int32_t itemAlign; +static char xComponentID[PARAM_64]; + +static void SetAttributes(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle nodeHandle, float width, float height, + uint32_t backgroundColor) +{ + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value CommonAttrsAlignSelfTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignSelfTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignSelfTest", + "GetContext env or info is null"); + return nullptr; + } + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 根据入参创建相应的父容器 + parentContainer = nodeAPI->createNode(ARKUI_NODE_FLEX); + + // 创建目标组件 + button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 创建参考组件 + buttonCompare = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 设置目标组件属性 + SetAttributes(nodeAPI, button, SIZE_100, SIZE_100, COLOR_BLUE); + + // 设置父组件属性 + SetAttributes(nodeAPI, parentContainer, SIZE_400, SIZE_400, COLOR_RED); + + // 设置参考组件属性 + SetAttributes(nodeAPI, buttonCompare, SIZE_100, SIZE_100, COLOR_YELLOW); + + nodeAPI->addChild(parentContainer, button); + nodeAPI->addChild(parentContainer, buttonCompare); + nodeAPI->addChild(rootContainer, parentContainer); + + ArkUI_NumberValue align_value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_ALIGN_SELF, &align_item); + + // 挂载组件 + std::string IDParentContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDParentContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsAlignSelfTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +static void SetAttributesForAlignSelf(int type, ArkUI_NativeNodeAPI_1 *nodeApi) +{ + if (type % PARAM_6 == PARAM_1 || type == PARAM_1) { + parentContainer = nodeApi->createNode(ARKUI_NODE_FLEX); + direction = ARKUI_FLEX_DIRECTION_ROW; + } else if (type % PARAM_6 == PARAM_2 || type == PARAM_2) { + parentContainer = nodeApi->createNode(ARKUI_NODE_FLEX); + direction = ARKUI_FLEX_DIRECTION_COLUMN; + } else if (type % PARAM_6 == PARAM_3 || type == PARAM_3) { + parentContainer = nodeApi->createNode(ARKUI_NODE_FLEX); + direction = ARKUI_FLEX_DIRECTION_ROW_REVERSE; + } else if (type % PARAM_6 == PARAM_4 || type == PARAM_4) { + parentContainer = nodeApi->createNode(ARKUI_NODE_FLEX); + direction = ARKUI_FLEX_DIRECTION_COLUMN_REVERSE; + } else if (type % PARAM_6 == PARAM_5 || type == PARAM_5) { + parentContainer = nodeApi->createNode(ARKUI_NODE_ROW); + direction = INVALID_PARAM; + } else if (type % PARAM_6 == PARAM_0 || type == PARAM_6) { + parentContainer = nodeApi->createNode(ARKUI_NODE_COLUMN); + direction = INVALID_PARAM; + } + + // 根据入参设置alignSelf + if (PARAM_1 <= type && type <= PARAM_6) { + itemAlign = ARKUI_ITEM_ALIGNMENT_AUTO; + } else if (PARAM_6 <= type && type <= PARAM_12) { + itemAlign = ARKUI_ITEM_ALIGNMENT_START; + } else if (PARAM_12 <= type && type <= PARAM_18) { + itemAlign = ARKUI_ITEM_ALIGNMENT_CENTER; + } else if (PARAM_18 <= type && type <= PARAM_24) { + itemAlign = ARKUI_ITEM_ALIGNMENT_END; + } else if (PARAM_24 <= type && type <= PARAM_30) { + itemAlign = ARKUI_ITEM_ALIGNMENT_STRETCH; + } else if (PARAM_30 <= type && type <= PARAM_36) { + itemAlign = ARKUI_ITEM_ALIGNMENT_BASELINE; + } +} + +napi_value CommonAttrsAlignSelfTest::ChangeType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignSelfTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + nodeAPI->removeChild(rootContainer, parentContainer); + + // 根据入参设置主轴方向、父容器、alignSelf + SetAttributesForAlignSelf(testType, nodeAPI); + + nodeAPI->addChild(parentContainer, button); + nodeAPI->addChild(parentContainer, buttonCompare); + nodeAPI->addChild(rootContainer, parentContainer); + + // 设置父组件属性 + SetAttributes(nodeAPI, parentContainer, SIZE_400, SIZE_400, COLOR_RED); + + // 设置容器方向 + if (direction != INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignSelfTest", "directionINVALID_PARAM"); + ArkUI_NumberValue direction_value[] = {{.i32 = direction}}; + ArkUI_AttributeItem direction_item = {direction_value, sizeof(direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_FLEX_OPTION, &direction_item); + } + + // 设置alignSelf + ArkUI_NumberValue value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_ALIGN_SELF, &item); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignself_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignself_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2aff913aadf9e81a58f21251a03738593ba45ff5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_alignself_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_ALIGNSELF_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_ALIGNSELF_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsAlignSelfTest { +public: + ~CommonAttrsAlignSelfTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value ChangeType(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_ALIGNSELF_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2684545d52045c7951bc0b2b1a186b310fc6309c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_backgroundcolor_test.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_backgroundcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t backgroundColor) +{ + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &background_color_item); + + return flex; +} + +napi_value CommonAttrsBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0xFFFF0000)); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0xFFFFFFFF)); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0x00000000)); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0680006213d93a75157983897b1f72b4ed20cb02 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_backgroundcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsBackgroundColorTest { +public: + ~CommonAttrsBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_blendmode_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_blendmode_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e77b453008ff6445d5f1a68e9fab650a58833a9a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_blendmode_test.cpp @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_blendmode_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define INNER_VIEW_LENGTH 60 +#define BLEND_MODE_TYPE_LENGTH 30 +#define INNER_VIEW_SIZE 30 +#define INNER_STACK_HEIGHT 30 +#define INNER_STACK_WIDTH 60 +#define INNER_VIEW_MARGIN 5 + +static ArkUI_NodeHandle CreateBlendModeNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + // 第一个方块(绿色) + auto columnFirst = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue backgroundColorFirst[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem backgroundColorFirstItem = {backgroundColorFirst, + sizeof(backgroundColorFirst) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue size[] = {{.f32 = INNER_VIEW_SIZE}}; + ArkUI_AttributeItem sizeItem = {size, sizeof(size) / sizeof(ArkUI_NumberValue)}; + + nodeAPI->setAttribute(columnFirst, NODE_BACKGROUND_COLOR, &backgroundColorFirstItem); + nodeAPI->setAttribute(columnFirst, NODE_WIDTH, &sizeItem); + nodeAPI->setAttribute(columnFirst, NODE_HEIGHT, &sizeItem); + + // 第二个方块(蓝色) + auto columnSecond = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue backgroundColorSecond[] = {{.u32 = COLOR_BLUE}}; + ArkUI_NumberValue offsetValue[] = {{.f32 = -10}, {.f32 = 0}}; + ArkUI_AttributeItem backgroundColorSecondItem = {backgroundColorSecond, + sizeof(backgroundColorSecond) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem offsetItem = {offsetValue, sizeof(offsetValue) / sizeof(ArkUI_NumberValue)}; + + nodeAPI->setAttribute(columnSecond, NODE_BACKGROUND_COLOR, &backgroundColorSecondItem); + nodeAPI->setAttribute(columnSecond, NODE_WIDTH, &sizeItem); + nodeAPI->setAttribute(columnSecond, NODE_HEIGHT, &sizeItem); + nodeAPI->setAttribute(columnSecond, NODE_OFFSET, &offsetItem); + + // 添加到父控件 + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(row, columnFirst); + nodeAPI->addChild(row, columnSecond); + + return row; +} + +napi_value CommonAttrsBlendModeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBlendModeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBlendModeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + ArkUI_NumberValue flexOptions[] = {{.i32 = ARKUI_FLEX_DIRECTION_ROW}, + {.i32 = ARKUI_FLEX_WRAP_WRAP}, + {.i32 = ARKUI_FLEX_ALIGNMENT_START}, + {.i32 = ARKUI_ITEM_ALIGNMENT_START}, + {.i32 = ARKUI_FLEX_ALIGNMENT_START}}; + ArkUI_AttributeItem flexOptionsItem = {flexOptions, sizeof(flexOptions) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_FLEX_OPTION, &flexOptionsItem); + + ArkUI_NodeHandle innerView[INNER_VIEW_LENGTH]; + ArkUI_BlendMode blendModeTypes[BLEND_MODE_TYPE_LENGTH] = { + ARKUI_BLEND_MODE_NONE, ARKUI_BLEND_MODE_CLEAR, ARKUI_BLEND_MODE_SRC, + ARKUI_BLEND_MODE_DST, ARKUI_BLEND_MODE_SRC_OVER, ARKUI_BLEND_MODE_DST_OVER, + ARKUI_BLEND_MODE_SRC_IN, ARKUI_BLEND_MODE_DST_IN, ARKUI_BLEND_MODE_SRC_OUT, + ARKUI_BLEND_MODE_DST_OUT, ARKUI_BLEND_MODE_SRC_ATOP, ARKUI_BLEND_MODE_DST_ATOP, + ARKUI_BLEND_MODE_XOR, ARKUI_BLEND_MODE_PLUS, ARKUI_BLEND_MODE_MODULATE, + ARKUI_BLEND_MODE_SCREEN, ARKUI_BLEND_MODE_OVERLAY, ARKUI_BLEND_MODE_DARKEN, + ARKUI_BLEND_MODE_LIGHTEN, ARKUI_BLEND_MODE_COLOR_DODGE, ARKUI_BLEND_MODE_COLOR_BURN, + ARKUI_BLEND_MODE_HARD_LIGHT, ARKUI_BLEND_MODE_SOFT_LIGHT, ARKUI_BLEND_MODE_DIFFERENCE, + ARKUI_BLEND_MODE_EXCLUSION, ARKUI_BLEND_MODE_MULTIPLY, ARKUI_BLEND_MODE_HUE, + ARKUI_BLEND_MODE_SATURATION, ARKUI_BLEND_MODE_COLOR, ARKUI_BLEND_MODE_LUMINOSITY}; + ArkUI_BlendApplyType blendApplyTypes[] = {BLEND_APPLY_TYPE_FAST, BLEND_APPLY_TYPE_OFFSCREEN}; + ArkUI_NumberValue blendMode[2]; + // 设置混合模式 + for (char i = 0; i < INNER_VIEW_LENGTH; i++) { + // 创建混合目标 + innerView[i] = CreateBlendModeNode(nodeAPI); + if (i < BLEND_MODE_TYPE_LENGTH) { + blendMode[0].i32 = blendModeTypes[i]; + blendMode[1].i32 = blendApplyTypes[0]; + } else { + blendMode[0].i32 = blendModeTypes[i - BLEND_MODE_TYPE_LENGTH]; + blendMode[1].i32 = blendApplyTypes[1]; + } + ArkUI_AttributeItem blendModeItem = {blendMode, sizeof(blendMode) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView[i], NODE_BLEND_MODE, &blendModeItem); + + // 创建混合背景 + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue stackBackgroundColor[] = {{.u32 = COLOR_GRAY}}; + ArkUI_AttributeItem stackBackgroundColorItem = {stackBackgroundColor, + sizeof(stackBackgroundColor) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_BACKGROUND_COLOR, &stackBackgroundColorItem); + + ArkUI_NumberValue stackWidth[] = {{.f32 = INNER_STACK_WIDTH}}; + ArkUI_AttributeItem stackWidthItem = {stackWidth, sizeof(stackWidth) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue stackHeight[] = {{.f32 = INNER_STACK_HEIGHT}}; + ArkUI_AttributeItem stackHeightItem = {stackHeight, sizeof(stackHeight) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_WIDTH, &stackWidthItem); + nodeAPI->setAttribute(stack, NODE_HEIGHT, &stackHeightItem); + + ArkUI_NumberValue margin[] = {{.f32 = INNER_VIEW_MARGIN}}; + ArkUI_AttributeItem marginItem = {margin, sizeof(margin) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_MARGIN, &marginItem); + + nodeAPI->addChild(stack, innerView[i]); + + // 添加到父控件 + nodeAPI->addChild(flex, stack); + } + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), flex) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBlendModeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_blendmode_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_blendmode_test.h new file mode 100644 index 0000000000000000000000000000000000000000..48376855ee0c55759e090b069d2a8cf7288419c1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_blendmode_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_BLENDMODE_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_BLENDMODE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsBlendModeTest { +public: + ~CommonAttrsBlendModeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_BLENDMODE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_bordercolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_bordercolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f7a8a79723e18432e30403802475d09feaf50c83 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_bordercolor_test.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_bordercolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsBorderColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderColorTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto edgeRow = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(column, row); + nodeAPI->addChild(column, edgeRow); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BORDER_COLOR, &border_color_item); + + // 设置edgeRow组件宽度 + nodeAPI->setAttribute(edgeRow, NODE_WIDTH, &width_item); + + // 设置edgeRow组件高度 + nodeAPI->setAttribute(edgeRow, NODE_HEIGHT, &height_item); + + // 设置edgeRow组件背景色 + nodeAPI->setAttribute(edgeRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置edgeRow组件边框宽度 + nodeAPI->setAttribute(edgeRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置edgeRow组件边框颜色 + ArkUI_NumberValue edge_border_color_value[] = { + {.u32 = 0xFF0000FF}, {.u32 = 0xFF0000FF}, {.u32 = 0xFF0000FF}, {.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem edge_border_color_item = {edge_border_color_value, + sizeof(edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(edgeRow, NODE_BORDER_COLOR, &edge_border_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_bordercolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_bordercolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f7c61eb4d0b284803d790d3f07480293805f5d2b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_bordercolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_BORDERCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_BORDERCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsBorderColorTest { +public: + ~CommonAttrsBorderColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_BORDERCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderradius_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderradius_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..83ec7881ce3e72661820e3c52a9ffcf44ff12055 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderradius_test.cpp @@ -0,0 +1,230 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_borderradius_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsBorderRadiusTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderWidthTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto edgeRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto maxRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto maxEdgeRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto abnormalRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto abnormalEdgeRow = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(column, row); + nodeAPI->addChild(column, edgeRow); + nodeAPI->addChild(column, maxRow); + nodeAPI->addChild(column, maxEdgeRow); + nodeAPI->addChild(column, abnormalRow); + nodeAPI->addChild(column, abnormalEdgeRow); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BORDER_COLOR, &border_color_item); + + // 设置组件边框圆角 + ArkUI_NumberValue border_radius_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BORDER_RADIUS, &border_radius_item); + + // 设置edgeRow组件宽度 + nodeAPI->setAttribute(edgeRow, NODE_WIDTH, &width_item); + + // 设置edgeRow组件高度 + nodeAPI->setAttribute(edgeRow, NODE_HEIGHT, &height_item); + + // 设置edgeRow组件背景色 + nodeAPI->setAttribute(edgeRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置edgeRow组件边框宽度 + nodeAPI->setAttribute(edgeRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置edgeRow组件边框颜色 + ArkUI_NumberValue edge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem edge_border_color_item = {edge_border_color_value, + sizeof(edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(edgeRow, NODE_BORDER_COLOR, &edge_border_color_item); + + // 设置edgeRow组件边框圆角 + ArkUI_NumberValue edge_border_radius_value[] = {{.f32 = 5}, {.f32 = 5}, {.f32 = 5}, {.f32 = 5}}; + ArkUI_AttributeItem edge_border_radius_item = {edge_border_radius_value, + sizeof(edge_border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(edgeRow, NODE_BORDER_RADIUS, &edge_border_radius_item); + + // 设置maxRow组件宽度 + nodeAPI->setAttribute(maxRow, NODE_WIDTH, &width_item); + + // 设置maxRow组件高度 + nodeAPI->setAttribute(maxRow, NODE_HEIGHT, &height_item); + + // 设置maxRow组件背景色 + nodeAPI->setAttribute(maxRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置maxRow组件边框宽度 + nodeAPI->setAttribute(maxRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置maxRow组件边框颜色 + ArkUI_NumberValue max_border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem max_border_color_item = {max_border_color_value, + sizeof(max_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(maxRow, NODE_BORDER_COLOR, &max_border_color_item); + + // 设置maxRow组件边框圆角 + ArkUI_NumberValue max_border_radius_value[] = {{.f32 = 25}}; + ArkUI_AttributeItem max_border_radius_item = {max_border_radius_value, + sizeof(max_border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(maxRow, NODE_BORDER_RADIUS, &max_border_radius_item); + + // 设置maxEdgeRow组件宽度 + nodeAPI->setAttribute(maxEdgeRow, NODE_WIDTH, &width_item); + + // 设置maxEdgeRow组件高度 + nodeAPI->setAttribute(maxEdgeRow, NODE_HEIGHT, &height_item); + + // 设置maxEdgeRow组件背景色 + nodeAPI->setAttribute(maxEdgeRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置maxEdgeRow组件边框宽度 + nodeAPI->setAttribute(maxEdgeRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置maxEdgeRow组件边框颜色 + ArkUI_NumberValue maxEdge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem maxEdge_border_color_item = {maxEdge_border_color_value, + sizeof(maxEdge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(maxEdgeRow, NODE_BORDER_COLOR, &maxEdge_border_color_item); + + // 设置maxEdgeRow组件边框圆角 + ArkUI_NumberValue maxEdge_border_radius_value[] = {{.f32 = 150}, {.f32 = 150}, {.f32 = 150}, {.f32 = 150}}; + ArkUI_AttributeItem maxEdge_border_radius_item = {maxEdge_border_radius_value, + sizeof(maxEdge_border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(maxEdgeRow, NODE_BORDER_RADIUS, &maxEdge_border_radius_item); + + // 设置abnormalRow组件宽度 + nodeAPI->setAttribute(abnormalRow, NODE_WIDTH, &width_item); + + // 设置abnormalRow组件高度 + nodeAPI->setAttribute(abnormalRow, NODE_HEIGHT, &height_item); + + // 设置abnormalRow组件背景色 + nodeAPI->setAttribute(abnormalRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置abnormalRow组件边框宽度 + nodeAPI->setAttribute(abnormalRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置abnormalRow组件边框颜色 + ArkUI_NumberValue abnormal_border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem abnormal_border_color_item = {abnormal_border_color_value, + sizeof(abnormal_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalRow, NODE_BORDER_COLOR, &abnormal_border_color_item); + + // 设置abnormalRow组件边框圆角 + ArkUI_NumberValue abnormal_border_radius_value[] = {{.f32 = -5}}; + ArkUI_AttributeItem abnormal_border_radius_item = { + abnormal_border_radius_value, sizeof(abnormal_border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalRow, NODE_BORDER_RADIUS, &abnormal_border_radius_item); + + // 设置abnormalEdgeRow组件宽度 + nodeAPI->setAttribute(abnormalEdgeRow, NODE_WIDTH, &width_item); + + // 设置abnormalEdgeRow组件高度 + nodeAPI->setAttribute(abnormalEdgeRow, NODE_HEIGHT, &height_item); + + // 设置abnormalEdgeRow组件背景色 + ArkUI_NumberValue abnormalEdge_background_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem abnormalEdge_background_color_item = { + abnormalEdge_background_color_value, sizeof(abnormalEdge_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeRow, NODE_BACKGROUND_COLOR, &abnormalEdge_background_color_item); + + // 设置abnormalEdgeRow组件边框宽度 + nodeAPI->setAttribute(abnormalEdgeRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置abnormalRow组件边框颜色 + ArkUI_NumberValue abnormal_edge_border_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem abnormal_edge_border_color_item = { + abnormal_edge_border_color_value, sizeof(abnormal_edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeRow, NODE_BORDER_COLOR, &abnormal_edge_border_color_item); + + // 设置abnormalEdgeRow组件边框圆角 + ArkUI_NumberValue abnormalEdge_border_radius_value[] = {{.f32 = -5}, {.f32 = -5}, {.f32 = -5}, {.f32 = -5}}; + ArkUI_AttributeItem abnormalEdge_border_radius_item = { + abnormalEdge_border_radius_value, sizeof(abnormalEdge_border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeRow, NODE_BORDER_RADIUS, &abnormalEdge_border_radius_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderradius_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderradius_test.h new file mode 100644 index 0000000000000000000000000000000000000000..da7a6f6d79f4dd8b8e2cdb392d63d05f34f65009 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderradius_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_BORDERRADIUS_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_BORDERRADIUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsBorderRadiusTest { +public: + ~CommonAttrsBorderRadiusTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_BORDERRADIUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..36878b878a67b9d096e1009d5e8243869fe9a4ca --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderstyle_test.cpp @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_borderstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsBorderStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderStyleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto dashedRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto dottedRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto solidEdgeRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto dashedEdgeRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto dottedEdgeRow = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(column, row); + nodeAPI->addChild(column, dashedRow); + nodeAPI->addChild(column, dottedRow); + nodeAPI->addChild(column, solidEdgeRow); + nodeAPI->addChild(column, dashedEdgeRow); + nodeAPI->addChild(column, dottedEdgeRow); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BORDER_COLOR, &border_color_item); + + // 设置组件边框样式 + ArkUI_NumberValue border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_SOLID}}; + ArkUI_AttributeItem border_style_item = {border_style_value, + sizeof(border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BORDER_STYLE, &border_style_item); + + // 设置dashedRow组件宽度 + nodeAPI->setAttribute(dashedRow, NODE_WIDTH, &width_item); + + // 设置dashedRow组件高度 + nodeAPI->setAttribute(dashedRow, NODE_HEIGHT, &height_item); + + // 设置dashedRow组件背景色 + nodeAPI->setAttribute(dashedRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置dashedRow组件边框宽度 + nodeAPI->setAttribute(dashedRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置dashedRow组件边框颜色 + ArkUI_NumberValue edge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem edge_border_color_item = {edge_border_color_value, + sizeof(edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dashedRow, NODE_BORDER_COLOR, &edge_border_color_item); + + // 设置dashedRow组件边框样式 + ArkUI_NumberValue dashed_border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_DASHED}}; + ArkUI_AttributeItem dashed_border_style_item = {dashed_border_style_value, + sizeof(dashed_border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dashedRow, NODE_BORDER_STYLE, &dashed_border_style_item); + + // 设置dottedRow组件宽度 + nodeAPI->setAttribute(dottedRow, NODE_WIDTH, &width_item); + + // 设置dottedRow组件高度 + nodeAPI->setAttribute(dottedRow, NODE_HEIGHT, &height_item); + + // 设置dottedRow组件背景色 + nodeAPI->setAttribute(dottedRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置dottedRow组件边框宽度 + nodeAPI->setAttribute(dottedRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置dottedRow组件边框颜色 + ArkUI_NumberValue max_border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem max_border_color_item = {max_border_color_value, + sizeof(max_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dottedRow, NODE_BORDER_COLOR, &max_border_color_item); + + // 设置dottedRow组件边框样式 + ArkUI_NumberValue dotted_border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_DOTTED}}; + ArkUI_AttributeItem dotted_border_style_item = {dotted_border_style_value, + sizeof(dotted_border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dottedRow, NODE_BORDER_STYLE, &dotted_border_style_item); + + // 设置solidEdgeRow组件宽度 + nodeAPI->setAttribute(solidEdgeRow, NODE_WIDTH, &width_item); + + // 设置solidEdgeRow组件高度 + nodeAPI->setAttribute(solidEdgeRow, NODE_HEIGHT, &height_item); + + // 设置solidEdgeRow组件背景色 + nodeAPI->setAttribute(solidEdgeRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置solidEdgeRow组件边框宽度 + nodeAPI->setAttribute(solidEdgeRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置solidEdgeRow组件边框颜色 + ArkUI_NumberValue maxEdge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem maxEdge_border_color_item = {maxEdge_border_color_value, + sizeof(maxEdge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(solidEdgeRow, NODE_BORDER_COLOR, &maxEdge_border_color_item); + + // 设置solidEdgeRow组件边框样式 + ArkUI_NumberValue solid_edge_border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_SOLID}, + {.i32 = ARKUI_BORDER_STYLE_SOLID}, + {.i32 = ARKUI_BORDER_STYLE_SOLID}, + {.i32 = ARKUI_BORDER_STYLE_SOLID}}; + ArkUI_AttributeItem solid_edge_border_style_item = { + solid_edge_border_style_value, sizeof(solid_edge_border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(solidEdgeRow, NODE_BORDER_STYLE, &solid_edge_border_style_item); + + // 设置dashedEdgeRow组件宽度 + nodeAPI->setAttribute(dashedEdgeRow, NODE_WIDTH, &width_item); + + // 设置dashedEdgeRow组件高度 + nodeAPI->setAttribute(dashedEdgeRow, NODE_HEIGHT, &height_item); + + // 设置dashedEdgeRow组件背景色 + nodeAPI->setAttribute(dashedEdgeRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置dashedEdgeRow组件边框宽度 + nodeAPI->setAttribute(dashedEdgeRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置dashedEdgeRow组件边框颜色 + ArkUI_NumberValue abnormal_border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem abnormal_border_color_item = {abnormal_border_color_value, + sizeof(abnormal_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dashedEdgeRow, NODE_BORDER_COLOR, &abnormal_border_color_item); + + // 设置dashedEdgeRow组件边框样式 + ArkUI_NumberValue dashed_edge_border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_DASHED}, + {.i32 = ARKUI_BORDER_STYLE_DASHED}, + {.i32 = ARKUI_BORDER_STYLE_DASHED}, + {.i32 = ARKUI_BORDER_STYLE_DASHED}}; + ArkUI_AttributeItem dashed_edge_border_style_item = { + dashed_edge_border_style_value, sizeof(dashed_edge_border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dashedEdgeRow, NODE_BORDER_STYLE, &dashed_edge_border_style_item); + + // 设置dottedEdgeRow组件宽度 + nodeAPI->setAttribute(dottedEdgeRow, NODE_WIDTH, &width_item); + + // 设置dottedEdgeRow组件高度 + nodeAPI->setAttribute(dottedEdgeRow, NODE_HEIGHT, &height_item); + + // 设置dottedEdgeRow组件背景色 + ArkUI_NumberValue abnormalEdge_background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem abnormalEdge_background_color_item = { + abnormalEdge_background_color_value, sizeof(abnormalEdge_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dottedEdgeRow, NODE_BACKGROUND_COLOR, &abnormalEdge_background_color_item); + + // 设置dottedEdgeRow组件边框宽度 + nodeAPI->setAttribute(dottedEdgeRow, NODE_BORDER_WIDTH, &border_width_item); + + // 设置dashedEdgeRow组件边框颜色 + ArkUI_NumberValue abnormal_edge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem abnormal_edge_border_color_item = { + abnormal_edge_border_color_value, sizeof(abnormal_edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dottedEdgeRow, NODE_BORDER_COLOR, &abnormal_edge_border_color_item); + + // 设置dottedEdgeRow组件边框样式 + ArkUI_NumberValue dotted_edge_border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_DOTTED}, + {.i32 = ARKUI_BORDER_STYLE_DOTTED}, + {.i32 = ARKUI_BORDER_STYLE_DOTTED}, + {.i32 = ARKUI_BORDER_STYLE_DOTTED}}; + ArkUI_AttributeItem dotted_edge_border_style_item = { + dotted_edge_border_style_value, sizeof(dotted_edge_border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dottedEdgeRow, NODE_BORDER_STYLE, &dotted_edge_border_style_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cbe00be580a4513124a211cbabfc066b83dfd990 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_BORDERSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_BORDERSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsBorderStyleTest { +public: + ~CommonAttrsBorderStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_BORDERSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderwidth_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderwidth_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7f9aa07bae251dfe80e90cecd78535b685117604 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderwidth_test.cpp @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_borderwidth_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsBorderWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderWidthTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto edgeRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto abnormalRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto abnormalEdgeRow = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(column, row); + nodeAPI->addChild(column, edgeRow); + nodeAPI->addChild(column, abnormalRow); + nodeAPI->addChild(column, abnormalEdgeRow); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BORDER_COLOR, &border_color_item); + + // 设置edgeRow组件宽度 + nodeAPI->setAttribute(edgeRow, NODE_WIDTH, &width_item); + + // 设置edgeRow组件高度 + nodeAPI->setAttribute(edgeRow, NODE_HEIGHT, &height_item); + + // 设置edgeRow组件背景色 + nodeAPI->setAttribute(edgeRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置edgeRow组件边框宽度 + ArkUI_NumberValue edge_border_width_value[] = {{.f32 = 5}, {.f32 = 5}, {.f32 = 5}, {.f32 = 5}}; + ArkUI_AttributeItem edge_border_width_item = {edge_border_width_value, + sizeof(edge_border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(edgeRow, NODE_BORDER_WIDTH, &edge_border_width_item); + + // 设置edgeRow组件边框颜色 + ArkUI_NumberValue edge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem edge_border_color_item = {edge_border_color_value, + sizeof(edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(edgeRow, NODE_BORDER_COLOR, &edge_border_color_item); + + // 设置abnormalRow组件宽度 + nodeAPI->setAttribute(abnormalRow, NODE_WIDTH, &width_item); + + // 设置abnormalRow组件高度 + nodeAPI->setAttribute(abnormalRow, NODE_HEIGHT, &height_item); + + // 设置abnormalRow组件背景色 + nodeAPI->setAttribute(abnormalRow, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置abnormalRow组件边框宽度 + ArkUI_NumberValue abnormal_border_width_value[] = {{.f32 = -5}}; + ArkUI_AttributeItem abnormal_border_width_item = {abnormal_border_width_value, + sizeof(abnormal_border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalRow, NODE_BORDER_WIDTH, &abnormal_border_width_item); + + // 设置abnormalRow组件边框颜色 + ArkUI_NumberValue abnormal_border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem abnormal_border_color_item = {abnormal_border_color_value, + sizeof(abnormal_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalRow, NODE_BORDER_COLOR, &abnormal_border_color_item); + + // 设置abnormalEdgeRow组件宽度 + nodeAPI->setAttribute(abnormalEdgeRow, NODE_WIDTH, &width_item); + + // 设置abnormalEdgeRow组件高度 + nodeAPI->setAttribute(abnormalEdgeRow, NODE_HEIGHT, &height_item); + + // 设置abnormalEdgeRow组件背景色 + ArkUI_NumberValue abnormalEdge_background_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem abnormalEdge_background_color_item = { + abnormalEdge_background_color_value, sizeof(abnormalEdge_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeRow, NODE_BACKGROUND_COLOR, &abnormalEdge_background_color_item); + + // 设置abnormalEdgeRow组件边框宽度 + ArkUI_NumberValue abnormal_edge_border_width_value[] = {{.f32 = -5}, {.f32 = -5}, {.f32 = -5}, {.f32 = -5}}; + ArkUI_AttributeItem abnormal_edge_border_width_item = { + abnormal_edge_border_width_value, sizeof(abnormal_edge_border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeRow, NODE_BORDER_WIDTH, &abnormal_edge_border_width_item); + + // 设置abnormalRow组件边框颜色 + ArkUI_NumberValue abnormal_edge_border_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem abnormal_edge_border_color_item = { + abnormal_edge_border_color_value, sizeof(abnormal_edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeRow, NODE_BORDER_COLOR, &abnormal_edge_border_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderwidth_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderwidth_test.h new file mode 100644 index 0000000000000000000000000000000000000000..df5053ebd63991627b7fdb03f2f6e521fbecceae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_borderwidth_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_BORDERWIDTH_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_BORDERWIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsBorderWidthTest { +public: + ~CommonAttrsBorderWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_BORDERWIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ffdc1f026a6720f4e234a2a2fa3e58f7d5c84ca4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_clip_test.cpp @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_clip_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsClipTest::CreateNativeNodeRectangle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto imageSpan = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 400}, {.f32 = 300}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), imageSpan) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsClipTest::CreateNativeNodeCircle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto imageSpan = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 300}, {.f32 = 300}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), imageSpan) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsClipTest::CreateNativeNodeEllipse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto imageSpan = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 400}, {.f32 = 300}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), imageSpan) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsClipTest::CreateNativeNodePath(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto imageSpan = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 500}, {.f32 = 500}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + clipShape_item.string = "M300 0 L500 500 L0 500 Z"; + nodeAPI->setAttribute(imageSpan, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), imageSpan) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e616231e54b24cd97053e5fe5a0856e2094da9cd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_clip_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_CLIP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsClipTest { +public: + ~CommonAttrsClipTest(); + static napi_value CreateNativeNodeRectangle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCircle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEllipse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodePath(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_constraintsize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_constraintsize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a2e87d4c5e03f1b586230019f3aa97179f38056f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_constraintsize_test.cpp @@ -0,0 +1,350 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_constraintsize_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value CommonAttrsConstraintSizeTest::CreateNativeNodeMaxSetMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 250}, {.f32 = 350}, {.f32 = 150}, {.f32 = 250}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsConstraintSizeTest::CreateNativeNodeMaxMinSet(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 350}, {.f32 = 400}, {.f32 = 250}, {.f32 = 300}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsConstraintSizeTest::CreateNativeNodeSetMaxMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 200}, {.f32 = 250}, {.f32 = 100}, {.f32 = 150}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsConstraintSizeTest::CreateNativeNodeMinSetMax(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 350}, {.f32 = 250}, {.f32 = 250}, {.f32 = 150}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsConstraintSizeTest::CreateNativeNodeMinMaxSet(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 400}, {.f32 = 350}, {.f32 = 300}, {.f32 = 250}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsConstraintSizeTest::CreateNativeNodeSetMinMax(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 250}, {.f32 = 200}, {.f32 = 150}, {.f32 = 100}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_constraintsize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_constraintsize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ca52a3b2c2797fff000d488aeb881412a6a8731a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_constraintsize_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_CONSTRAINTSIZE_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_CONSTRAINTSIZE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsConstraintSizeTest { +public: + ~CommonAttrsConstraintSizeTest(); + static napi_value CreateNativeNodeMaxSetMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMaxMinSet(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetMaxMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMinSetMax(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMinMaxSet(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetMinMax(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_CONSTRAINTSIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_contrast_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_contrast_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d8eaa3e962952f09134138f0151fd322d5e4355c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_contrast_test.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_contrast_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle CommonAttrsContrastTest::CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, float width, + float height, float contrast) +{ + auto stack = node_api->createNode(ARKUI_NODE_STACK); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置组件对比度效果 + ArkUI_NumberValue contrast_value[] = {{.f32 = contrast}}; + ArkUI_AttributeItem contrast_item = {contrast_value, sizeof(contrast_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_CONTRAST, &contrast_item); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(stack, NODE_BACKGROUND_IMAGE, &src_item); + + return stack; +} + +napi_value CommonAttrsContrastTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsContrastTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsContrastTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float contrast = 0; + float width = 100; + float height = 100; + auto stack = CreateSubCommonAttrsNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + contrast = 1.0; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + contrast = 5.0; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + contrast = 10.0; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + contrast = -1.0; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + contrast = 11.0; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsContrastTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_contrast_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_contrast_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5f210e9b081448a9a114e67d4899d0556170f455 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_contrast_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_CONTRAST_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_CONTRAST_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsContrastTest { +public: + ~CommonAttrsContrastTest(); + static ArkUI_NodeHandle CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float contrast); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_CONTRAST_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_direction_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_direction_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d51ffe7d4a643becfbc9ec28878b41f78fdf1df2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_direction_test.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_direction_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t direction) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_ROW); + + if (DEFAULT_VALUE_TAG != direction) { + ArkUI_NumberValue direction_value[] = {{.i32 = direction}}; + ArkUI_AttributeItem direction_item = {direction_value, sizeof(direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_DIRECTION, &direction_item); + } + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + auto innerView = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue inner_width_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem inner_width_item = {inner_width_value, sizeof(inner_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView, NODE_WIDTH, &inner_width_item); + nodeAPI->setAttribute(innerView, NODE_HEIGHT, &inner_width_item); + ArkUI_NumberValue inner_background_color_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem inner_background_color_item = { + inner_background_color_value, sizeof(inner_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView, NODE_BACKGROUND_COLOR, &inner_background_color_item); + + nodeAPI->addChild(nodeHandle, innerView); + + return nodeHandle; +} + +napi_value CommonAttrsDirectionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsDirectionTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsDirectionTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto ltrRow = createChildNode(nodeAPI, ARKUI_DIRECTION_LTR); + auto rtlRow = createChildNode(nodeAPI, ARKUI_DIRECTION_RTL); + auto autoRow = createChildNode(nodeAPI, ARKUI_DIRECTION_AUTO); + auto defaultRow = createChildNode(nodeAPI, DEFAULT_VALUE_TAG); + auto abnormalRow = createChildNode(nodeAPI, ENUM_ABNORMAL_VALUE); + + nodeAPI->addChild(column, ltrRow); + nodeAPI->addChild(column, rtlRow); + nodeAPI->addChild(column, autoRow); + nodeAPI->addChild(column, defaultRow); + nodeAPI->addChild(column, abnormalRow); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsDirectionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_direction_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_direction_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b30af367e2f7a62b12102017cdce89c5c1f84562 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_direction_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_DIRECTION_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_DIRECTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsDirectionTest { +public: + ~CommonAttrsDirectionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_DIRECTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_enabled_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_enabled_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5abffecf5d7269f9851ac38db140fe4caef29f8e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_enabled_test.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_enabled_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled, bool registerFocusEvent) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + if (registerFocusEvent) { + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + } + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsEnabledTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsEnabledTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsEnabledTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + uint32_t color = COLOR_PURPLE; + switch (eventId) { + case ON_CLICK_EVENT_ID: + color = COLOR_GREEN; + break; + case ON_FOCUS_EVENT_ID: + color = COLOR_BLUE; + break; + case ON_BLUR_EVENT_ID: + color = COLOR_YELLOW; + break; + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value CommonAttrsEnabledTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsEnabledTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsEnabledTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = createChildNode(nodeAPI, true, false); + auto buttonCompare = createChildNode(nodeAPI, true, true); + auto buttonCompareBlur = createChildNode(nodeAPI, true, true); + auto buttonDisable = createChildNode(nodeAPI, false, true); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "EnabledTestButton"; + nodeAPI->setAttribute(button, NODE_ID, &id_item); + id_item.string = "EnabledTestButtonCompare"; + nodeAPI->setAttribute(buttonCompare, NODE_ID, &id_item); + id_item.string = "EnabledTestButtonCompareBlur"; + nodeAPI->setAttribute(buttonCompareBlur, NODE_ID, &id_item); + id_item.string = "EnabledTestButtonDisable"; + nodeAPI->setAttribute(buttonDisable, NODE_ID, &id_item); + + nodeAPI->addChild(column, button); + nodeAPI->addChild(column, buttonCompare); + nodeAPI->addChild(column, buttonCompareBlur); + nodeAPI->addChild(column, buttonDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_enabled_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_enabled_test.h new file mode 100644 index 0000000000000000000000000000000000000000..51d8ca7e421d6c8b2ba5f9549c0936d6e0aeed3c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_enabled_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_ENABLED_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_ENABLED_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsEnabledTest { +public: + ~CommonAttrsEnabledTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_ENABLED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexbasis_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexbasis_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c52d0a8dc81185ab8a4bd841ac0db81ceb41d43a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexbasis_test.cpp @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "commonattrs_flexbasis_test.h" + +namespace ArkUICApiDemo { + +napi_value CommonAttrsFlexBasisTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFlexBasisTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFlexBasisTest", + "GetContext env or info is null"); + return nullptr; + } + + // 获取入参 + size_t argc = PARAM_3; + napi_value args[PARAM_3] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 获取父容器ID + int parentContainerID; + napi_get_value_int32(env, args[PARAM_1], &parentContainerID); + + // 获取父容器主轴方向ID + int directionID; + napi_get_value_int32(env, args[PARAM_2], &directionID); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 根据入参创建相应的父容器 + auto parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + + switch (parentContainerID) { + case PARAM_1: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_2: + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_3: + parentContainer = nodeAPI->createNode(ARKUI_NODE_FLEX); + break; + + default: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + } + + // 当布局为flex时根据入参创建相应的主轴方向 + auto direction = ARKUI_FLEX_DIRECTION_ROW; + + if (PARAM_3 == parentContainerID) { + switch (directionID) { + case PARAM_1: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + case PARAM_2: + direction = ARKUI_FLEX_DIRECTION_COLUMN; + break; + case PARAM_3: + direction = ARKUI_FLEX_DIRECTION_ROW_REVERSE; + break; + case PARAM_4: + direction = ARKUI_FLEX_DIRECTION_COLUMN_REVERSE; + break; + + default: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + } + } + + // 创建目标组件 + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 创建场景占位组件 + auto buttonCompare = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 添加目标组件和占位组件到父容器 + nodeAPI->addChild(parentContainer, button); + nodeAPI->addChild(parentContainer, buttonCompare); + + // 设置父容器背景颜色 + ArkUI_NumberValue parent_background_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem parent_background_value_item = {parent_background_value, + sizeof(parent_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_BACKGROUND_COLOR, &parent_background_value_item); + + // 设置父容器宽 + ArkUI_NumberValue parent_width_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_width_item = {parent_width_value, + sizeof(parent_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_WIDTH, &parent_width_item); + + // 设置父容器高 + ArkUI_NumberValue parent_height_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_height_item = {parent_height_value, + sizeof(parent_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_HEIGHT, &parent_height_item); + + // 当父容器为flex时,设置主轴方向 direction + if (parentContainerID == PARAM_3) { + ArkUI_NumberValue parent_direction_value[] = {{.i32 = direction}}; + ArkUI_AttributeItem parent_direction_item = {parent_direction_value, + sizeof(parent_direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_FLEX_OPTION, &parent_direction_item); + } + + // 设置占位组件背景颜色 + ArkUI_NumberValue compare_background_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem compare_background_value_item = {compare_background_value, + sizeof(compare_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompare, NODE_BACKGROUND_COLOR, &compare_background_value_item); + + // 设置占位组件宽 + ArkUI_NumberValue compare_width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_width_item = {compare_width_value, + sizeof(compare_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompare, NODE_WIDTH, &compare_width_item); + + // 设置占位组件高 + ArkUI_NumberValue compare_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_height_item = {compare_height_value, + sizeof(compare_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompare, NODE_HEIGHT, &compare_height_item); + + // 设置目标组件背景颜色 + ArkUI_NumberValue background_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_value_item); + + // 设置目标组件宽 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置目标组件高 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置目标组件测试属性flexbasis + ArkUI_NumberValue value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_FLEX_BASIS, &item); + + // 挂载组件 + std::string IDParentContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDParentContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFlexBasisTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexbasis_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexbasis_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e58fefddea94dc87f9882fbad8389774417a4f28 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexbasis_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_FLEXBASIS_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_FLEXBASIS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsFlexBasisTest { +public: + ~CommonAttrsFlexBasisTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_FLEXBASIS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexgrow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexgrow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..72c7689f0723e57fd09df91dff30ba3919d96715 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexgrow_test.cpp @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "commonattrs_flexgrow_test.h" + +namespace ArkUICApiDemo { + +napi_value CommonAttrsFlexGrowTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFlexGrowTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFlexGrowTest", "GetContext env or info is null"); + return nullptr; + } + + // 获取入参 + size_t argc = PARAM_3; + napi_value args[PARAM_3] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 获取父容器ID + int parentContainerID; + napi_get_value_int32(env, args[PARAM_1], &parentContainerID); + + // 获取父容器主轴方向ID + int directionID; + napi_get_value_int32(env, args[PARAM_2], &directionID); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 根据入参创建相应的父容器 + auto parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + + switch (parentContainerID) { + case PARAM_1: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_2: + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_3: + parentContainer = nodeAPI->createNode(ARKUI_NODE_FLEX); + break; + + default: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + } + + // 当布局为flex时根据入参创建相应的主轴方向 + auto direction = ARKUI_FLEX_DIRECTION_ROW; + + if (PARAM_3 == parentContainerID) { + switch (directionID) { + case PARAM_1: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + case PARAM_2: + direction = ARKUI_FLEX_DIRECTION_COLUMN; + break; + case PARAM_3: + direction = ARKUI_FLEX_DIRECTION_ROW_REVERSE; + break; + case PARAM_4: + direction = ARKUI_FLEX_DIRECTION_COLUMN_REVERSE; + break; + + default: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + } + } + + // 创建目标组件 + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 创建场景占位组件 + auto buttonCompare = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 创建设置flexgrow属性的场景占位组件 + auto buttonCompareFlexGrow = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 添加目标组件和占位组件到父容器 + nodeAPI->addChild(parentContainer, button); + nodeAPI->addChild(parentContainer, buttonCompare); + nodeAPI->addChild(parentContainer, buttonCompareFlexGrow); + + // 设置父容器背景颜色 + ArkUI_NumberValue parent_background_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem parent_background_value_item = {parent_background_value, + sizeof(parent_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_BACKGROUND_COLOR, &parent_background_value_item); + + // 设置父容器宽 + ArkUI_NumberValue parent_width_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_width_item = {parent_width_value, + sizeof(parent_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_WIDTH, &parent_width_item); + + // 设置父容器高 + ArkUI_NumberValue parent_height_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_height_item = {parent_height_value, + sizeof(parent_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_HEIGHT, &parent_height_item); + + // 当父容器为flex时,设置主轴方向 direction + if (parentContainerID == PARAM_3) { + ArkUI_NumberValue parent_direction_value[] = {{.i32 = direction}}; + ArkUI_AttributeItem parent_direction_item = {parent_direction_value, + sizeof(parent_direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_FLEX_OPTION, &parent_direction_item); + } + + // 设置占位组件背景颜色 + ArkUI_NumberValue compare_background_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem compare_background_value_item = {compare_background_value, + sizeof(compare_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompare, NODE_BACKGROUND_COLOR, &compare_background_value_item); + + // 设置占位组件宽 + ArkUI_NumberValue compare_width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_width_item = {compare_width_value, + sizeof(compare_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompare, NODE_WIDTH, &compare_width_item); + + // 设置占位组件高 + ArkUI_NumberValue compare_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_height_item = {compare_height_value, + sizeof(compare_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompare, NODE_HEIGHT, &compare_height_item); + + // 设置带有flexgrow属性的场景占位组件背景颜色 + ArkUI_NumberValue compare_flexgrow_background_value[] = {{.u32 = COLOR_PURPLE}}; + ArkUI_AttributeItem compare_flexgrow_background_value_item = { + compare_flexgrow_background_value, sizeof(compare_flexgrow_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompareFlexGrow, NODE_BACKGROUND_COLOR, &compare_flexgrow_background_value_item); + + // 设置带有flexgrow属性的场景占位组件宽 + ArkUI_NumberValue compare_flexgrow_width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_flexgrow_width_item = { + compare_flexgrow_width_value, sizeof(compare_flexgrow_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompareFlexGrow, NODE_WIDTH, &compare_flexgrow_width_item); + + // 设置带有flexgrow属性的场景占位组件高 + ArkUI_NumberValue compare_flexgrow_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_flexgrow_height_item = { + compare_flexgrow_height_value, sizeof(compare_flexgrow_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompareFlexGrow, NODE_HEIGHT, &compare_flexgrow_height_item); + + // 设置带有flexgrow属性的场景占位组件的flexgrow + ArkUI_NumberValue compare_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem compare_item = {compare_value, sizeof(compare_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompareFlexGrow, NODE_FLEX_GROW, &compare_item); + + // 设置目标组件背景颜色 + ArkUI_NumberValue background_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_value_item); + + // 设置目标组件宽 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置目标组件高 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置目标组件测试属性flexgrow + ArkUI_NumberValue value[] = {{.f32 = PARAM_3}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_FLEX_GROW, &item); + + // 挂载组件 + std::string IDParentContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDParentContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFlexGrowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexgrow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexgrow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ebb96cfccd44cca59112eebb04dba85bbca568cc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexgrow_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_FLEXGROW_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_FLEXGROW_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsFlexGrowTest { +public: + ~CommonAttrsFlexGrowTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_FLEXGROW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexshrink_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexshrink_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e06b9177ae90a09dfdb7434e9b113fe9dd169325 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexshrink_test.cpp @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "commonattrs_flexshrink_test.h" + +namespace ArkUICApiDemo { + +napi_value CommonAttrsFlexShrinkTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFlexShrinkTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFlexShrinkTest", + "GetContext env or info is null"); + return nullptr; + } + + // 获取入参 + size_t argc = PARAM_3; + napi_value args[PARAM_3] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 获取父容器ID + int parentContainerID; + napi_get_value_int32(env, args[PARAM_1], &parentContainerID); + + // 获取父容器主轴方向ID + int directionID; + napi_get_value_int32(env, args[PARAM_2], &directionID); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 根据入参创建相应的父容器 + auto parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + + switch (parentContainerID) { + case PARAM_1: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_2: + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_3: + parentContainer = nodeAPI->createNode(ARKUI_NODE_FLEX); + break; + + default: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + } + + // 当布局为flex时根据入参创建相应的主轴方向 + int direction = ARKUI_FLEX_DIRECTION_ROW; + + if (PARAM_3 == parentContainerID) { + switch (directionID) { + case PARAM_1: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + case PARAM_2: + direction = ARKUI_FLEX_DIRECTION_COLUMN; + break; + case PARAM_3: + direction = ARKUI_FLEX_DIRECTION_ROW_REVERSE; + break; + case PARAM_4: + direction = ARKUI_FLEX_DIRECTION_COLUMN_REVERSE; + break; + + default: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + } + } + + // 创建目标组件 + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 创建场景占位组件 + auto buttonCompare = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 创建设置flexshrink属性的场景占位组件 + auto buttonCompareFlexGrow = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 添加目标组件和占位组件到父容器 + nodeAPI->addChild(parentContainer, button); + nodeAPI->addChild(parentContainer, buttonCompare); + nodeAPI->addChild(parentContainer, buttonCompareFlexGrow); + + // 设置父容器背景颜色 + ArkUI_NumberValue parent_background_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem parent_background_value_item = {parent_background_value, + sizeof(parent_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_BACKGROUND_COLOR, &parent_background_value_item); + + // 设置父容器宽 + ArkUI_NumberValue parent_width_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_width_item = {parent_width_value, + sizeof(parent_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_WIDTH, &parent_width_item); + + // 设置父容器高 + ArkUI_NumberValue parent_height_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_height_item = {parent_height_value, + sizeof(parent_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_HEIGHT, &parent_height_item); + + // 当父容器为flex时,设置主轴方向 direction + if (parentContainerID == PARAM_3) { + ArkUI_NumberValue parent_direction_value[] = {{.i32 = direction}}; + ArkUI_AttributeItem parent_direction_item = {parent_direction_value, + sizeof(parent_direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_FLEX_OPTION, &parent_direction_item); + } + + // 设置占位组件背景颜色 + ArkUI_NumberValue compare_background_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem compare_background_value_item = {compare_background_value, + sizeof(compare_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompare, NODE_BACKGROUND_COLOR, &compare_background_value_item); + + // 设置占位组件宽 + ArkUI_NumberValue compare_width_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem compare_width_item = {compare_width_value, + sizeof(compare_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompare, NODE_WIDTH, &compare_width_item); + + // 设置占位组件高 + ArkUI_NumberValue compare_height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem compare_height_item = {compare_height_value, + sizeof(compare_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompare, NODE_HEIGHT, &compare_height_item); + + // 设置带有flexshrink属性的场景占位组件背景颜色 + ArkUI_NumberValue compare_flexshrink_background_value[] = {{.u32 = COLOR_PURPLE}}; + ArkUI_AttributeItem compare_flexshrink_background_value_item = { + compare_flexshrink_background_value, sizeof(compare_flexshrink_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompareFlexGrow, NODE_BACKGROUND_COLOR, &compare_flexshrink_background_value_item); + + // 设置带有flexshrink属性的场景占位组件宽 + ArkUI_NumberValue compare_flexshrink_width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_flexshrink_width_item = { + compare_flexshrink_width_value, sizeof(compare_flexshrink_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompareFlexGrow, NODE_WIDTH, &compare_flexshrink_width_item); + + // 设置带有flexshrink属性的场景占位组件高 + ArkUI_NumberValue compare_flexshrink_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_flexshrink_height_item = { + compare_flexshrink_height_value, sizeof(compare_flexshrink_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompareFlexGrow, NODE_HEIGHT, &compare_flexshrink_height_item); + + // 设置带有flexshrink属性的场景占位组件的flexshrink + ArkUI_NumberValue compare_value[] = {{.f32 = PARAM_3}}; + ArkUI_AttributeItem compare_item = {compare_value, sizeof(compare_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(buttonCompareFlexGrow, NODE_FLEX_SHRINK, &compare_item); + + // 设置目标组件背景颜色 + ArkUI_NumberValue background_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_value_item); + + // 设置目标组件宽 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置目标组件高 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置目标组件测试属性flexshrink + ArkUI_NumberValue value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_FLEX_SHRINK, &item); + + // 挂载组件 + std::string IDParentContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDParentContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFlexShrinkTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexshrink_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexshrink_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b8017a50b5fc430a7274e90e92b7c05aa70180f8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_flexshrink_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_FLEXSHRINK_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_FLEXSHRINK_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsFlexShrinkTest { +public: + ~CommonAttrsFlexShrinkTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_FLEXSHRINK_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_focusable_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_focusable_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8d26aeb554df2791235be10310769b2862af502a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_focusable_test.cpp @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "commonattrs_focusable_test.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool focusable) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue focusable_value[] = {{.i32 = focusable}}; + ArkUI_AttributeItem focusable_item = {focusable_value, sizeof(focusable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOCUSABLE, &focusable_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_AttributeItem label_item = {.string = ""}; + nodeAPI->setAttribute(nodeHandle, NODE_BUTTON_LABEL, &label_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + return nodeHandle; +} + +static auto createChildCombineNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool focusable, bool defaultFocus) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue focusable_value[] = {{.i32 = focusable}}; + ArkUI_AttributeItem focusable_item = {focusable_value, sizeof(focusable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOCUSABLE, &focusable_item); + + ArkUI_NumberValue defaultFocus_value[] = {{.i32 = defaultFocus}}; + ArkUI_AttributeItem defaultFocus_item = {defaultFocus_value, + sizeof(defaultFocus_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_DEFAULT_FOCUS, &defaultFocus_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_AttributeItem label_item = {.string = ""}; + nodeAPI->setAttribute(nodeHandle, NODE_BUTTON_LABEL, &label_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsFocusableTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFocusableTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsFocusableTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_FOCUS_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CommonAttrsFocusableTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsFocusableTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFocusableTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = createChildNode(nodeAPI, true); + auto buttonCompare = createChildNode(nodeAPI, true); + auto buttonDisable = createChildNode(nodeAPI, false); + ArkUI_AttributeItem id_item = {}; + id_item.string = "FocusableTestButton"; + nodeAPI->setAttribute(button, NODE_ID, &id_item); + id_item.string = "FocusableTestButtonCompare"; + nodeAPI->setAttribute(buttonCompare, NODE_ID, &id_item); + id_item.string = "FocusableTestButtonDisable"; + nodeAPI->setAttribute(buttonDisable, NODE_ID, &id_item); + + nodeAPI->addChild(column, button); + nodeAPI->addChild(column, buttonCompare); + nodeAPI->addChild(column, buttonDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFocusableTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsFocusableTest::CreateNativeNodeCombine(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsFocusableTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFocusableTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto buttonTrue = createChildCombineNode(nodeAPI, true, true); + auto buttonTrueFalse = createChildCombineNode(nodeAPI, true, false); + auto buttonFalseTrue = createChildCombineNode(nodeAPI, false, true); + auto buttonFalse = createChildCombineNode(nodeAPI, false, false); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "FocusableTestButtonTrue"; + nodeAPI->setAttribute(buttonTrue, NODE_ID, &id_item); + id_item.string = "FocusableTestButtonTrueFalse"; + nodeAPI->setAttribute(buttonTrueFalse, NODE_ID, &id_item); + id_item.string = "FocusableTestButtonFalseTrue"; + nodeAPI->setAttribute(buttonFalseTrue, NODE_ID, &id_item); + id_item.string = "FocusableTestButtonFalse"; + nodeAPI->setAttribute(buttonFalse, NODE_ID, &id_item); + + nodeAPI->addChild(column, buttonTrue); + nodeAPI->addChild(column, buttonTrueFalse); + nodeAPI->addChild(column, buttonFalseTrue); + nodeAPI->addChild(column, buttonFalse); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsFocusableTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_focusable_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_focusable_test.h new file mode 100644 index 0000000000000000000000000000000000000000..74db4d1c7d6eb0bd999acf9411e08dbd9cddf450 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_focusable_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_FOCUSABLE_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_FOCUSABLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsFocusableTest { +public: + ~CommonAttrsFocusableTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCombine(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_FOCUSABLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_foregroundblurstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_foregroundblurstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ede0a6b1ac645b7b61ab40c040586d187efe7121 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_foregroundblurstyle_test.cpp @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_foregroundblurstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_STACK); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem background_image_value_item = {.string = "./resources/base/media/rectIcon.png"}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &background_image_value_item); + + return nodeHandle; +} + +static auto createChildNodeWithBlurStyle(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t blurStyle) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = blurStyle}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithThemeColorMode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t themeColorMode) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {.i32 = themeColorMode}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithAdaptiveColor(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t adaptiveColor) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {}, {.i32 = adaptiveColor}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithGrayScaleBlack(ArkUI_NativeNodeAPI_1 *nodeAPI, float grayScale) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {}, {}, {}, {.f32 = grayScale}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithGrayScaleWhite(ArkUI_NativeNodeAPI_1 *nodeAPI, float grayScale) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {}, {}, {}, {}, {.f32 = grayScale}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithNormalValue(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = createChildNode(nodeAPI); + ArkUI_NumberValue values[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_AVERAGE}, + {.f32 = 0.5}, + {.f32 = 20}, + {.f32 = 20}}; + ArkUI_AttributeItem item = {values, sizeof(values) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +napi_value CommonAttrsForegroundBlurStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsForegroundBlurStyleTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsForegroundBlurStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + ArkUI_NumberValue flexOptions[] = {{.i32 = ARKUI_FLEX_DIRECTION_ROW}, + {.i32 = ARKUI_FLEX_WRAP_WRAP}, + {.i32 = ARKUI_FLEX_ALIGNMENT_START}, + {.i32 = ARKUI_ITEM_ALIGNMENT_START}, + {.i32 = ARKUI_FLEX_ALIGNMENT_START}}; + ArkUI_AttributeItem flexOptionsItem = {flexOptions, sizeof(flexOptions) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_FLEX_OPTION, &flexOptionsItem); + + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_REGULAR)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_REGULAR)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_NONE)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_REGULAR)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ENUM_ABNORMAL_VALUE)); + + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ARKUI_COLOR_MODE_SYSTEM)); + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ARKUI_COLOR_MODE_LIGHT)); + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ARKUI_COLOR_MODE_DARK)); + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ENUM_ABNORMAL_VALUE)); + + nodeAPI->addChild(flex, createChildNodeWithAdaptiveColor(nodeAPI, ARKUI_ADAPTIVE_COLOR_DEFAULT)); + nodeAPI->addChild(flex, createChildNodeWithAdaptiveColor(nodeAPI, ARKUI_ADAPTIVE_COLOR_AVERAGE)); + nodeAPI->addChild(flex, createChildNodeWithAdaptiveColor(nodeAPI, ENUM_ABNORMAL_VALUE)); + + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, -1)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 0)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 20)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 127)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 200)); + + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, -1)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 0)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 20)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 127)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 200)); + + nodeAPI->addChild(flex, createChildNodeWithNormalValue(nodeAPI)); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), flex) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsForegroundBlurStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_foregroundblurstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_foregroundblurstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b9fd45b1d0f607e5eed46a868feafffe4387e99f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_foregroundblurstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_FOREGROUNDBLURSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_FOREGROUNDBLURSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsForegroundBlurStyleTest { +public: + ~CommonAttrsForegroundBlurStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_FOREGROUNDBLURSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_grayscale_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_grayscale_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..35995f0ee10c02e4142d50c04fc7e41b6b090047 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_grayscale_test.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_grayscale_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle CommonAttrsGrayscaleTest::CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, float width, + float height, float grayscale) +{ + uint32_t background_color = 0xFFFF0000; + + auto stack = node_api->createNode(ARKUI_NODE_STACK); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置组件灰度 + ArkUI_NumberValue grayscale_value[] = {{.f32 = grayscale}}; + ArkUI_AttributeItem grayscale_item = {grayscale_value, sizeof(grayscale_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_GRAY_SCALE, &grayscale_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + + return stack; +} + +napi_value CommonAttrsGrayscaleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsGrayscaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsGrayscaleTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float grayscale = 0; + float width = 50; + float height = 50; + auto stack = CreateSubCommonAttrsNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + grayscale = 0.5; + width = 60; + height = 60; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + grayscale = 0.8; + width = 70; + height = 70; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + grayscale = 1; + width = 80; + height = 80; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + grayscale = -1; + width = 90; + height = 90; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + grayscale = 2; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsGrayscaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_grayscale_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_grayscale_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5d2854571afffd750e76d5626da62a8c656652be --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_grayscale_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_GRAYSCALE_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_GRAYSCALE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsGrayscaleTest { +public: + ~CommonAttrsGrayscaleTest(); + static ArkUI_NodeHandle CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float opacity); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_GRAYSCALE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6cebccb841be42e14b1e227dfdd10659ce8217ae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_height_test.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsHeightTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto largeButton = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto abnormalButton = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + nodeAPI->addChild(column, abnormalButton); + nodeAPI->addChild(column, largeButton); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置abnormalButton组件宽度 + nodeAPI->setAttribute(abnormalButton, NODE_WIDTH, &width_item); + + // 设置abnormalButton组件高度 + ArkUI_NumberValue large_height_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem large_height_item = {large_height_value, + sizeof(large_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalButton, NODE_HEIGHT, &large_height_item); + + // 设置abnormalButton组件背景色 + ArkUI_NumberValue abnormal_background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem abnormal_background_color_item = { + abnormal_background_color_value, sizeof(abnormal_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalButton, NODE_BACKGROUND_COLOR, &abnormal_background_color_item); + + // 设置largeButton组件宽度 + nodeAPI->setAttribute(largeButton, NODE_WIDTH, &width_item); + + // 设置largeButton组件高度 + ArkUI_NumberValue abnormal_height_value[] = {{.f32 = 10000}}; + ArkUI_AttributeItem abnormal_height_item = {abnormal_height_value, + sizeof(abnormal_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(largeButton, NODE_HEIGHT, &abnormal_height_item); + + // 设置largeButton组件背景色 + ArkUI_NumberValue large_background_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem large_background_color_item = { + large_background_color_value, sizeof(large_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(largeButton, NODE_BACKGROUND_COLOR, &large_background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bada55ea3562dd7ec61d54898eb753eb92cc8f09 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_height_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsHeightTest { +public: + ~CommonAttrsHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_hittestbehavior_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_hittestbehavior_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4fb9b9f756ab52a83e0bd479f89a208f1a2f968d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_hittestbehavior_test.cpp @@ -0,0 +1,267 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "commonattrs_hittestbehavior_test.h" +#include + +#define COMMONATTRS_ON_TOUCH_EVENT_ID 7001 +#define COMMONATTRS_BROTHER_ON_TOUCH_EVENT_ID 7002 + +namespace ArkUICApiDemo { + +void CommonAttrsHitTestBehaviorTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t backgroundColor = 0xFF0000FF; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsEventOnTouchTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsEventOnTouchTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == COMMONATTRS_ON_TOUCH_EVENT_ID) { + backgroundColor = 0xFF0000FF; + } else { + backgroundColor = 0xFF000000; + } + + if ((eventId == COMMONATTRS_ON_TOUCH_EVENT_ID) || (eventId == COMMONATTRS_BROTHER_ON_TOUCH_EVENT_ID)) { + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &backgroundColorItem); + return; + } +} + +ArkUI_NodeHandle CommonAttrsHitTestBehaviorTest::CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, + int32_t hitTestBehavior, + const char *onTouchTestStack, + const char *onTouchTestCommonAttrs, + const char *onTouchTestCommonAttrsBrother) +{ + float stackWidth = 80; + float stackHeight = 80; + float commonAttrsWidth = 60; + float commonAttrsHeight = 60; + float commonAttrsBrotherWidth = 40; + float commonAttrsBrotherHeight = 40; + uint32_t stackBackgroundColor = 0xFF888888; + uint32_t commonAttrsBackgroundColor = 0xFFFF0000; + uint32_t commonAttrsBrotherBackgroundColor = 0xFF00FF00; + + // 创建组件 + auto stack = node_api->createNode(ARKUI_NODE_STACK); + auto commonAttrs = node_api->createNode(ARKUI_NODE_TEXT); + auto commonAttrsBrother = node_api->createNode(ARKUI_NODE_TEXT); + + // 设置组件Id + ArkUI_AttributeItem idItem = {}; + idItem.string = onTouchTestStack; + node_api->setAttribute(stack, NODE_ID, &idItem); + + // 设置组件大小 + ArkUI_NumberValue stackWidthValue[] = {{.f32 = stackWidth}}; + ArkUI_AttributeItem stackWidthItem = {stackWidthValue, sizeof(stackWidthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &stackWidthItem); + + ArkUI_NumberValue stackHeightValue[] = {{.f32 = stackHeight}}; + ArkUI_AttributeItem stackHeightItem = {stackHeightValue, sizeof(stackHeightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &stackHeightItem); + + // 设置组件背景色 + ArkUI_NumberValue stackBackgroundColorValue[] = {{.u32 = stackBackgroundColor}}; + ArkUI_AttributeItem stackBackgroundColorItem = {stackBackgroundColorValue, + sizeof(stackBackgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &stackBackgroundColorItem); + + // 设置组件大小 + ArkUI_AttributeItem commonAttrsIdItem = {}; + commonAttrsIdItem.string = onTouchTestCommonAttrs; + node_api->setAttribute(commonAttrs, NODE_ID, &commonAttrsIdItem); + + // 设置组件大小 + ArkUI_NumberValue commonAttrsWidthValue[] = {{.f32 = commonAttrsWidth}}; + ArkUI_AttributeItem commonAttrsWidthItem = {commonAttrsWidthValue, + sizeof(commonAttrsWidthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(commonAttrs, NODE_WIDTH, &commonAttrsWidthItem); + + ArkUI_NumberValue commonAttrsHeightValue[] = {{.f32 = commonAttrsHeight}}; + ArkUI_AttributeItem commonAttrsHeightItem = {commonAttrsHeightValue, + sizeof(commonAttrsHeightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(commonAttrs, NODE_HEIGHT, &commonAttrsHeightItem); + + // 设置组件背景色 + ArkUI_NumberValue commonAttrsBackgroundColorValue[] = {{.u32 = commonAttrsBackgroundColor}}; + ArkUI_AttributeItem commonAttrsBackgroundColorItem = { + commonAttrsBackgroundColorValue, sizeof(commonAttrsBackgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(commonAttrs, NODE_BACKGROUND_COLOR, &commonAttrsBackgroundColorItem); + + // 绑定组件 + node_api->registerNodeEvent(commonAttrs, NODE_TOUCH_EVENT, COMMONATTRS_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "COMMONATTRS_ON_TOUCH_EVENT_ID", "COMMONATTRS_ON_TOUCH_EVENT_ID"); + + // 添加组件到容器组件 + node_api->addChild(stack, commonAttrs); + + // 设置组件Id + ArkUI_AttributeItem commonAttrsBrotherIdItem = {}; + commonAttrsBrotherIdItem.string = onTouchTestCommonAttrsBrother; + node_api->setAttribute(commonAttrsBrother, NODE_ID, &commonAttrsBrotherIdItem); + + // 设置组件大小 + ArkUI_NumberValue commonAttrsBrotherWidthValue[] = {{.f32 = commonAttrsBrotherWidth}}; + ArkUI_AttributeItem commonAttrsBrotherWidthItem = { + commonAttrsBrotherWidthValue, sizeof(commonAttrsBrotherWidthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(commonAttrsBrother, NODE_WIDTH, &commonAttrsBrotherWidthItem); + + ArkUI_NumberValue commonAttrsBrotherHeightValue[] = {{.f32 = commonAttrsBrotherHeight}}; + ArkUI_AttributeItem commonAttrsBrotherHeightItem = { + commonAttrsBrotherHeightValue, sizeof(commonAttrsBrotherHeightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(commonAttrsBrother, NODE_HEIGHT, &commonAttrsBrotherHeightItem); + + // 设置组件背景色 + ArkUI_NumberValue commonAttrsBrotherBackgroundColorValue[] = {{.u32 = commonAttrsBrotherBackgroundColor}}; + ArkUI_AttributeItem commonAttrsBrotherBackgroundColorItem = {commonAttrsBrotherBackgroundColorValue, + sizeof(commonAttrsBrotherBackgroundColorValue) / + sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(commonAttrsBrother, NODE_BACKGROUND_COLOR, &commonAttrsBrotherBackgroundColorItem); + + // 设置组件背景色 + ArkUI_NumberValue commonAttrsBrotherHitTestBehaviorValue[] = {{.i32 = hitTestBehavior}}; + ArkUI_AttributeItem commonAttrsBrotherHitTestBehaviorItem = {commonAttrsBrotherHitTestBehaviorValue, + sizeof(commonAttrsBrotherHitTestBehaviorValue) / + sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(commonAttrsBrother, NODE_HIT_TEST_BEHAVIOR, &commonAttrsBrotherHitTestBehaviorItem); + + // 绑定组件 + node_api->registerNodeEvent(commonAttrsBrother, NODE_TOUCH_EVENT, COMMONATTRS_BROTHER_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "COMMONATTRS_BROTHER_ON_TOUCH_EVENT_ID", + "COMMONATTRS_BROTHER_ON_TOUCH_EVENT_ID"); + + // 添加组件到容器组件 + node_api->addChild(stack, commonAttrsBrother); + + return stack; +} + +napi_value CommonAttrsHitTestBehaviorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsHitTestBehaviorTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建组件对象 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_DEFAULT; + string onTouchTestStack = "OnTouchTestStackDefault"; + string onTouchTestCommonAttrs = "OnTouchTestCommonAttrsDefault"; + string onTouchTestCommonAttrsBrother = "OnTouchTestCommonAttrsBrotherDefault"; + auto stack = CreateSubCommonAttrsNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), + onTouchTestCommonAttrs.c_str(), onTouchTestCommonAttrsBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_BLOCK; + onTouchTestStack = "OnTouchTestStackBlock"; + onTouchTestCommonAttrs = "OnTouchTestCommonAttrsBlock"; + onTouchTestCommonAttrsBrother = "OnTouchTestCommonAttrsBrotherBlock"; + stack = CreateSubCommonAttrsNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), onTouchTestCommonAttrs.c_str(), + onTouchTestCommonAttrsBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_TRANSPARENT; + onTouchTestStack = "OnTouchTestStackTransparent"; + onTouchTestCommonAttrs = "OnTouchTestCommonAttrsTransparent"; + onTouchTestCommonAttrsBrother = "OnTouchTestCommonAttrsBrotherTransparent"; + stack = CreateSubCommonAttrsNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), onTouchTestCommonAttrs.c_str(), + onTouchTestCommonAttrsBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_NONE; + onTouchTestStack = "OnTouchTestStackNone"; + onTouchTestCommonAttrs = "OnTouchTestCommonAttrsNone"; + onTouchTestCommonAttrsBrother = "OnTouchTestCommonAttrsBrotherNone"; + stack = CreateSubCommonAttrsNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), onTouchTestCommonAttrs.c_str(), + onTouchTestCommonAttrsBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + hitTestBehavior = PARAM_NEGATIVE_1; + onTouchTestStack = "OnTouchTestStackExceptBelow"; + onTouchTestCommonAttrs = "OnTouchTestCommonAttrsExceptBelow"; + onTouchTestCommonAttrsBrother = "OnTouchTestCommonAttrsBrotherExceptBelow"; + stack = CreateSubCommonAttrsNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), onTouchTestCommonAttrs.c_str(), + onTouchTestCommonAttrsBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + hitTestBehavior = PARAM_4; + onTouchTestStack = "OnTouchTestStackExceptAbove"; + onTouchTestCommonAttrs = "OnTouchTestCommonAttrsExceptAbove"; + onTouchTestCommonAttrsBrother = "OnTouchTestCommonAttrsBrotherExceptAbove"; + stack = CreateSubCommonAttrsNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), onTouchTestCommonAttrs.c_str(), + onTouchTestCommonAttrsBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + // 绑定事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 绑定事件 + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_hittestbehavior_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_hittestbehavior_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3fc8a7feb1b907c498fc4731203199cb50c8e070 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_hittestbehavior_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_HITTESTBEHAVIOR_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_HITTESTBEHAVIOR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class CommonAttrsHitTestBehaviorTest { +public: + ~CommonAttrsHitTestBehaviorTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t hitTestBehavior, + const char *onTouchTestStack, const char *onTouchTestCommonAttrs, + const char *onTouchTestCommonAttrsBrother); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_HITTESTBEHAVIOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_id_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_id_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..faf4cec98c50f43a3208f2e58ca8da43fa67ddc4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_id_test.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "commonattrs_id_test.h" +#include + +#define COMMONATTRS_FIRST_ON_TOUCH_EVENT_ID 7001 +#define COMMONATTRS_SECOND_ON_TOUCH_EVENT_ID 7002 + +namespace ArkUICApiDemo { + +void CommonAttrsIdTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t backgroundColor = 0xFF0000FF; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsEventOnTouchTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsEventOnTouchTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == COMMONATTRS_FIRST_ON_TOUCH_EVENT_ID) { + backgroundColor = 0xFF0000FF; + } else { + backgroundColor = 0xFF000000; + } + + if ((eventId == COMMONATTRS_FIRST_ON_TOUCH_EVENT_ID) || (eventId == COMMONATTRS_SECOND_ON_TOUCH_EVENT_ID)) { + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &backgroundColorItem); + return; + } +} + +ArkUI_NodeHandle CommonAttrsIdTest::CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, const char *id, + uint32_t eventId) +{ + float width = 200; + float height = 200; + uint32_t backgroundColor = 0xFFFF0000; + + // 创建组件 + auto text = node_api->createNode(ARKUI_NODE_TEXT); + + // 设置组件Id + ArkUI_AttributeItem idItem = {}; + idItem.string = id; + node_api->setAttribute(text, NODE_ID, &idItem); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(text, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(text, NODE_HEIGHT, &heightItem); + + // 设置组件背景色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(text, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + // 绑定组件事件 + node_api->registerNodeEvent(text, NODE_TOUCH_EVENT, eventId, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "COMMONATTRS_ON_TOUCH_EVENT_ID", "COMMONATTRS_ON_TOUCH_EVENT_ID"); + + return text; +} + +napi_value CommonAttrsIdTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsIdTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsIdTest", "GetContext env or info is null"); + return nullptr; + } + // 创建组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t commonAttrsFirstEventId = COMMONATTRS_FIRST_ON_TOUCH_EVENT_ID; + const char *commonAttrsFirstId = "onTouchFirst"; + ; + auto text = CreateSubCommonAttrsNode(nodeAPI, commonAttrsFirstId, commonAttrsFirstEventId); + // 添加组件到容器组件 + nodeAPI->addChild(column, text); + + int32_t commonAttrsSecondEventId = COMMONATTRS_SECOND_ON_TOUCH_EVENT_ID; + const char *commonAttrsSecondId = "onTouchSecond"; + ; + text = CreateSubCommonAttrsNode(nodeAPI, commonAttrsSecondId, commonAttrsSecondEventId); + // 添加组件到容器组件 + nodeAPI->addChild(column, text); + + // bind node callBack event receiver + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 绑定组件 + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsIdTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_id_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_id_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b378bc820cf1619627c1996d4f54ed6bae7668a9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_id_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_ID_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_ID_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class CommonAttrsIdTest { +public: + ~CommonAttrsIdTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, const char *id, uint32_t eventId); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_ID_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_invert_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_invert_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..166039037675710a414d6241d74c56259f8f9be7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_invert_test.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_invert_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle CommonAttrsInvertTest::CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, float width, + float height, float invert) +{ + int32_t objectFit = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_NONE; + + auto stack = node_api->createNode(ARKUI_NODE_STACK); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置反转输入的图像比例属性 + ArkUI_NumberValue invert_value[] = {{.f32 = invert}}; + ArkUI_AttributeItem invert_item = {invert_value, sizeof(invert_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_INVERT, &invert_item); + + // 设置组件图片填充效果属性 + ArkUI_NumberValue objectFitValue[] = {{.i32 = objectFit}}; + ArkUI_AttributeItem objectFitItem = {objectFitValue, sizeof(objectFitValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_IMAGE_OBJECT_FIT, &objectFitItem); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(stack, NODE_BACKGROUND_IMAGE, &src_item); + + return stack; +} + +napi_value CommonAttrsInvertTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsInvertTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsInvertTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float invert = 0; + float width = 100; + float height = 100; + auto stack = CreateSubCommonAttrsNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + invert = 0.5; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + invert = 0.8; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + invert = 1; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + invert = -1; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + invert = 2; + width = 100; + height = 100; + stack = CreateSubCommonAttrsNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsInvertTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_invert_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_invert_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fdf48e2952bef75a6818bfe582414745f4a6821b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_invert_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_INVERT_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_INVERT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsInvertTest { +public: + ~CommonAttrsInvertTest(); + static ArkUI_NodeHandle CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float opacity); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_INVERT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_justifycontent_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_justifycontent_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b697386bda413ba58805cb60c80a4d24c71f76d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_justifycontent_test.cpp @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "commonattrs_justifycontent_test.h" + +#define CHANGETYPEID 8888 +#define PARAM_9 9 +#define PARAM_10 10 +#define PARAM_11 11 +#define PARAM_12 12 +namespace ArkUICApiDemo { + +static int32_t testType; +static ArkUI_NodeHandle parentContainer; +static ArkUI_NodeHandle rootContainer; +static ArkUI_NodeHandle buttonCompare; +static ArkUI_NodeHandle button; +static int32_t itemAlign; +static char xComponentID[PARAM_64]; + +static void SetAttributes(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle nodeHandle, float width, float height, + uint32_t backgroundColor) +{ + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value CommonAttrsJustifyContentTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsJustifyContentTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsJustifyContentTest", + "GetContext env or info is null"); + return nullptr; + } + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建根节点 + rootContainer = nodeAPI->createNode(ARKUI_NODE_FLEX); + + // 根据入参创建相应的父容器 + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + + // 创建目标组件 + button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 创建参考组件 + buttonCompare = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 设置目标组件属性 + SetAttributes(nodeAPI, button, SIZE_200, SIZE_200, COLOR_BLUE); + + // 设置父组件属性 + SetAttributes(nodeAPI, parentContainer, SIZE_400, SIZE_400, COLOR_RED); + + // 设置参考组件属性 + SetAttributes(nodeAPI, buttonCompare, SIZE_100, SIZE_100, COLOR_YELLOW); + + nodeAPI->addChild(parentContainer, button); + nodeAPI->addChild(parentContainer, buttonCompare); + nodeAPI->addChild(rootContainer, parentContainer); + + ArkUI_NumberValue align_value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_STACK_ALIGN_CONTENT, &align_item); + + // 挂载组件 + std::string IDRootContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDRootContainer), + rootContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsJustifyContentTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CommonAttrsJustifyContentTest::ChangeType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsJustifyContentTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + nodeAPI->removeChild(rootContainer, parentContainer); + switch (testType) { + case PARAM_1: + itemAlign = ARKUI_FLEX_ALIGNMENT_START; + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_2: + itemAlign = ARKUI_FLEX_ALIGNMENT_CENTER; + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_3: + itemAlign = ARKUI_FLEX_ALIGNMENT_END; + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_4: + itemAlign = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN; + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_5: + itemAlign = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND; + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_6: + itemAlign = ARKUI_FLEX_ALIGNMENT_SPACE_EVENLY; + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_7: + itemAlign = ARKUI_FLEX_ALIGNMENT_START; + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_8: + itemAlign = ARKUI_FLEX_ALIGNMENT_CENTER; + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_9: + itemAlign = ARKUI_FLEX_ALIGNMENT_END; + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_10: + itemAlign = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN; + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_11: + itemAlign = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND; + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_12: + itemAlign = ARKUI_FLEX_ALIGNMENT_SPACE_EVENLY; + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + + default: + itemAlign = ARKUI_ALIGNMENT_TOP_START; + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + } + + nodeAPI->addChild(parentContainer, button); + nodeAPI->addChild(parentContainer, buttonCompare); + nodeAPI->addChild(rootContainer, parentContainer); + + // 设置父组件属性 + SetAttributes(nodeAPI, parentContainer, SIZE_400, SIZE_400, COLOR_RED); + + if (testType < PARAM_7) { + ArkUI_NumberValue align_value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_ROW_JUSTIFY_CONTENT, &align_item); + } else { + ArkUI_NumberValue align_value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_COLUMN_JUSTIFY_CONTENT, &align_item); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_justifycontent_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_justifycontent_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c5e765e9d6e578a756aeb2313a12db03c715013d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_justifycontent_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_JUSTIFYCONTENT_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_JUSTIFYCONTENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsJustifyContentTest { +public: + ~CommonAttrsJustifyContentTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value ChangeType(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_JUSTIFYCONTENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_lineargradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_lineargradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..80f2463053f1df60bdee13d40ab4fb5896f1a4ee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_lineargradient_test.cpp @@ -0,0 +1,739 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_lineargradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include +namespace ArkUICApiDemo { +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeLeft(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_TOP}, {.i32 = true}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeRight(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeLeftTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeLeftBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeRightTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeRightBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_NONE}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeCustom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = {{.f32 = 180}, {.i32 = -1}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsLinearGradientTest::CreateNativeNodeIllegalColorAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {123, 1234}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(column, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_lineargradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_lineargradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0968048e4a8e3986ca4168db81b344efa9d96646 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_lineargradient_test.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_LINEARGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_LINEARGRADIENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsLinearGradientTest { +public: + ~CommonAttrsLinearGradientTest(); + static napi_value CreateNativeNodeLeft(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRight(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLeftTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLeftBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRightTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRightBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCustom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeIllegalColorAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_LINEARGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_margin_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_margin_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..464cb030f3b7e22818f168ba0d25de43699a3149 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_margin_test.cpp @@ -0,0 +1,269 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_margin_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value CommonAttrsMarginTest::CreateNativeNodeUnified(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_MARGIN, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsMarginTest::CreateNativeNodeRespectively(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 10}, {.f32 = 20}, {.f32 = 30}, {.f32 = 40}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_MARGIN, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsMarginTest::CreateNativeNodeUnifiedNegative(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_MARGIN, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsMarginTest::CreateNativeNodeRespectivelyNegative(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = -10}, {.f32 = 20}, {.f32 = -30}, {.f32 = 40}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_MARGIN, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_margin_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_margin_test.h new file mode 100644 index 0000000000000000000000000000000000000000..96966c1b06fd967034a6c41a819fe5ed078acb51 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_margin_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_MARGIN_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_MARGIN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsMarginTest { +public: + ~CommonAttrsMarginTest(); + static napi_value CreateNativeNodeUnified(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectively(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUnifiedNegative(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelyNegative(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_MARGIN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_mask_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_mask_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d99eabc402ea53d86dde942ccc966eff2901c1e4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_mask_test.cpp @@ -0,0 +1,251 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_mask_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsMaskTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMaskTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMaskTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置初始图片 + const char *imageUrl = "./resources/base/media/icon.png"; + ArkUI_NumberValue value[] = {}; + ArkUI_NumberValue widthValue[] = {{.f32 = 100}}; + ArkUI_NumberValue heightValue[] = {{.f32 = 100}}; + ArkUI_AttributeItem imageUrlItem = {value, sizeof(value) / sizeof(ArkUI_NumberValue), imageUrl}; + ArkUI_AttributeItem imageWidthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem imageHeightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + auto imageBase = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageBase, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageBase, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageBase, NODE_HEIGHT, &imageHeightItem); + + // 第一个遮罩效果图片(矩形) + auto imageMaskFirst = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageMaskFirst, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageMaskFirst, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageMaskFirst, NODE_HEIGHT, &imageHeightItem); + + ArkUI_NumberValue maskValueFirst[] = { + {.u32 = 0xFFFF0000}, {.u32 = 0xFF000000}, {.f32 = 2}, {.i32 = ARKUI_MASK_TYPE_RECTANGLE}, + {.f32 = 100}, {.f32 = 100}, {.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem maskFirstItem = {maskValueFirst, sizeof(maskValueFirst) / sizeof(ArkUI_NumberValue)}; + auto ret = nodeAPI->setAttribute(imageMaskFirst, NODE_MASK, &maskFirstItem); + + // 第二个遮罩效果图片(圆形) + auto imageMaskSecond = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageMaskSecond, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageMaskSecond, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageMaskSecond, NODE_HEIGHT, &imageHeightItem); + + ArkUI_NumberValue maskValueSecond[] = {{.u32 = 0xFFFF0000}, {.u32 = 0xFF000000}, + {.f32 = 5}, {.i32 = ARKUI_MASK_TYPE_CIRCLE}, + {.f32 = 100}, {.f32 = 100}}; + ArkUI_AttributeItem maskSecondItem = {maskValueSecond, sizeof(maskValueSecond) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(imageMaskSecond, NODE_MASK, &maskSecondItem); + + // 第三个遮罩效果图片(椭圆形) + auto imageMaskThird = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageMaskThird, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageMaskThird, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageMaskThird, NODE_HEIGHT, &imageHeightItem); + + ArkUI_NumberValue maskValueThird[] = {{.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, + {.f32 = 10}, {.i32 = ARKUI_MASK_TYPE_ELLIPSE}, + {.f32 = 100}, {.f32 = 50}}; + ArkUI_AttributeItem maskThirdItem = {maskValueThird, sizeof(maskValueThird) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(imageMaskThird, NODE_MASK, &maskThirdItem); + + // 第四个遮罩效果图片(路径) + auto imageMaskFourth = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageMaskFourth, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageMaskFourth, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageMaskFourth, NODE_HEIGHT, &imageHeightItem); + + const char *path = "M0 0 H50 V50 H0 Z"; + ArkUI_NumberValue maskValueFourth[] = {{.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, {.f32 = 10}, + {.i32 = ARKUI_MASK_TYPE_PATH}, {.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem maskFourthItem = {maskValueFourth, sizeof(maskValueFourth) / sizeof(ArkUI_NumberValue), path}; + ret = nodeAPI->setAttribute(imageMaskFourth, NODE_MASK, &maskFourthItem); + + // 第五个遮罩效果图片(进度) + auto imageMaskFifth = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageMaskFifth, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageMaskFifth, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageMaskFifth, NODE_HEIGHT, &imageHeightItem); + + ArkUI_NumberValue mask_value_fifth[] = { + {.i32 = ARKUI_MASK_TYPE_PROGRESS}, + {.f32 = 50}, {.f32 = 100}, {.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem mask_fifth_item = {mask_value_fifth, sizeof(mask_value_fifth) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(imageMaskFifth, NODE_MASK, &mask_fifth_item); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, imageBase); + nodeAPI->addChild(column, imageMaskFirst); + nodeAPI->addChild(column, imageMaskSecond); + nodeAPI->addChild(column, imageMaskThird); + nodeAPI->addChild(column, imageMaskFourth); + nodeAPI->addChild(column, imageMaskFifth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMaskTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsMaskTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMaskTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMaskTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置初始图片 + const char *imageUrl = "./resources/base/media/icon.png"; + ArkUI_NumberValue value[] = {}; + ArkUI_NumberValue widthValue[] = {{.f32 = 100}}; + ArkUI_NumberValue heightValue[] = {{.f32 = 100}}; + ArkUI_AttributeItem imageUrlItem = {value, sizeof(value) / sizeof(ArkUI_NumberValue), imageUrl}; + ArkUI_AttributeItem imageWidthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem imageHeightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + auto imageBase = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageBase, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageBase, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageBase, NODE_HEIGHT, &imageHeightItem); + + // 宽度高度均为负值(矩形) + auto imageMaskFirst = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageMaskFirst, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageMaskFirst, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageMaskFirst, NODE_HEIGHT, &imageHeightItem); + ArkUI_NumberValue maskValueFirst[] = { + {.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, {.f32 = -10}, {.i32 = ARKUI_MASK_TYPE_RECTANGLE}, + {.f32 = -100}, {.f32 = -100}, {.f32 = -10}, {.f32 = -10}}; + ArkUI_AttributeItem maskFirstItem = {maskValueFirst, sizeof(maskValueFirst) / sizeof(ArkUI_NumberValue)}; + auto ret = nodeAPI->setAttribute(imageMaskFirst, NODE_MASK, &maskFirstItem); + + // 宽度高度均为负值(圆形) + auto imageMaskSecond = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageMaskSecond, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageMaskSecond, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageMaskSecond, NODE_HEIGHT, &imageHeightItem); + ArkUI_NumberValue maskValueSecond[] = {{.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, + {.f32 = -10}, {.i32 = ARKUI_MASK_TYPE_CIRCLE}, + {.f32 = -100}, {.f32 = -100}}; + ArkUI_AttributeItem maskSecondItem = {maskValueSecond, sizeof(maskValueSecond) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(imageMaskSecond, NODE_MASK, &maskSecondItem); + + // 宽度高度均为负值(椭圆形) + auto imageMaskThird = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageMaskThird, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageMaskThird, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageMaskThird, NODE_HEIGHT, &imageHeightItem); + ArkUI_NumberValue maskValueThird[] = {{.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, + {.f32 = -10}, {.i32 = ARKUI_MASK_TYPE_ELLIPSE}, + {.f32 = -100}, {.f32 = -50}}; + ArkUI_AttributeItem maskThirdItem = {maskValueThird, sizeof(maskValueThird) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(imageMaskThird, NODE_MASK, &maskThirdItem); + + // 宽度高度均为负值(路径) + auto imageMaskFourth = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageMaskFourth, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageMaskFourth, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageMaskFourth, NODE_HEIGHT, &imageHeightItem); + ArkUI_NumberValue maskValueFourth[] = {{.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, {.f32 = -10}, + {.i32 = ARKUI_MASK_TYPE_PATH}, {.f32 = -100}, {.f32 = -100}}; + ArkUI_AttributeItem maskFourthItem = {maskValueFourth, sizeof(maskValueFourth) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(imageMaskFourth, NODE_MASK, &maskFourthItem); + + // 进度为负值(进度) + auto imageMaskFifth = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(imageMaskFifth, NODE_IMAGE_SRC, &imageUrlItem); + nodeAPI->setAttribute(imageMaskFifth, NODE_WIDTH, &imageWidthItem); + nodeAPI->setAttribute(imageMaskFifth, NODE_HEIGHT, &imageHeightItem); + ArkUI_NumberValue mask_value_fifth[] = { + {.i32 = ARKUI_MASK_TYPE_PROGRESS}, + {.f32 = -50}, {.f32 = 100}, {.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem mask_fifth_item = {mask_value_fifth, sizeof(mask_value_fifth) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(imageMaskFifth, NODE_MASK, &mask_fifth_item); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, imageBase); + nodeAPI->addChild(column, imageMaskFirst); + nodeAPI->addChild(column, imageMaskSecond); + nodeAPI->addChild(column, imageMaskThird); + nodeAPI->addChild(column, imageMaskFourth); + nodeAPI->addChild(column, imageMaskFifth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsMaskTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_mask_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_mask_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2eee65d3c0b01849c1b586c4765d89069aa69160 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_mask_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_MASK_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_MASK_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsMaskTest { +public: + ~CommonAttrsMaskTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_MASK_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_opacity_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_opacity_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e02d5cef41e65d461c0ccf75e3c79ff37f52d2e3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_opacity_test.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_opacity_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle CommonAttrsOpacityTest::CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, float width, + float height, float opacity) +{ + uint32_t background_color = 0xFFFF0000; + + auto checkbox = node_api->createNode(ARKUI_NODE_CHECKBOX); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(checkbox, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(checkbox, NODE_HEIGHT, &height_item); + + // 设置组件透明度值 + ArkUI_NumberValue opacity_value[] = {{.f32 = opacity}}; + ArkUI_AttributeItem opacity_item = {opacity_value, sizeof(opacity_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(checkbox, NODE_OPACITY, &opacity_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(checkbox, NODE_BACKGROUND_COLOR, &background_color_item); + + return checkbox; +} + +napi_value CommonAttrsOpacityTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsOpacityTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float opacity = 0; + float width = 50; + float height = 50; + auto checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 0.5; + width = 60; + height = 60; + checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 0.8; + width = 70; + height = 70; + checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 1; + width = 80; + height = 80; + checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = -1; + width = 90; + height = 90; + checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 2; + width = 100; + height = 100; + checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_opacity_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_opacity_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1f755243e26d66e977d0caafb76ecde260327367 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_opacity_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_OPACITY_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_OPACITY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsOpacityTest { +public: + ~CommonAttrsOpacityTest(); + static ArkUI_NodeHandle CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float opacity); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_OPACITY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_position_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_position_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5f8e3344943db5397d91c90c758e4993be00c1c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_position_test.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_position_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsPositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsPositionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsPositionTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + auto secondFlex = nodeAPI->createNode(ARKUI_NODE_FLEX); + nodeAPI->addChild(column, flex); + nodeAPI->addChild(column, secondFlex); + + ArkUI_NumberValue parentWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem parentWidth_item = {parentWidth_value, sizeof(parentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &parentWidth_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &parentWidth_item); + // 设置组件背景色 + ArkUI_NumberValue parentBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem parentBackground_color_item = { + parentBackground_color_value, sizeof(parentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &parentBackground_color_item); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(flex, NODE_HEIGHT, &width_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件position + ArkUI_NumberValue position_value[] = {{.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_POSITION, &position_item); + + // 设置组件大小 + nodeAPI->setAttribute(secondFlex, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(secondFlex, NODE_HEIGHT, &width_item); + + // 设置组件背景色 + nodeAPI->setAttribute(secondFlex, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue position_second_value[] = {{.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem position_second_item = {position_second_value, + sizeof(position_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(secondFlex, NODE_POSITION, &position_second_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsPositionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_position_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_position_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cd62da8aacc73b94b12366437645665a50bf1b3b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_position_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_POSITION_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_POSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsPositionTest { +public: + ~CommonAttrsPositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_POSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_radialgradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_radialgradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a6276129781d61ebc6d84a5e74203d45c4d1682a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_radialgradient_test.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_radialgradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsRadialGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsRadialGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsRadialGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建row节点组件 + auto row1 = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row2 = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row3 = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row4 = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row5 = nodeAPI->createNode(ARKUI_NODE_ROW); + + // 设置row组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(row2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(row3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(row4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(row5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(row1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(row2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(row3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(row4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(row5, NODE_WIDTH, &width_item); + + // row组件放置父容器column中 + nodeAPI->addChild(column, row1); + nodeAPI->addChild(column, row2); + nodeAPI->addChild(column, row3); + nodeAPI->addChild(column, row4); + nodeAPI->addChild(column, row5); + + // 设置row组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(row2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(row3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(row4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(row5, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置row组件径向颜色渐变 + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.3, 1}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue radialGradient_value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 0}}; + ArkUI_AttributeItem radialGradient_value_value_item = {radialGradient_value, + sizeof(radialGradient_value) / sizeof(ArkUI_NumberValue)}; + radialGradient_value_value_item.object = &colorStop; + nodeAPI->setAttribute(row1, NODE_RADIAL_GRADIENT, &radialGradient_value_value_item); + + unsigned int colors_object[] = {0xFFFFFFFF, 0xFF0000FF, 0xFF000000}; + float stops_object[] = {0.2, 0.5, 1}; + ArkUI_ColorStop colorStop_object = {colors_object, stops_object, 3}; + ArkUI_NumberValue threeColors_value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 0}}; + ArkUI_AttributeItem threeColors_value_item = {threeColors_value, + sizeof(threeColors_value) / sizeof(ArkUI_NumberValue)}; + threeColors_value_item.object = &colorStop_object; + nodeAPI->setAttribute(row2, NODE_RADIAL_GRADIENT, &threeColors_value_item); + + ArkUI_NumberValue repeat_value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 1}}; + ArkUI_AttributeItem repeat_value_item = {repeat_value, sizeof(repeat_value) / sizeof(ArkUI_NumberValue)}; + repeat_value_item.object = &colorStop; + nodeAPI->setAttribute(row3, NODE_RADIAL_GRADIENT, &repeat_value_item); + + unsigned int colors_exception[] = {1234, 1234}; + ArkUI_ColorStop exception_colorStop = {colors_exception, stops, 2}; + ArkUI_NumberValue value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.object = &exception_colorStop; + nodeAPI->setAttribute(row4, NODE_RADIAL_GRADIENT, &value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = -25}, {.f32 = -25}, {.f32 = -25}, {.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + exception_value_item.object = &colorStop; + nodeAPI->setAttribute(row5, NODE_RADIAL_GRADIENT, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsRadialGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_radialgradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_radialgradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bb98137ad41ed423a436a59d0de365f8a9f98392 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_radialgradient_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_RADIALGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_RADIALGRADIENT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsRadialGradientTest { +public: + ~CommonAttrsRadialGradientTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_RADIALGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_scale_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_scale_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..155886063b35fa66148f5ef6733f42e7783a7e5b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_scale_test.cpp @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_scale_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value CommonAttrsScaleTest::CreateNativeNodeReduceXY(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 0.5}, {.f32 = 0.5}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsScaleTest::CreateNativeNodeReduceX(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 0.5}, {.f32 = 1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsScaleTest::CreateNativeNodeEnlargeXY(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 2}, {.f32 = 2}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsScaleTest::CreateNativeNodeEnlargeX(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 2}, {.f32 = 1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsScaleTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = -1}, {.f32 = -1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_scale_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_scale_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6ea852dcd88e1609372787a2ee361bc51f8f20db --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_scale_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_SCALE_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_SCALE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsScaleTest { +public: + ~CommonAttrsScaleTest(); + static napi_value CreateNativeNodeReduceXY(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeReduceX(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnlargeXY(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnlargeX(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_SCALE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sepia_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sepia_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f7803c8d620a84aafcde1d00a622c5cd3cf6e8e0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sepia_test.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_sepia_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle CommonAttrsSepiaTest::CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, float width, + float height, float sepia) +{ + auto stack = node_api->createNode(ARKUI_NODE_STACK); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置组件图像转换为深褐色比例属性 + ArkUI_NumberValue sepia_value[] = {{.f32 = sepia}}; + ArkUI_AttributeItem sepia_item = {sepia_value, sizeof(sepia_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_SEPIA, &sepia_item); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(stack, NODE_BACKGROUND_IMAGE, &src_item); + + return stack; +} + +napi_value CommonAttrsSepiaTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsSepiaTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsSepiaTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float opacity = 0; + float width = 100; + float height = 100; + auto checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 0.5; + width = 100; + height = 100; + checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 0.8; + width = 100; + height = 100; + checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 1; + width = 100; + height = 100; + checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = -1; + width = 100; + height = 100; + checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 2; + width = 100; + height = 100; + checkbox = CreateSubCommonAttrsNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsSepiaTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sepia_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sepia_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ccc5cfb8e7266b11ad90d448754c983820afb79d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sepia_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_SEPIA_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_SEPIA_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsSepiaTest { +public: + ~CommonAttrsSepiaTest(); + static ArkUI_NodeHandle CreateSubCommonAttrsNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float sepia); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_SEPIA_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_shadow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_shadow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e53ee19056eac643d5d43ec2483350e524b87c8c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_shadow_test.cpp @@ -0,0 +1,587 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_shadow_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value CommonAttrsShadowTest::CreateNativeNodeUltraSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsShadowTest::CreateNativeNodeSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SHADOW, &childShadow_item); + + ArkUI_NumberValue childCustomShadow_value[] = { + {.f32 = 50}, {.i32 = 1}, {.f32 = 50}, {.f32 = 50}, {.i32 = ARKUI_SHADOW_TYPE_COLOR}, + {.u32 = 0xFFFFFF00}, {.u32 = 1}}; + ArkUI_AttributeItem childCustomShadow_item = {childCustomShadow_value, + sizeof(childCustomShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_CUSTOM_SHADOW, &childCustomShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsShadowTest::CreateNativeNodeMiddleShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsShadowTest::CreateNativeNodeLargeShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsShadowTest::CreateNativeNodeFloatingShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsShadowTest::CreateNativeNodeFloatingSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsShadowTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsShadowTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, flex); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = 7}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_shadow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_shadow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..efd819eff6e7958a51a64f2b3eaa989858da0998 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_shadow_test.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_SHADOW_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_SHADOW_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsShadowTest { +public: + ~CommonAttrsShadowTest(); + static napi_value CreateNativeNodeUltraSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMiddleShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLargeShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFloatingShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFloatingSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_SHADOW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sweepgradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sweepgradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d1e84e52c5542ab15bc3690e543d1309528faab4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sweepgradient_test.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_sweepgradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsSweepGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsSweepGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsSweepGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建row节点组件 + auto row1 = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row2 = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row3 = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row4 = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row5 = nodeAPI->createNode(ARKUI_NODE_ROW); + + // 设置row组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(row2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(row3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(row4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(row5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(row1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(row2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(row3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(row4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(row5, NODE_WIDTH, &width_item); + + // row组件放置父容器column中 + nodeAPI->addChild(column, row1); + nodeAPI->addChild(column, row2); + nodeAPI->addChild(column, row3); + nodeAPI->addChild(column, row4); + nodeAPI->addChild(column, row5); + + // 设置row组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(row2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(row3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(row4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(row5, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置row组件角度颜色渐变 + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.3, 1}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue sweepGradient_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, + {.f32 = 180}, {.f32 = 90}, {.i32 = 0}}; + ArkUI_AttributeItem sweepGradient_value_item = {sweepGradient_value, + sizeof(sweepGradient_value) / sizeof(ArkUI_NumberValue)}; + sweepGradient_value_item.object = &colorStop; + nodeAPI->setAttribute(row1, NODE_SWEEP_GRADIENT, &sweepGradient_value_item); + + unsigned int colors_object[] = {0xFFFFFFFF, 0xFF0000FF, 0xFF000000}; + float stops_object[] = {0.2, 0.5, 1}; + ArkUI_ColorStop colorStop_object = {colors_object, stops_object, 3}; + ArkUI_NumberValue threeColors_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, + {.f32 = 180}, {.f32 = 90}, {.i32 = 0}}; + ArkUI_AttributeItem threeColors_value_item = {threeColors_value, + sizeof(threeColors_value) / sizeof(ArkUI_NumberValue)}; + threeColors_value_item.object = &colorStop_object; + nodeAPI->setAttribute(row2, NODE_SWEEP_GRADIENT, &threeColors_value_item); + + ArkUI_NumberValue repeat_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, {.f32 = 180}, {.f32 = 90}, {.i32 = 1}}; + ArkUI_AttributeItem repeat_value_item = {repeat_value, sizeof(repeat_value) / sizeof(ArkUI_NumberValue)}; + repeat_value_item.object = &colorStop; + nodeAPI->setAttribute(row3, NODE_SWEEP_GRADIENT, &repeat_value_item); + + unsigned int colors_exception[] = {1234, 1234}; + ArkUI_ColorStop exception_colorStop = {colors_exception, stops, 2}; + ArkUI_NumberValue value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, {.f32 = 180}, {.f32 = 90}, {.i32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.object = &exception_colorStop; + nodeAPI->setAttribute(row4, NODE_SWEEP_GRADIENT, &value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = -50}, {.f32 = -50}, {.f32 = -1}, + {.f32 = -180}, {.f32 = -90}, {.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + exception_value_item.object = &colorStop; + nodeAPI->setAttribute(row5, NODE_RADIAL_GRADIENT, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsSweepGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sweepgradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sweepgradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..59d0262c56bfc750cf62960900670e2b490165a0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_sweepgradient_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_SWEEPGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_SWEEPGRADIENT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsSweepGradientTest { +public: + ~CommonAttrsSweepGradientTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_SWEEPGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_transform_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_transform_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aae01329b9c9d71484b99de788b9e9dce6a91faa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_transform_test.cpp @@ -0,0 +1,282 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_transform_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsTransformTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsTransformTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsTransformTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置矩阵 + const char *imageUrl = "./resources/base/media/icon.png"; + + ArkUI_NumberValue heightValue[] = {{.f32 = 150}}; + ArkUI_NumberValue widthValue[] = {{.f32 = 150}}; + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue backgroundValue[] = {{.i32 = ARKUI_IMAGE_REPEAT_NONE}}; + + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem backgroundItem = {backgroundValue, sizeof(backgroundValue) / sizeof(ArkUI_NumberValue), + imageUrl}; + + auto columnFirst = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnFirst, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnFirst, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnFirst, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnFirst, NODE_BACKGROUND_IMAGE, &backgroundItem); + + auto columnSecond = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnSecond, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnSecond, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnSecond, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnSecond, NODE_BACKGROUND_IMAGE, &backgroundItem); + + auto columnThird = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnThird, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnThird, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnThird, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnThird, NODE_BACKGROUND_IMAGE, &backgroundItem); + + // 添加到父控件 + auto columnP1 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(columnP1, columnFirst); + nodeAPI->addChild(columnP1, columnSecond); + nodeAPI->addChild(columnP1, columnThird); + + // 向Y反向平移20 + auto columnFirstRight = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnFirstRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnFirstRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnFirstRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnFirstRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueFirst[] = { + {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = -20}, {.f32 = 0}, {.f32 = 1.00}}; + ArkUI_AttributeItem transformItemFirst = {transformValueFirst, + sizeof(transformValueFirst) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(columnFirstRight, NODE_TRANSFORM, &transformItemFirst); + + // 绕Z轴旋转30度 + auto columnSecondRight = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnSecondRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnSecondRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnSecondRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnSecondRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueSecond[] = {{.f32 = static_cast(cos(30))}, + {.f32 = static_cast(-sin(30))}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = static_cast(sin(30))}, + {.f32 = static_cast(cos(30))}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 1}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 1}}; + ArkUI_AttributeItem transformItemSecond = {transformValueSecond, + sizeof(transformValueSecond) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(columnSecondRight, NODE_TRANSFORM, &transformItemSecond); + + // 缩小为原来的一半 + auto columnThirdRight = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnThirdRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnThirdRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnThirdRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnThirdRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueThird[] = { + {.f32 = 0.50}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0.50}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 0.50}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1.00}}; + ArkUI_AttributeItem transformItemThird = {transformValueThird, + sizeof(transformValueThird) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(columnThirdRight, NODE_TRANSFORM, &transformItemThird); + + // 添加到父控件 + auto columnP2 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(columnP2, columnFirstRight); + nodeAPI->addChild(columnP2, columnSecondRight); + nodeAPI->addChild(columnP2, columnThirdRight); + + auto rowBase = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(rowBase, columnP1); + nodeAPI->addChild(rowBase, columnP2); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), rowBase) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsTransformTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CommonAttrsTransformTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsTransformTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsTransformTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置矩阵 + const char *imageUrl = "./resources/base/media/icon.png"; + + ArkUI_NumberValue heightValue[] = {{.f32 = 150}}; + ArkUI_NumberValue widthValue[] = {{.f32 = 150}}; + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue backgroundValue[] = {{.i32 = ARKUI_IMAGE_REPEAT_NONE}}; + + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem backgroundItem = {backgroundValue, sizeof(backgroundValue) / sizeof(ArkUI_NumberValue), + imageUrl}; + + auto columnFirst = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnFirst, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnFirst, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnFirst, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnFirst, NODE_BACKGROUND_IMAGE, &backgroundItem); + + auto columnSecond = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnSecond, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnSecond, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnSecond, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnSecond, NODE_BACKGROUND_IMAGE, &backgroundItem); + + auto columnThird = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnThird, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnThird, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnThird, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnThird, NODE_BACKGROUND_IMAGE, &backgroundItem); + + // 添加到父控件 + auto columnP1 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(columnP1, columnFirst); + nodeAPI->addChild(columnP1, columnSecond); + nodeAPI->addChild(columnP1, columnThird); + + // 4阶矩阵只传入14个参数 + auto columnFirstRight = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnFirstRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnFirstRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnFirstRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnFirstRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueFirst[] = {{.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = -20}}; + ArkUI_AttributeItem transformItemFirst = {transformValueFirst, + sizeof(transformValueFirst) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(columnFirstRight, NODE_TRANSFORM, &transformItemFirst); + + // 4阶矩阵行列式为0 + auto columnSecondRight = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnSecondRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnSecondRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnSecondRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnSecondRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueSecond[] = { + {.f32 = 0}, {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1.00}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem transformItemSecond = {transformValueSecond, + sizeof(transformValueSecond) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(columnSecondRight, NODE_TRANSFORM, &transformItemSecond); + + // 4阶矩阵不传入参数 + auto columnThirdRight = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(columnThirdRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(columnThirdRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(columnThirdRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(columnThirdRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueThird[] = {}; + ArkUI_AttributeItem transformItemThird = {transformValueThird, + sizeof(transformValueThird) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(columnThirdRight, NODE_TRANSFORM, &transformItemThird); + + // 添加到父控件 + auto columnP2 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(columnP2, columnFirstRight); + nodeAPI->addChild(columnP2, columnSecondRight); + nodeAPI->addChild(columnP2, columnThirdRight); + + auto rowBase = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(rowBase, columnP1); + nodeAPI->addChild(rowBase, columnP2); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), rowBase) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsTransformTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_transform_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_transform_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ba3e5a7f6d32ed4f0b9cbb38fff64097d1328005 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_transform_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_TRANSFORM_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_TRANSFORM_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsTransformTest { +public: + ~CommonAttrsTransformTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_TRANSFORM_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..277bec75fa5a30011ffb0092aa8e96de1f62dc76 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_width_test.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonattrs_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CommonAttrsWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsWidthTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto largeButton = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto abnormalButton = nodeAPI->createNode(ARKUI_NODE_BUTTON); + nodeAPI->addChild(column, button); + nodeAPI->addChild(column, largeButton); + nodeAPI->addChild(column, abnormalButton); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置largeButton组件宽度 + ArkUI_NumberValue large_width_value[] = {{.f32 = 10000}}; + ArkUI_AttributeItem large_width_item = {large_width_value, sizeof(large_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(largeButton, NODE_WIDTH, &large_width_item); + + // 设置largeButton组件高度 + nodeAPI->setAttribute(largeButton, NODE_HEIGHT, &height_item); + + // 设置largeButton组件背景色 + ArkUI_NumberValue large_background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem large_background_color_item = { + large_background_color_value, sizeof(large_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(largeButton, NODE_BACKGROUND_COLOR, &large_background_color_item); + + // 设置abnormalButton组件宽度 + ArkUI_NumberValue abnormal_width_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem abnormal_large_width_item = {abnormal_width_value, + sizeof(abnormal_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalButton, NODE_WIDTH, &abnormal_large_width_item); + + // 设置abnormalButton组件高度 + nodeAPI->setAttribute(abnormalButton, NODE_HEIGHT, &height_item); + + // 设置abnormalButton组件背景色 + ArkUI_NumberValue abnormal_background_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem abnormal_background_color_item = { + abnormal_background_color_value, sizeof(abnormal_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalButton, NODE_BACKGROUND_COLOR, &abnormal_background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..959fc8da1208593c88e8274171ac2d36eadaeed9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonattrs/commonattrs_width_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONATTRS_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_COMMONATTRS_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonAttrsWidthTest { +public: + ~CommonAttrsWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONATTRS_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onappear_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onappear_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..67d81489aa40341297cbb3338a45960cbf4f4442 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onappear_test.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonevent_onappear_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnAppearTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnAppearTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnAppearTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_APPEAR_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CommonEventOnAppearTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnAppearTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnAppearTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto checkBox = nodeAPI->createNode(ARKUI_NODE_CHECKBOX); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnAppearTest"; + nodeAPI->setAttribute(checkBox, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkBox, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(checkBox, NODE_HEIGHT, &width_item); + + nodeAPI->addChild(column, checkBox); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(checkBox, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(checkBox, NODE_EVENT_ON_APPEAR, ON_APPEAR_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnAppearTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onappear_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onappear_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d964ec1044196b3705a806ac58f8d5722c271848 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onappear_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONEVENT_ONAPPEAR_TEST_H +#define ARKUI_CAPI_DEMO_COMMONEVENT_ONAPPEAR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonEventOnAppearTest { +public: + ~CommonEventOnAppearTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONEVENT_ONAPPEAR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onareachange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onareachange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ef6b1d16081ce30e981f327760c74a8b09617aee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onareachange_test.cpp @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "commonevent_onareachange_test.h" +#include + +namespace ArkUICApiDemo { +#define ON_CLICK_EVENT_ID_TRANSLATE 17001 +#define ON_AREA_CHANGE_TRANSLATE_EVENT_ID 18001 +#define ON_CLICK_EVENT_ID_OFFSET 16001 +#define ON_AREA_CHANGE_SIZE_EVENT_ID 7004 +#define ON_AREA_CHANGE_OFFSET_EVENT_ID 8004 +static bool g_hasOnAreaChangeInit = false; + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t initialColor, int32_t clickEventID) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = initialColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, clickEventID, nullptr); + + return nodeHandle; +} + +static void PrintOnAreaChangeBackData(ArkUI_NodeComponentEvent *result) +{ + for (int i = PARAM_0; i < PARAM_12; i++) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnAreaChangeTest", + "PrintOnAreaChangeBackData result->data[%{public}d].f32: %{public}f", i, result->data[i].f32); + } +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnAreaChangeTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnAreaChangeTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnAreaChangeTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_CLICK_EVENT_ID) { + g_hasOnAreaChangeInit = true; + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_WIDTH, &width_item); + } + + if (eventId == ON_CLICK_EVENT_ID_OFFSET) { + g_hasOnAreaChangeInit = true; + ArkUI_NumberValue offset_value[] = {{.f32 = SIZE_100}, {.f32 = SIZE_100}}; + ArkUI_AttributeItem offset_item = {offset_value, sizeof(offset_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_OFFSET, &offset_item); + } + + if (eventId == ON_CLICK_EVENT_ID_TRANSLATE) { + g_hasOnAreaChangeInit = true; + ArkUI_NumberValue translate_value[] = {{.f32 = -50}, {.f32 = -50}, {.f32 = 0}}; + ArkUI_AttributeItem translate_Item = {translate_value, sizeof(translate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_TRANSLATE, &translate_Item); + } + + if (g_hasOnAreaChangeInit && eventId == ON_AREA_CHANGE_SIZE_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + PrintOnAreaChangeBackData(result); + bool checkResult = false; + checkResult = (result->data[PARAM_0].f32 < result->data[PARAM_6].f32) && + (result->data[PARAM_1].f32 == result->data[PARAM_7].f32) && + (result->data[PARAM_2].f32 == result->data[PARAM_8].f32) && + (result->data[PARAM_3].f32 == result->data[PARAM_9].f32) && + (result->data[PARAM_4].f32 > result->data[PARAM_10].f32) && + (result->data[PARAM_5].f32 == result->data[PARAM_11].f32); + if (checkResult) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } + + if (g_hasOnAreaChangeInit && eventId == ON_AREA_CHANGE_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + PrintOnAreaChangeBackData(result); + bool checkResult = false; + checkResult = (result->data[PARAM_0].f32 == result->data[PARAM_6].f32) && + (result->data[PARAM_1].f32 == result->data[PARAM_7].f32) && + (result->data[PARAM_2].f32 == result->data[PARAM_8].f32) && + (result->data[PARAM_3].f32 == result->data[PARAM_9].f32) && + (result->data[PARAM_4].f32 > result->data[PARAM_10].f32) && + (result->data[PARAM_5].f32 == result->data[PARAM_11].f32); + if (checkResult) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } + + if (g_hasOnAreaChangeInit && eventId == ON_AREA_CHANGE_OFFSET_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + + if (g_hasOnAreaChangeInit && eventId == ON_AREA_CHANGE_TRANSLATE_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +napi_value CommonEventOnAreaChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnAreaChangeTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnAreaChangeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowSize = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowMove = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowOffset = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowTranslate = nodeAPI->createNode(ARKUI_NODE_ROW); + auto imageSpanSize = createChildNode(nodeAPI, COLOR_RED, ON_CLICK_EVENT_ID); + auto imageSpanMove = createChildNode(nodeAPI, COLOR_RED, ON_CLICK_EVENT_ID); + auto imageSpanMoveCompare = createChildNode(nodeAPI, COLOR_PURPLE, ON_CLICK_EVENT_ID); + auto imageSpanOffset = createChildNode(nodeAPI, COLOR_RED, ON_CLICK_EVENT_ID_OFFSET); + auto imageSpanTranslate = createChildNode(nodeAPI, COLOR_RED, ON_CLICK_EVENT_ID_TRANSLATE); + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnAreaChangeTestImageSpanSize"; + nodeAPI->setAttribute(imageSpanSize, NODE_ID, &id_item); + id_item.string = "OnAreaChangeTestImageSpanMove"; + nodeAPI->setAttribute(imageSpanMove, NODE_ID, &id_item); + id_item.string = "OnAreaChangeTestImageSpanMoveCompare"; + nodeAPI->setAttribute(imageSpanMoveCompare, NODE_ID, &id_item); + id_item.string = "OnAreaChangeTestImageSpanOffset"; + nodeAPI->setAttribute(imageSpanOffset, NODE_ID, &id_item); + id_item.string = "OnAreaChangeTestImageSpanTranslate"; + nodeAPI->setAttribute(imageSpanTranslate, NODE_ID, &id_item); + + nodeAPI->addChild(rowSize, imageSpanSize); + nodeAPI->addChild(rowMove, imageSpanMove); + nodeAPI->addChild(rowMove, imageSpanMoveCompare); + nodeAPI->addChild(rowOffset, imageSpanOffset); + nodeAPI->addChild(rowTranslate, imageSpanTranslate); + + nodeAPI->registerNodeEvent(imageSpanSize, NODE_EVENT_ON_AREA_CHANGE, ON_AREA_CHANGE_SIZE_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(imageSpanMove, NODE_EVENT_ON_AREA_CHANGE, ON_AREA_CHANGE_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(imageSpanOffset, NODE_EVENT_ON_AREA_CHANGE, ON_AREA_CHANGE_OFFSET_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(imageSpanTranslate, NODE_EVENT_ON_AREA_CHANGE, ON_AREA_CHANGE_TRANSLATE_EVENT_ID, + nullptr); + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + nodeAPI->addChild(column, rowSize); + nodeAPI->addChild(column, rowMove); + nodeAPI->addChild(column, rowOffset); + nodeAPI->addChild(column, rowTranslate); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnAreaChangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onareachange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onareachange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0326972648a127456dfeeed310e9de2e650fa107 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onareachange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONEVENT_ONAREA_CHANGE_TEST_H +#define ARKUI_CAPI_DEMO_COMMONEVENT_ONAREA_CHANGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonEventOnAreaChangeTest { +public: + ~CommonEventOnAreaChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONEVENT_ONAREA_CHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onblur_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onblur_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..25434140a776ca299c3cfc6d9deabc9877ed4038 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onblur_test.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonevent_onblur_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem label_item = {.string = ""}; + nodeAPI->setAttribute(nodeHandle, NODE_BUTTON_LABEL, &label_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnBlurTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnBlurTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnBlurTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_BLUR_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CommonEventOnBlurTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnBlurTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnBlurTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = createChildNode(nodeAPI, true); + auto buttonCompare = createChildNode(nodeAPI, true); + auto buttonDisable = createChildNode(nodeAPI, false); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnBlurTestButton"; + nodeAPI->setAttribute(button, NODE_ID, &id_item); + id_item.string = "OnBlurTestButtonCompare"; + nodeAPI->setAttribute(buttonCompare, NODE_ID, &id_item); + id_item.string = "OnBlurTestButtonDisable"; + nodeAPI->setAttribute(buttonDisable, NODE_ID, &id_item); + + // 添加子组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(column, buttonCompare); + nodeAPI->addChild(column, buttonDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onblur_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onblur_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0c9fc770912f5f567126b288813f2075a76c0cbf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onblur_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONEVENT_ONBLUR_TEST_H +#define ARKUI_CAPI_DEMO_COMMONEVENT_ONBLUR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonEventOnBlurTest { +public: + ~CommonEventOnBlurTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONEVENT_ONBLUR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onclick_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onclick_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..47faeb7c6a0126a5d7aec4412484c5ba40ecbdc6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onclick_test.cpp @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonevent_onclick_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +using namespace std; +static ArkUI_NodeHandle text; + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_IMAGE); + + ArkUI_NumberValue enable_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enable_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enable_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_CLICK_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + if (text != nullptr && result->data[PARAM_2].f32 > 0) { + string str = + "x:" + to_string(result->data[0].f32) + "\n" + "y:" + to_string(result->data[1].f32) + "\n" + + "source:" + to_string(result->data[3].f32) + "\n" + "windowX:" + to_string(result->data[4].f32) + "\n" + + "windowY:" + to_string(result->data[5].f32) + "\n" + "displayX:" + to_string(result->data[6].f32) + + "\n" + "displayY:" + to_string(result->data[7].f32); + ArkUI_AttributeItem content_item = {}; + content_item.string = str.c_str(); + nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &content_item); + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CommonEventOnClickTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto image = createChildNode(nodeAPI, true); + auto imageDisable = createChildNode(nodeAPI, false); + text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnClickTestImage"; + nodeAPI->setAttribute(image, NODE_ID, &id_item); + id_item.string = "OnClickTestImageDisable"; + nodeAPI->setAttribute(imageDisable, NODE_ID, &id_item); + + // 添加子组件 + nodeAPI->addChild(column, image); + nodeAPI->addChild(column, imageDisable); + nodeAPI->addChild(column, text); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onclick_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onclick_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1fba41bc173541300fa363473d74be19c8c861d8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onclick_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONEVENT_ONCLICK_TEST_H +#define ARKUI_CAPI_DEMO_COMMONEVENT_ONCLICK_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonEventOnClickTest { +public: + ~CommonEventOnClickTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONEVENT_ONCLICK_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onfocus_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onfocus_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4988efd1ab5c5de822ee3822f847a32b1e8d6faa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onfocus_test.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonevent_onfocus_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem label_item = {.string = ""}; + nodeAPI->setAttribute(nodeHandle, NODE_BUTTON_LABEL, &label_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnFocusTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnFocusTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnFocusTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_FOCUS_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CommonEventOnFocusTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnFocusTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnFocusTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = createChildNode(nodeAPI, true); + auto buttonCompare = createChildNode(nodeAPI, true); + auto buttonDisable = createChildNode(nodeAPI, false); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnFocusTestButton"; + nodeAPI->setAttribute(button, NODE_ID, &id_item); + id_item.string = "OnFocusTestButtonCompare"; + nodeAPI->setAttribute(buttonCompare, NODE_ID, &id_item); + id_item.string = "OnFocusTestButtonDisable"; + nodeAPI->setAttribute(buttonDisable, NODE_ID, &id_item); + + // 添加子组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(column, buttonCompare); + nodeAPI->addChild(column, buttonDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnFocusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onfocus_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onfocus_test.h new file mode 100644 index 0000000000000000000000000000000000000000..63948494a67124f9bac3188beb82dd110a6e877e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_onfocus_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONEVENT_ONFOCUS_TEST_H +#define ARKUI_CAPI_DEMO_COMMONEVENT_ONFOCUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonEventOnFocusTest { +public: + ~CommonEventOnFocusTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONEVENT_ONFOCUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_ontouch_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_ontouch_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..14ce615c065428184dc65759682231ccc7157399 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_ontouch_test.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "commonevent_ontouch_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +using namespace std; +static ArkUI_NodeHandle text; + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_IMAGE); + + ArkUI_NumberValue enable_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enable_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enable_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_TOUCH_EVENT, ON_TOUCH_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnTouchTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnTouchTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_TOUCH_EVENT_ID) { + ArkUI_UIInputEvent *result = OH_ArkUI_NodeEvent_GetInputEvent(event); + if (text != nullptr && OH_ArkUI_UIInputEvent_GetEventTime(result) > 0) { + string str = "type:" + to_string(OH_ArkUI_UIInputEvent_GetType(result)) + "\n" + + "touches:" + to_string(OH_ArkUI_PointerEvent_GetPointerCount(result)) + "\n" + + "windowX:" + to_string(OH_ArkUI_PointerEvent_GetWindowX(result)) + "\n" + + "windowY:" + to_string(OH_ArkUI_PointerEvent_GetWindowY(result)) + "\n" + + "displayX:" + to_string(OH_ArkUI_PointerEvent_GetDisplayX(result)) + "\n" + + "displayY:" + to_string(OH_ArkUI_PointerEvent_GetDisplayY(result)) + "\n" + + "source:" + to_string(OH_ArkUI_UIInputEvent_GetSourceType(result)); + ArkUI_AttributeItem content_item = {}; + content_item.string = str.c_str(); + nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &content_item); + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CommonEventOnTouchTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnTouchTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnTouchTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto columnOnTouch = createChildNode(nodeAPI, true); + auto columnOnTouchDisable = createChildNode(nodeAPI, false); + text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnTouchTest"; + nodeAPI->setAttribute(columnOnTouch, NODE_ID, &id_item); + id_item.string = "OnTouchTestDisable"; + nodeAPI->setAttribute(columnOnTouchDisable, NODE_ID, &id_item); + + // 添加子组件 + nodeAPI->addChild(column, columnOnTouch); + nodeAPI->addChild(column, columnOnTouchDisable); + nodeAPI->addChild(column, text); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnTouchTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_ontouch_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_ontouch_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a98169de3612ffe7f895f88265cb360adaa76a74 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/commonevent/commonevent_ontouch_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_COMMONEVENT_ONTOUCH_TEST_H +#define ARKUI_CAPI_DEMO_COMMONEVENT_ONTOUCH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CommonEventOnTouchTest { +public: + ~CommonEventOnTouchTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_COMMONEVENT_ONTOUCH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitydescription_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitydescription_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3260d3b79b382f3733ee62eba378817e3c319fe6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitydescription_test.cpp @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_accessibilitydescription_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentAccessibilityDescriptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityDescriptionTest", + "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = "test"; + nodeAPI->setAttribute(custom, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentAccessibilityDescriptionTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityDescriptionTest", + "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityDescriptionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityDescription + ArkUI_NumberValue accessibilityDescription_value[] = {}; + ArkUI_AttributeItem accessibilityDescription_item = { + accessibilityDescription_value, sizeof(accessibilityDescription_value) / sizeof(ArkUI_NumberValue)}; + accessibilityDescription_item.string = ""; + nodeAPI->setAttribute(custom, NODE_ACCESSIBILITY_DESCRIPTION, &accessibilityDescription_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityDescriptionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitydescription_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitydescription_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cd07c2651dff6f85480f2dfdecf384ac085e2c58 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitydescription_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYDESCRIPTION_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYDESCRIPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentAccessibilityDescriptionTest { +public: + ~CustomComponentAccessibilityDescriptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYDESCRIPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitygroup_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitygroup_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2e78539c497cd7a3f91b52b83cdff49b3fcd7eb7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitygroup_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_accessibilitygroup_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentAccessibilityGroupTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = true}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentAccessibilityGroupTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityGroupTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityGroupTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityGroup + ArkUI_NumberValue accessibilityGroup_value[] = {{.i32 = false}}; + ArkUI_AttributeItem accessibilityGroup_item = {accessibilityGroup_value, + sizeof(accessibilityGroup_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_ACCESSIBILITY_GROUP, &accessibilityGroup_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityGroupTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitygroup_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitygroup_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3d1749ad57563eeaab06a090ed2fcd7740decbd5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitygroup_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYGROUP_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYGROUP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentAccessibilityGroupTest { +public: + ~CustomComponentAccessibilityGroupTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYGROUP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitylevel_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitylevel_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b206fdefc2b642c62a52997401e59098edd1532f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitylevel_test.cpp @@ -0,0 +1,345 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_accessibilitylevel_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentAccessibilityLevelTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_AUTO}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentAccessibilityLevelTest::CreateNativeNodeEnabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_ENABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentAccessibilityLevelTest::CreateNativeNodeDisabled(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentAccessibilityLevelTest::CreateNativeNodeDescendants(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityLevel + ArkUI_NumberValue accessibilityLevel_value[] = {{.i32 = ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS}}; + ArkUI_AttributeItem accessibilityLevel_item = {accessibilityLevel_value, + sizeof(accessibilityLevel_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_ACCESSIBILITY_MODE, &accessibilityLevel_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityLevelTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitylevel_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitylevel_test.h new file mode 100644 index 0000000000000000000000000000000000000000..09b8138fec46f9b7c18468c9bc38ab923fb996e6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitylevel_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYLEVEL_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYLEVEL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentAccessibilityLevelTest { +public: + ~CustomComponentAccessibilityLevelTest(); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDescendants(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisabled(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnabled(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYLEVEL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitytext_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitytext_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aa1e9aede296d7afcda53de7bedc3671ac78498e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitytext_test.cpp @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_accessibilitytext_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentAccessibilityTextTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = "test"; + nodeAPI->setAttribute(custom, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentAccessibilityTextTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityTextTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityTextTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件accessibilityText + ArkUI_NumberValue accessibilityText_value[] = {}; + ArkUI_AttributeItem accessibilityText_item = {accessibilityText_value, + sizeof(accessibilityText_value) / sizeof(ArkUI_NumberValue)}; + accessibilityText_item.string = ""; + nodeAPI->setAttribute(custom, NODE_ACCESSIBILITY_TEXT, &accessibilityText_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAccessibilityTextTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitytext_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitytext_test.h new file mode 100644 index 0000000000000000000000000000000000000000..05b916f6c0a1af4f0574f5bb86f0953c9af1a137 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_accessibilitytext_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYTEXT_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYTEXT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentAccessibilityTextTest { +public: + ~CustomComponentAccessibilityTextTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ACCESSIBILITYTEXT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_align_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_align_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2f9ed7ef9c309912f92defe314d47d0e9d8c9e66 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_align_test.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_align_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t align) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + if (DEFAULT_VALUE_TAG != align) { + ArkUI_NumberValue align_value[] = {{.i32 = align}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ALIGNMENT, &align_item); + } + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + auto innerView = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue inner_width_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem inner_width_item = {inner_width_value, sizeof(inner_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView, NODE_WIDTH, &inner_width_item); + nodeAPI->setAttribute(innerView, NODE_HEIGHT, &inner_width_item); + ArkUI_NumberValue inner_background_color_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem inner_background_color_item = { + inner_background_color_value, sizeof(inner_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView, NODE_BACKGROUND_COLOR, &inner_background_color_item); + + nodeAPI->addChild(nodeHandle, innerView); + + return nodeHandle; +} + +napi_value CustomComponentAlignTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentAlignTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAlignTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto topRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto centerRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto bottomRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto defaultRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto topStartCustom = createChildNode(nodeAPI, ARKUI_ALIGNMENT_TOP_START); + auto topCustom = createChildNode(nodeAPI, ARKUI_ALIGNMENT_TOP); + auto topEndCustom = createChildNode(nodeAPI, ARKUI_ALIGNMENT_TOP_END); + auto startCustom = createChildNode(nodeAPI, ARKUI_ALIGNMENT_START); + auto centerCustom = createChildNode(nodeAPI, ARKUI_ALIGNMENT_CENTER); + auto endCustom = createChildNode(nodeAPI, ARKUI_ALIGNMENT_END); + auto bottomStartCustom = createChildNode(nodeAPI, ARKUI_ALIGNMENT_BOTTOM_START); + auto bottomCustom = createChildNode(nodeAPI, ARKUI_ALIGNMENT_BOTTOM); + auto bottomEndCustom = createChildNode(nodeAPI, ARKUI_ALIGNMENT_BOTTOM_END); + auto defaultCustom = createChildNode(nodeAPI, DEFAULT_VALUE_TAG); + auto abnormalCustom = createChildNode(nodeAPI, ENUM_ABNORMAL_VALUE); + + nodeAPI->addChild(topRow, topStartCustom); + nodeAPI->addChild(topRow, topCustom); + nodeAPI->addChild(topRow, topEndCustom); + nodeAPI->addChild(centerRow, startCustom); + nodeAPI->addChild(centerRow, centerCustom); + nodeAPI->addChild(centerRow, endCustom); + nodeAPI->addChild(bottomRow, bottomStartCustom); + nodeAPI->addChild(bottomRow, bottomCustom); + nodeAPI->addChild(bottomRow, bottomEndCustom); + nodeAPI->addChild(defaultRow, defaultCustom); + nodeAPI->addChild(defaultRow, abnormalCustom); + + nodeAPI->addChild(column, topRow); + nodeAPI->addChild(column, centerRow); + nodeAPI->addChild(column, bottomRow); + nodeAPI->addChild(column, defaultRow); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAlignTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_align_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_align_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3e35d90caad48678a4a0b709c1f6ac28eca6a39f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_align_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ALIGN_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ALIGN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentAlignTest { +public: + ~CustomComponentAlignTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ALIGN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_alignself_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_alignself_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..465522693f7cd16c741fba626933410ca7970f5f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_alignself_test.cpp @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "customcomponent_alignself_test.h" + +#define CHANGETYPEID 6666 +#define PARAM_12 12 +#define PARAM_18 18 +#define PARAM_24 24 +#define PARAM_30 30 +#define PARAM_36 36 + +namespace ArkUICApiDemo { + +static int32_t testType; +static ArkUI_NodeHandle parentContainer; +static ArkUI_NodeHandle custom; +static ArkUI_NodeHandle rootContainer; +static ArkUI_NodeHandle customCompare; +static int32_t direction = INVALID_PARAM; +static int32_t itemAlign; +static char xComponentID[PARAM_64]; + +static void SetAttributes(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle nodeHandle, float width, float height, + uint32_t backgroundColor) +{ + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value CustomComponentAlignSelfTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAlignSelfTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAlignSelfTest", + "GetContext env or info is null"); + return nullptr; + } + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 根据入参创建相应的父容器 + parentContainer = nodeAPI->createNode(ARKUI_NODE_FLEX); + + // 创建目标组件 + custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 创建参考组件 + customCompare = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 设置目标组件属性 + SetAttributes(nodeAPI, custom, SIZE_100, SIZE_100, COLOR_BLUE); + + // 设置父组件属性 + SetAttributes(nodeAPI, parentContainer, SIZE_400, SIZE_400, COLOR_RED); + + // 设置参考组件属性 + SetAttributes(nodeAPI, customCompare, SIZE_100, SIZE_100, COLOR_YELLOW); + + nodeAPI->addChild(parentContainer, custom); + nodeAPI->addChild(parentContainer, customCompare); + nodeAPI->addChild(rootContainer, parentContainer); + + ArkUI_NumberValue align_value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_ALIGN_SELF, &align_item); + + // 挂载组件 + std::string IDParentContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDParentContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentAlignSelfTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +static void SetAttributesForAlignSelf(int type, ArkUI_NativeNodeAPI_1 *nodeApi) +{ + if (type % PARAM_6 == PARAM_1 || type == PARAM_1) { + parentContainer = nodeApi->createNode(ARKUI_NODE_FLEX); + direction = ARKUI_FLEX_DIRECTION_ROW; + } else if (type % PARAM_6 == PARAM_2 || type == PARAM_2) { + parentContainer = nodeApi->createNode(ARKUI_NODE_FLEX); + direction = ARKUI_FLEX_DIRECTION_COLUMN; + } else if (type % PARAM_6 == PARAM_3 || type == PARAM_3) { + parentContainer = nodeApi->createNode(ARKUI_NODE_FLEX); + direction = ARKUI_FLEX_DIRECTION_ROW_REVERSE; + } else if (type % PARAM_6 == PARAM_4 || type == PARAM_4) { + parentContainer = nodeApi->createNode(ARKUI_NODE_FLEX); + direction = ARKUI_FLEX_DIRECTION_COLUMN_REVERSE; + } else if (type % PARAM_6 == PARAM_5 || type == PARAM_5) { + parentContainer = nodeApi->createNode(ARKUI_NODE_ROW); + direction = INVALID_PARAM; + } else if (type % PARAM_6 == PARAM_0 || type == PARAM_6) { + parentContainer = nodeApi->createNode(ARKUI_NODE_COLUMN); + direction = INVALID_PARAM; + } + + // 根据入参设置alignSelf + if (PARAM_1 <= type && type <= PARAM_6) { + itemAlign = ARKUI_ITEM_ALIGNMENT_AUTO; + } else if (PARAM_6 <= type && type <= PARAM_12) { + itemAlign = ARKUI_ITEM_ALIGNMENT_START; + } else if (PARAM_12 <= type && type <= PARAM_18) { + itemAlign = ARKUI_ITEM_ALIGNMENT_CENTER; + } else if (PARAM_18 <= type && type <= PARAM_24) { + itemAlign = ARKUI_ITEM_ALIGNMENT_END; + } else if (PARAM_24 <= type && type <= PARAM_30) { + itemAlign = ARKUI_ITEM_ALIGNMENT_STRETCH; + } else if (PARAM_30 <= type && type <= PARAM_36) { + itemAlign = ARKUI_ITEM_ALIGNMENT_BASELINE; + } +} + +napi_value CustomComponentAlignSelfTest::ChangeType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentAlignSelfTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + nodeAPI->removeChild(rootContainer, parentContainer); + + // 根据入参设置主轴方向、父容器、alignSelf + SetAttributesForAlignSelf(testType, nodeAPI); + + nodeAPI->addChild(parentContainer, custom); + nodeAPI->addChild(parentContainer, customCompare); + nodeAPI->addChild(rootContainer, parentContainer); + + // 设置父组件属性 + SetAttributes(nodeAPI, parentContainer, SIZE_400, SIZE_400, COLOR_RED); + + // 设置容器方向 + if (direction != INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentAlignSelfTest", "directionINVALID_PARAM"); + ArkUI_NumberValue direction_value[] = {{.i32 = direction}}; + ArkUI_AttributeItem direction_item = {direction_value, sizeof(direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_FLEX_OPTION, &direction_item); + } + + // 设置alignSelf + ArkUI_NumberValue value[] = {{.i32 = itemAlign}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_ALIGN_SELF, &item); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_alignself_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_alignself_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cb80a525ca429908b1e08df97ed1a9cd3dbcab27 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_alignself_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ALIGNSELF_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ALIGNSELF_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentAlignSelfTest { +public: + ~CustomComponentAlignSelfTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value ChangeType(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ALIGNSELF_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3fc21a52f08fe676b2bdb7b83dab76c4d7d56f96 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_backgroundcolor_test.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_backgroundcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t backgroundColor) +{ + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + return custom; +} + +napi_value CustomComponentBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0xFFFF0000)); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0xFFFFFFFF)); + nodeAPI->addChild(column, createChildNode(nodeAPI, 0x00000000)); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7679d5f6afa0940296dd277b95b37fcd7a0d6234 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_backgroundcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentBackgroundColorTest { +public: + ~CustomComponentBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_blendmode_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_blendmode_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a0e3e59161ad50572a525a216bac859e449fe81e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_blendmode_test.cpp @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_blendmode_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define INNER_VIEW_LENGTH 60 +#define BLEND_MODE_TYPE_LENGTH 30 +#define INNER_VIEW_SIZE 30 +#define INNER_STACK_HEIGHT 30 +#define INNER_STACK_WIDTH 60 +#define INNER_VIEW_MARGIN 5 + +static ArkUI_NodeHandle CreateBlendModeNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + // 第一个方块(绿色) + auto customFirst = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + ArkUI_NumberValue backgroundColorFirst[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem backgroundColorFirstItem = {backgroundColorFirst, + sizeof(backgroundColorFirst) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue size[] = {{.f32 = INNER_VIEW_SIZE}}; + ArkUI_AttributeItem sizeItem = {size, sizeof(size) / sizeof(ArkUI_NumberValue)}; + + nodeAPI->setAttribute(customFirst, NODE_BACKGROUND_COLOR, &backgroundColorFirstItem); + nodeAPI->setAttribute(customFirst, NODE_WIDTH, &sizeItem); + nodeAPI->setAttribute(customFirst, NODE_HEIGHT, &sizeItem); + + // 第二个方块(蓝色) + auto customSecond = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + ArkUI_NumberValue backgroundColorSecond[] = {{.u32 = COLOR_BLUE}}; + ArkUI_NumberValue offsetValue[] = {{.f32 = -10}, {.f32 = 0}}; + ArkUI_AttributeItem backgroundColorSecondItem = {backgroundColorSecond, + sizeof(backgroundColorSecond) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem offsetItem = {offsetValue, sizeof(offsetValue) / sizeof(ArkUI_NumberValue)}; + + nodeAPI->setAttribute(customSecond, NODE_BACKGROUND_COLOR, &backgroundColorSecondItem); + nodeAPI->setAttribute(customSecond, NODE_WIDTH, &sizeItem); + nodeAPI->setAttribute(customSecond, NODE_HEIGHT, &sizeItem); + nodeAPI->setAttribute(customSecond, NODE_OFFSET, &offsetItem); + + // 添加到父控件 + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(row, customFirst); + nodeAPI->addChild(row, customSecond); + + return row; +} + +napi_value CustomComponentBlendModeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBlendModeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBlendModeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + ArkUI_NumberValue flexOptions[] = {{.i32 = ARKUI_FLEX_DIRECTION_ROW}, + {.i32 = ARKUI_FLEX_WRAP_WRAP}, + {.i32 = ARKUI_FLEX_ALIGNMENT_START}, + {.i32 = ARKUI_ITEM_ALIGNMENT_START}, + {.i32 = ARKUI_FLEX_ALIGNMENT_START}}; + ArkUI_AttributeItem flexOptionsItem = {flexOptions, sizeof(flexOptions) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_FLEX_OPTION, &flexOptionsItem); + + ArkUI_NodeHandle innerView[INNER_VIEW_LENGTH]; + ArkUI_BlendMode blendModeTypes[BLEND_MODE_TYPE_LENGTH] = { + ARKUI_BLEND_MODE_NONE, ARKUI_BLEND_MODE_CLEAR, ARKUI_BLEND_MODE_SRC, + ARKUI_BLEND_MODE_DST, ARKUI_BLEND_MODE_SRC_OVER, ARKUI_BLEND_MODE_DST_OVER, + ARKUI_BLEND_MODE_SRC_IN, ARKUI_BLEND_MODE_DST_IN, ARKUI_BLEND_MODE_SRC_OUT, + ARKUI_BLEND_MODE_DST_OUT, ARKUI_BLEND_MODE_SRC_ATOP, ARKUI_BLEND_MODE_DST_ATOP, + ARKUI_BLEND_MODE_XOR, ARKUI_BLEND_MODE_PLUS, ARKUI_BLEND_MODE_MODULATE, + ARKUI_BLEND_MODE_SCREEN, ARKUI_BLEND_MODE_OVERLAY, ARKUI_BLEND_MODE_DARKEN, + ARKUI_BLEND_MODE_LIGHTEN, ARKUI_BLEND_MODE_COLOR_DODGE, ARKUI_BLEND_MODE_COLOR_BURN, + ARKUI_BLEND_MODE_HARD_LIGHT, ARKUI_BLEND_MODE_SOFT_LIGHT, ARKUI_BLEND_MODE_DIFFERENCE, + ARKUI_BLEND_MODE_EXCLUSION, ARKUI_BLEND_MODE_MULTIPLY, ARKUI_BLEND_MODE_HUE, + ARKUI_BLEND_MODE_SATURATION, ARKUI_BLEND_MODE_COLOR, ARKUI_BLEND_MODE_LUMINOSITY}; + ArkUI_BlendApplyType blendApplyTypes[] = {BLEND_APPLY_TYPE_FAST, BLEND_APPLY_TYPE_OFFSCREEN}; + ArkUI_NumberValue blendMode[2]; + // 设置混合模式 + for (char i = 0; i < INNER_VIEW_LENGTH; i++) { + // 创建混合目标 + innerView[i] = CreateBlendModeNode(nodeAPI); + if (i < BLEND_MODE_TYPE_LENGTH) { + blendMode[0].i32 = blendModeTypes[i]; + blendMode[1].i32 = blendApplyTypes[0]; + } else { + blendMode[0].i32 = blendModeTypes[i - BLEND_MODE_TYPE_LENGTH]; + blendMode[1].i32 = blendApplyTypes[1]; + } + ArkUI_AttributeItem blendModeItem = {blendMode, sizeof(blendMode) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView[i], NODE_BLEND_MODE, &blendModeItem); + + // 创建混合背景 + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue stackBackgroundColor[] = {{.u32 = COLOR_GRAY}}; + ArkUI_AttributeItem stackBackgroundColorItem = {stackBackgroundColor, + sizeof(stackBackgroundColor) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_BACKGROUND_COLOR, &stackBackgroundColorItem); + + ArkUI_NumberValue stackWidth[] = {{.f32 = INNER_STACK_WIDTH}}; + ArkUI_AttributeItem stackWidthItem = {stackWidth, sizeof(stackWidth) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue stackHeight[] = {{.f32 = INNER_STACK_HEIGHT}}; + ArkUI_AttributeItem stackHeightItem = {stackHeight, sizeof(stackHeight) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_WIDTH, &stackWidthItem); + nodeAPI->setAttribute(stack, NODE_HEIGHT, &stackHeightItem); + + ArkUI_NumberValue margin[] = {{.f32 = INNER_VIEW_MARGIN}}; + ArkUI_AttributeItem marginItem = {margin, sizeof(margin) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_MARGIN, &marginItem); + + nodeAPI->addChild(stack, innerView[i]); + + // 添加到父控件 + nodeAPI->addChild(flex, stack); + } + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), flex) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBlendModeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_blendmode_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_blendmode_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6d3aead60ed1fb7342609051e7bb44b33e7c8201 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_blendmode_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BLENDMODE_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BLENDMODE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentBlendModeTest { +public: + ~CustomComponentBlendModeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BLENDMODE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_bordercolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_bordercolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..885d93f76e436a6a878ec3ee60395c7600d44513 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_bordercolor_test.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_bordercolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentBorderColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderColorTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto edgeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, edgeCustom); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BORDER_COLOR, &border_color_item); + + // 设置edgeCustom组件宽度 + nodeAPI->setAttribute(edgeCustom, NODE_WIDTH, &width_item); + + // 设置edgeCustom组件高度 + nodeAPI->setAttribute(edgeCustom, NODE_HEIGHT, &height_item); + + // 设置edgeCustom组件背景色 + nodeAPI->setAttribute(edgeCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置edgeCustom组件边框宽度 + nodeAPI->setAttribute(edgeCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置edgeCustom组件边框颜色 + ArkUI_NumberValue edge_border_color_value[] = { + {.u32 = 0xFF0000FF}, {.u32 = 0xFF0000FF}, {.u32 = 0xFF0000FF}, {.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem edge_border_color_item = {edge_border_color_value, + sizeof(edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(edgeCustom, NODE_BORDER_COLOR, &edge_border_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_bordercolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_bordercolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ffaa474e42cc58915ecd71c10d1c449340ee87f0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_bordercolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentBorderColorTest { +public: + ~CustomComponentBorderColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderradius_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderradius_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..960ad36358ac6c62d0e93891de261e725e0647c3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderradius_test.cpp @@ -0,0 +1,230 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_borderradius_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentBorderRadiusTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderWidthTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto edgeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto maxCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto maxEdgeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto abnormalCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto abnormalEdgeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, edgeCustom); + nodeAPI->addChild(column, maxCustom); + nodeAPI->addChild(column, maxEdgeCustom); + nodeAPI->addChild(column, abnormalCustom); + nodeAPI->addChild(column, abnormalEdgeCustom); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BORDER_COLOR, &border_color_item); + + // 设置组件边框圆角 + ArkUI_NumberValue border_radius_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BORDER_RADIUS, &border_radius_item); + + // 设置edgeCustom组件宽度 + nodeAPI->setAttribute(edgeCustom, NODE_WIDTH, &width_item); + + // 设置edgeCustom组件高度 + nodeAPI->setAttribute(edgeCustom, NODE_HEIGHT, &height_item); + + // 设置edgeCustom组件背景色 + nodeAPI->setAttribute(edgeCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置edgeCustom组件边框宽度 + nodeAPI->setAttribute(edgeCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置edgeCustom组件边框颜色 + ArkUI_NumberValue edge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem edge_border_color_item = {edge_border_color_value, + sizeof(edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(edgeCustom, NODE_BORDER_COLOR, &edge_border_color_item); + + // 设置edgeCustom组件边框圆角 + ArkUI_NumberValue edge_border_radius_value[] = {{.f32 = 5}, {.f32 = 5}, {.f32 = 5}, {.f32 = 5}}; + ArkUI_AttributeItem edge_border_radius_item = {edge_border_radius_value, + sizeof(edge_border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(edgeCustom, NODE_BORDER_RADIUS, &edge_border_radius_item); + + // 设置maxCustom组件宽度 + nodeAPI->setAttribute(maxCustom, NODE_WIDTH, &width_item); + + // 设置maxCustom组件高度 + nodeAPI->setAttribute(maxCustom, NODE_HEIGHT, &height_item); + + // 设置maxCustom组件背景色 + nodeAPI->setAttribute(maxCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置maxCustom组件边框宽度 + nodeAPI->setAttribute(maxCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置maxCustom组件边框颜色 + ArkUI_NumberValue max_border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem max_border_color_item = {max_border_color_value, + sizeof(max_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(maxCustom, NODE_BORDER_COLOR, &max_border_color_item); + + // 设置maxCustom组件边框圆角 + ArkUI_NumberValue max_border_radius_value[] = {{.f32 = 25}}; + ArkUI_AttributeItem max_border_radius_item = {max_border_radius_value, + sizeof(max_border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(maxCustom, NODE_BORDER_RADIUS, &max_border_radius_item); + + // 设置maxEdgeCustom组件宽度 + nodeAPI->setAttribute(maxEdgeCustom, NODE_WIDTH, &width_item); + + // 设置maxEdgeCustom组件高度 + nodeAPI->setAttribute(maxEdgeCustom, NODE_HEIGHT, &height_item); + + // 设置maxEdgeCustom组件背景色 + nodeAPI->setAttribute(maxEdgeCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置maxEdgeCustom组件边框宽度 + nodeAPI->setAttribute(maxEdgeCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置maxEdgeCustom组件边框颜色 + ArkUI_NumberValue maxEdge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem maxEdge_border_color_item = {maxEdge_border_color_value, + sizeof(maxEdge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(maxEdgeCustom, NODE_BORDER_COLOR, &maxEdge_border_color_item); + + // 设置maxEdgeCustom组件边框圆角 + ArkUI_NumberValue maxEdge_border_radius_value[] = {{.f32 = 150}, {.f32 = 150}, {.f32 = 150}, {.f32 = 150}}; + ArkUI_AttributeItem maxEdge_border_radius_item = {maxEdge_border_radius_value, + sizeof(maxEdge_border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(maxEdgeCustom, NODE_BORDER_RADIUS, &maxEdge_border_radius_item); + + // 设置abnormalCustom组件宽度 + nodeAPI->setAttribute(abnormalCustom, NODE_WIDTH, &width_item); + + // 设置abnormalCustom组件高度 + nodeAPI->setAttribute(abnormalCustom, NODE_HEIGHT, &height_item); + + // 设置abnormalCustom组件背景色 + nodeAPI->setAttribute(abnormalCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置abnormalCustom组件边框宽度 + nodeAPI->setAttribute(abnormalCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置abnormalCustom组件边框颜色 + ArkUI_NumberValue abnormal_border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem abnormal_border_color_item = {abnormal_border_color_value, + sizeof(abnormal_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalCustom, NODE_BORDER_COLOR, &abnormal_border_color_item); + + // 设置abnormalCustom组件边框圆角 + ArkUI_NumberValue abnormal_border_radius_value[] = {{.f32 = -5}}; + ArkUI_AttributeItem abnormal_border_radius_item = { + abnormal_border_radius_value, sizeof(abnormal_border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalCustom, NODE_BORDER_RADIUS, &abnormal_border_radius_item); + + // 设置abnormalEdgeCustom组件宽度 + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_WIDTH, &width_item); + + // 设置abnormalEdgeCustom组件高度 + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_HEIGHT, &height_item); + + // 设置abnormalEdgeCustom组件背景色 + ArkUI_NumberValue abnormalEdge_background_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem abnormalEdge_background_color_item = { + abnormalEdge_background_color_value, sizeof(abnormalEdge_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_BACKGROUND_COLOR, &abnormalEdge_background_color_item); + + // 设置abnormalEdgeCustom组件边框宽度 + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置abnormalCustom组件边框颜色 + ArkUI_NumberValue abnormal_edge_border_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem abnormal_edge_border_color_item = { + abnormal_edge_border_color_value, sizeof(abnormal_edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_BORDER_COLOR, &abnormal_edge_border_color_item); + + // 设置abnormalEdgeCustom组件边框圆角 + ArkUI_NumberValue abnormalEdge_border_radius_value[] = {{.f32 = -5}, {.f32 = -5}, {.f32 = -5}, {.f32 = -5}}; + ArkUI_AttributeItem abnormalEdge_border_radius_item = { + abnormalEdge_border_radius_value, sizeof(abnormalEdge_border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_BORDER_RADIUS, &abnormalEdge_border_radius_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderradius_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderradius_test.h new file mode 100644 index 0000000000000000000000000000000000000000..07eae02dc27df003dea29366487d0b4238769eef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderradius_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERRADIUS_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERRADIUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentBorderRadiusTest { +public: + ~CustomComponentBorderRadiusTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERRADIUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..382d31e87dadbf7d8db6e239964584fb9ddbfb50 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderstyle_test.cpp @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_borderstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentBorderStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderStyleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto dashedCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto dottedCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto solidEdgeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto dashedEdgeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto dottedEdgeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, dashedCustom); + nodeAPI->addChild(column, dottedCustom); + nodeAPI->addChild(column, solidEdgeCustom); + nodeAPI->addChild(column, dashedEdgeCustom); + nodeAPI->addChild(column, dottedEdgeCustom); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BORDER_COLOR, &border_color_item); + + // 设置组件边框样式 + ArkUI_NumberValue border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_SOLID}}; + ArkUI_AttributeItem border_style_item = {border_style_value, + sizeof(border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BORDER_STYLE, &border_style_item); + + // 设置dashedCustom组件宽度 + nodeAPI->setAttribute(dashedCustom, NODE_WIDTH, &width_item); + + // 设置dashedCustom组件高度 + nodeAPI->setAttribute(dashedCustom, NODE_HEIGHT, &height_item); + + // 设置dashedCustom组件背景色 + nodeAPI->setAttribute(dashedCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置dashedCustom组件边框宽度 + nodeAPI->setAttribute(dashedCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置dashedCustom组件边框颜色 + ArkUI_NumberValue edge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem edge_border_color_item = {edge_border_color_value, + sizeof(edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dashedCustom, NODE_BORDER_COLOR, &edge_border_color_item); + + // 设置dashedCustom组件边框样式 + ArkUI_NumberValue dashed_border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_DASHED}}; + ArkUI_AttributeItem dashed_border_style_item = {dashed_border_style_value, + sizeof(dashed_border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dashedCustom, NODE_BORDER_STYLE, &dashed_border_style_item); + + // 设置dottedCustom组件宽度 + nodeAPI->setAttribute(dottedCustom, NODE_WIDTH, &width_item); + + // 设置dottedCustom组件高度 + nodeAPI->setAttribute(dottedCustom, NODE_HEIGHT, &height_item); + + // 设置dottedCustom组件背景色 + nodeAPI->setAttribute(dottedCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置dottedCustom组件边框宽度 + nodeAPI->setAttribute(dottedCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置dottedCustom组件边框颜色 + ArkUI_NumberValue max_border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem max_border_color_item = {max_border_color_value, + sizeof(max_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dottedCustom, NODE_BORDER_COLOR, &max_border_color_item); + + // 设置dottedCustom组件边框样式 + ArkUI_NumberValue dotted_border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_DOTTED}}; + ArkUI_AttributeItem dotted_border_style_item = {dotted_border_style_value, + sizeof(dotted_border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dottedCustom, NODE_BORDER_STYLE, &dotted_border_style_item); + + // 设置solidEdgeCustom组件宽度 + nodeAPI->setAttribute(solidEdgeCustom, NODE_WIDTH, &width_item); + + // 设置solidEdgeCustom组件高度 + nodeAPI->setAttribute(solidEdgeCustom, NODE_HEIGHT, &height_item); + + // 设置solidEdgeCustom组件背景色 + nodeAPI->setAttribute(solidEdgeCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置solidEdgeCustom组件边框宽度 + nodeAPI->setAttribute(solidEdgeCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置solidEdgeCustom组件边框颜色 + ArkUI_NumberValue maxEdge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem maxEdge_border_color_item = {maxEdge_border_color_value, + sizeof(maxEdge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(solidEdgeCustom, NODE_BORDER_COLOR, &maxEdge_border_color_item); + + // 设置solidEdgeCustom组件边框样式 + ArkUI_NumberValue solid_edge_border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_SOLID}, + {.i32 = ARKUI_BORDER_STYLE_SOLID}, + {.i32 = ARKUI_BORDER_STYLE_SOLID}, + {.i32 = ARKUI_BORDER_STYLE_SOLID}}; + ArkUI_AttributeItem solid_edge_border_style_item = { + solid_edge_border_style_value, sizeof(solid_edge_border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(solidEdgeCustom, NODE_BORDER_STYLE, &solid_edge_border_style_item); + + // 设置dashedEdgeCustom组件宽度 + nodeAPI->setAttribute(dashedEdgeCustom, NODE_WIDTH, &width_item); + + // 设置dashedEdgeCustom组件高度 + nodeAPI->setAttribute(dashedEdgeCustom, NODE_HEIGHT, &height_item); + + // 设置dashedEdgeCustom组件背景色 + nodeAPI->setAttribute(dashedEdgeCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置dashedEdgeCustom组件边框宽度 + nodeAPI->setAttribute(dashedEdgeCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置dashedEdgeCustom组件边框颜色 + ArkUI_NumberValue abnormal_border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem abnormal_border_color_item = {abnormal_border_color_value, + sizeof(abnormal_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dashedEdgeCustom, NODE_BORDER_COLOR, &abnormal_border_color_item); + + // 设置dashedEdgeCustom组件边框样式 + ArkUI_NumberValue dashed_edge_border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_DASHED}, + {.i32 = ARKUI_BORDER_STYLE_DASHED}, + {.i32 = ARKUI_BORDER_STYLE_DASHED}, + {.i32 = ARKUI_BORDER_STYLE_DASHED}}; + ArkUI_AttributeItem dashed_edge_border_style_item = { + dashed_edge_border_style_value, sizeof(dashed_edge_border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dashedEdgeCustom, NODE_BORDER_STYLE, &dashed_edge_border_style_item); + + // 设置dottedEdgeCustom组件宽度 + nodeAPI->setAttribute(dottedEdgeCustom, NODE_WIDTH, &width_item); + + // 设置dottedEdgeCustom组件高度 + nodeAPI->setAttribute(dottedEdgeCustom, NODE_HEIGHT, &height_item); + + // 设置dottedEdgeCustom组件背景色 + ArkUI_NumberValue abnormalEdge_background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem abnormalEdge_background_color_item = { + abnormalEdge_background_color_value, sizeof(abnormalEdge_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dottedEdgeCustom, NODE_BACKGROUND_COLOR, &abnormalEdge_background_color_item); + + // 设置dottedEdgeCustom组件边框宽度 + nodeAPI->setAttribute(dottedEdgeCustom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置dashedEdgeCustom组件边框颜色 + ArkUI_NumberValue abnormal_edge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem abnormal_edge_border_color_item = { + abnormal_edge_border_color_value, sizeof(abnormal_edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dottedEdgeCustom, NODE_BORDER_COLOR, &abnormal_edge_border_color_item); + + // 设置dottedEdgeCustom组件边框样式 + ArkUI_NumberValue dotted_edge_border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_DOTTED}, + {.i32 = ARKUI_BORDER_STYLE_DOTTED}, + {.i32 = ARKUI_BORDER_STYLE_DOTTED}, + {.i32 = ARKUI_BORDER_STYLE_DOTTED}}; + ArkUI_AttributeItem dotted_edge_border_style_item = { + dotted_edge_border_style_value, sizeof(dotted_edge_border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(dottedEdgeCustom, NODE_BORDER_STYLE, &dotted_edge_border_style_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0f4f2241dee55220e4ec8695fe98601a2e68a817 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentBorderStyleTest { +public: + ~CustomComponentBorderStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderwidth_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderwidth_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..750910a68ed51c5ec2fe6547f5b334d1848e4a14 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderwidth_test.cpp @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_borderwidth_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentBorderWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderWidthTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto edgeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto abnormalCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto abnormalEdgeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, edgeCustom); + nodeAPI->addChild(column, abnormalCustom); + nodeAPI->addChild(column, abnormalEdgeCustom); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BORDER_COLOR, &border_color_item); + + // 设置edgeCustom组件宽度 + nodeAPI->setAttribute(edgeCustom, NODE_WIDTH, &width_item); + + // 设置edgeCustom组件高度 + nodeAPI->setAttribute(edgeCustom, NODE_HEIGHT, &height_item); + + // 设置edgeCustom组件背景色 + nodeAPI->setAttribute(edgeCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置edgeCustom组件边框宽度 + ArkUI_NumberValue edge_border_width_value[] = {{.f32 = 5}, {.f32 = 5}, {.f32 = 5}, {.f32 = 5}}; + ArkUI_AttributeItem edge_border_width_item = {edge_border_width_value, + sizeof(edge_border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(edgeCustom, NODE_BORDER_WIDTH, &edge_border_width_item); + + // 设置edgeCustom组件边框颜色 + ArkUI_NumberValue edge_border_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem edge_border_color_item = {edge_border_color_value, + sizeof(edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(edgeCustom, NODE_BORDER_COLOR, &edge_border_color_item); + + // 设置abnormalCustom组件宽度 + nodeAPI->setAttribute(abnormalCustom, NODE_WIDTH, &width_item); + + // 设置abnormalCustom组件高度 + nodeAPI->setAttribute(abnormalCustom, NODE_HEIGHT, &height_item); + + // 设置abnormalCustom组件背景色 + nodeAPI->setAttribute(abnormalCustom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置abnormalCustom组件边框宽度 + ArkUI_NumberValue abnormal_border_width_value[] = {{.f32 = -5}}; + ArkUI_AttributeItem abnormal_border_width_item = {abnormal_border_width_value, + sizeof(abnormal_border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalCustom, NODE_BORDER_WIDTH, &abnormal_border_width_item); + + // 设置abnormalCustom组件边框颜色 + ArkUI_NumberValue abnormal_border_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem abnormal_border_color_item = {abnormal_border_color_value, + sizeof(abnormal_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalCustom, NODE_BORDER_COLOR, &abnormal_border_color_item); + + // 设置abnormalEdgeCustom组件宽度 + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_WIDTH, &width_item); + + // 设置abnormalEdgeCustom组件高度 + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_HEIGHT, &height_item); + + // 设置abnormalEdgeCustom组件背景色 + ArkUI_NumberValue abnormalEdge_background_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem abnormalEdge_background_color_item = { + abnormalEdge_background_color_value, sizeof(abnormalEdge_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_BACKGROUND_COLOR, &abnormalEdge_background_color_item); + + // 设置abnormalEdgeCustom组件边框宽度 + ArkUI_NumberValue abnormal_edge_border_width_value[] = {{.f32 = -5}, {.f32 = -5}, {.f32 = -5}, {.f32 = -5}}; + ArkUI_AttributeItem abnormal_edge_border_width_item = { + abnormal_edge_border_width_value, sizeof(abnormal_edge_border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_BORDER_WIDTH, &abnormal_edge_border_width_item); + + // 设置abnormalCustom组件边框颜色 + ArkUI_NumberValue abnormal_edge_border_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem abnormal_edge_border_color_item = { + abnormal_edge_border_color_value, sizeof(abnormal_edge_border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalEdgeCustom, NODE_BORDER_COLOR, &abnormal_edge_border_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderwidth_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderwidth_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f8c48b50ed6222919eeba2c5b5974581bb726f23 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_borderwidth_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERWIDTH_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERWIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentBorderWidthTest { +public: + ~CustomComponentBorderWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_BORDERWIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3568669472416821884acfca1a497dd9629a93e6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_clip_test.cpp @@ -0,0 +1,282 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_clip_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentClipTest::CreateNativeNodeRectangle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", + "GetConcolumn env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 400}, {.f32 = 300}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentClipTest::CreateNativeNodeCircle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", + "GetConcolumn env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 300}, {.f32 = 300}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentClipTest::CreateNativeNodeEllipse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", + "GetConcolumn env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 400}, {.f32 = 300}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentClipTest::CreateNativeNodePath(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", + "GetConcolumn env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 500}, {.f32 = 500}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + clipShape_item.string = "M300 0 L500 500 L0 500 Z"; + nodeAPI->setAttribute(custom, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..dc560d17104a1c63e3e0d4a5b7b52d96d3f79fdc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_clip_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_CLIP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentClipTest { +public: + ~CustomComponentClipTest(); + static napi_value CreateNativeNodeRectangle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCircle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEllipse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodePath(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_constraintsize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_constraintsize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..da745ef6b248a6e6328ee778f4e2beba9c3ad9e5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_constraintsize_test.cpp @@ -0,0 +1,350 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_constraintsize_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value CustomComponentConstraintSizeTest::CreateNativeNodeMaxSetMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 250}, {.f32 = 350}, {.f32 = 150}, {.f32 = 250}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentConstraintSizeTest::CreateNativeNodeMaxMinSet(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 350}, {.f32 = 400}, {.f32 = 250}, {.f32 = 300}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentConstraintSizeTest::CreateNativeNodeSetMaxMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 200}, {.f32 = 250}, {.f32 = 100}, {.f32 = 150}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentConstraintSizeTest::CreateNativeNodeMinSetMax(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 350}, {.f32 = 250}, {.f32 = 250}, {.f32 = 150}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentConstraintSizeTest::CreateNativeNodeMinMaxSet(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 400}, {.f32 = 350}, {.f32 = 300}, {.f32 = 250}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentConstraintSizeTest::CreateNativeNodeSetMinMax(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 250}, {.f32 = 200}, {.f32 = 150}, {.f32 = 100}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_CONSTRAINT_SIZE, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentConstraintSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_constraintsize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_constraintsize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1b42e08880b22aa7656bbc54d14739de75da42c6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_constraintsize_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_CONSTRAINTSIZE_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_CONSTRAINTSIZE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentConstraintSizeTest { +public: + ~CustomComponentConstraintSizeTest(); + static napi_value CreateNativeNodeMaxSetMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMaxMinSet(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetMaxMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMinSetMax(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMinMaxSet(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetMinMax(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_CONSTRAINTSIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_contrast_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_contrast_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..31923d72ee69d7b79f6355d27f113f06726abbf3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_contrast_test.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_contrast_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle CustomComponentContrastTest::CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, float width, + float height, float contrast) +{ + auto custom = node_api->createNode(ARKUI_NODE_CUSTOM); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件对比度效果 + ArkUI_NumberValue contrast_value[] = {{.f32 = contrast}}; + ArkUI_AttributeItem contrast_item = {contrast_value, sizeof(contrast_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_CONTRAST, &contrast_item); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(custom, NODE_BACKGROUND_IMAGE, &src_item); + + return custom; +} + +napi_value CustomComponentContrastTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentContrastTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentContrastTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float contrast = 0; + float width = 100; + float height = 100; + auto custom = CreateSubCustomNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + contrast = 1.0; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + contrast = 5.0; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + contrast = 10.0; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + contrast = -1.0; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + contrast = 11.0; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, contrast); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentContrastTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_contrast_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_contrast_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f10e95a6cbf9dc20285b2ecc3caa92de6cccb8f0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_contrast_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_CONTRAST_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_CONTRAST_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentContrastTest { +public: + ~CustomComponentContrastTest(); + static ArkUI_NodeHandle CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float contrast); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_CONTRAST_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_direction_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_direction_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8d5d6ef1f5580eab3923ef6c7c0ed7a058a9ba0d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_direction_test.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_direction_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t direction) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + if (DEFAULT_VALUE_TAG != direction) { + ArkUI_NumberValue direction_value[] = {{.i32 = direction}}; + ArkUI_AttributeItem direction_item = {direction_value, sizeof(direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_DIRECTION, &direction_item); + } + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + auto innerView = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue inner_width_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem inner_width_item = {inner_width_value, sizeof(inner_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView, NODE_WIDTH, &inner_width_item); + nodeAPI->setAttribute(innerView, NODE_HEIGHT, &inner_width_item); + ArkUI_NumberValue inner_background_color_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem inner_background_color_item = { + inner_background_color_value, sizeof(inner_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView, NODE_BACKGROUND_COLOR, &inner_background_color_item); + + nodeAPI->addChild(nodeHandle, innerView); + + return nodeHandle; +} + +napi_value CustomComponentDirectionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentDirectionTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentDirectionTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto ltrCustom = createChildNode(nodeAPI, ARKUI_DIRECTION_LTR); + auto rtlCustom = createChildNode(nodeAPI, ARKUI_DIRECTION_RTL); + auto autoCustom = createChildNode(nodeAPI, ARKUI_DIRECTION_AUTO); + auto defaultCustom = createChildNode(nodeAPI, DEFAULT_VALUE_TAG); + auto abnormalCustom = createChildNode(nodeAPI, ENUM_ABNORMAL_VALUE); + + nodeAPI->addChild(column, ltrCustom); + nodeAPI->addChild(column, rtlCustom); + nodeAPI->addChild(column, autoCustom); + nodeAPI->addChild(column, defaultCustom); + nodeAPI->addChild(column, abnormalCustom); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentDirectionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_direction_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_direction_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9ad9412b6240e6cda410c060ddcd9ef4a811c82a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_direction_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_DIRECTION_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_DIRECTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentDirectionTest { +public: + ~CustomComponentDirectionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_DIRECTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_enabled_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_enabled_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..17016ae39847b57d9b11267810c07b727721917b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_enabled_test.cpp @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_enabled_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled, bool registerFocusEvent) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + if (registerFocusEvent) { + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + } + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentEnabledTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentEnabledTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentEnabledTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + uint32_t color = COLOR_PURPLE; + switch (eventId) { + case ON_CLICK_EVENT_ID: + color = COLOR_GREEN; + break; + case ON_FOCUS_EVENT_ID: + color = COLOR_BLUE; + break; + case ON_BLUR_EVENT_ID: + color = COLOR_YELLOW; + break; + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value CustomComponentEnabledTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentEnabledTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentEnabledTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = createChildNode(nodeAPI, true, false); + auto customCompare = createChildNode(nodeAPI, true, true); + auto customCompareBlur = createChildNode(nodeAPI, true, true); + auto customDisable = createChildNode(nodeAPI, false, true); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "EnabledTestCustomComponent"; + nodeAPI->setAttribute(custom, NODE_ID, &id_item); + id_item.string = "EnabledTestCustomComponentCompare"; + nodeAPI->setAttribute(customCompare, NODE_ID, &id_item); + id_item.string = "EnabledTestCustomComponentCompareBlur"; + nodeAPI->setAttribute(customCompareBlur, NODE_ID, &id_item); + id_item.string = "EnabledTestCustomComponentDisable"; + nodeAPI->setAttribute(customDisable, NODE_ID, &id_item); + + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, customCompare); + nodeAPI->addChild(column, customCompareBlur); + nodeAPI->addChild(column, customDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_enabled_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_enabled_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1defa17f63fe592a914dfe821f6d995a118ed001 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_enabled_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ENABLED_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ENABLED_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentEnabledTest { +public: + ~CustomComponentEnabledTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ENABLED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexbasis_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexbasis_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..030b2f807f7163065604d635a9ec9b2942f71519 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexbasis_test.cpp @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "customcomponent_flexbasis_test.h" + +namespace ArkUICApiDemo { + +napi_value CustomComponentFlexBasisTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFlexBasisTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFlexBasisTest", + "GetContext env or info is null"); + return nullptr; + } + + // 获取入参 + size_t argc = PARAM_3; + napi_value args[PARAM_3] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 获取父容器ID + int parentContainerID; + napi_get_value_int32(env, args[PARAM_1], &parentContainerID); + + // 获取父容器主轴方向ID + int directionID; + napi_get_value_int32(env, args[PARAM_2], &directionID); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 根据入参创建相应的父容器 + auto parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + + switch (parentContainerID) { + case PARAM_1: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_2: + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_3: + parentContainer = nodeAPI->createNode(ARKUI_NODE_FLEX); + break; + + default: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + } + + // 当布局为flex时根据入参创建相应的主轴方向 + auto direction = ARKUI_FLEX_DIRECTION_ROW; + + if (PARAM_3 == parentContainerID) { + switch (directionID) { + case PARAM_1: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + case PARAM_2: + direction = ARKUI_FLEX_DIRECTION_COLUMN; + break; + case PARAM_3: + direction = ARKUI_FLEX_DIRECTION_ROW_REVERSE; + break; + case PARAM_4: + direction = ARKUI_FLEX_DIRECTION_COLUMN_REVERSE; + break; + + default: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + } + } + + // 创建目标组件 + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 创建场景占位组件 + auto customCompare = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 添加目标组件和占位组件到父容器 + nodeAPI->addChild(parentContainer, custom); + nodeAPI->addChild(parentContainer, customCompare); + + // 设置父容器背景颜色 + ArkUI_NumberValue parent_background_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem parent_background_value_item = {parent_background_value, + sizeof(parent_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_BACKGROUND_COLOR, &parent_background_value_item); + + // 设置父容器宽 + ArkUI_NumberValue parent_width_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_width_item = {parent_width_value, + sizeof(parent_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_WIDTH, &parent_width_item); + + // 设置父容器高 + ArkUI_NumberValue parent_height_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_height_item = {parent_height_value, + sizeof(parent_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_HEIGHT, &parent_height_item); + + // 当父容器为flex时,设置主轴方向 direction + if (parentContainerID == PARAM_3) { + ArkUI_NumberValue parent_direction_value[] = {{.i32 = direction}}; + ArkUI_AttributeItem parent_direction_item = {parent_direction_value, + sizeof(parent_direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_FLEX_OPTION, &parent_direction_item); + } + + // 设置占位组件背景颜色 + ArkUI_NumberValue compare_background_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem compare_background_value_item = {compare_background_value, + sizeof(compare_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompare, NODE_BACKGROUND_COLOR, &compare_background_value_item); + + // 设置占位组件宽 + ArkUI_NumberValue compare_width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_width_item = {compare_width_value, + sizeof(compare_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompare, NODE_WIDTH, &compare_width_item); + + // 设置占位组件高 + ArkUI_NumberValue compare_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_height_item = {compare_height_value, + sizeof(compare_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompare, NODE_HEIGHT, &compare_height_item); + + // 设置目标组件背景颜色 + ArkUI_NumberValue background_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_value_item); + + // 设置目标组件宽 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置目标组件高 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置目标组件测试属性flexbasis + ArkUI_NumberValue value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_FLEX_BASIS, &item); + + // 挂载组件 + std::string IDParentContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDParentContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFlexBasisTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexbasis_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexbasis_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bd2b4e5ee378de0b9715afeb9b333bc3be95f244 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexbasis_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FLEXBASIS_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FLEXBASIS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentFlexBasisTest { +public: + ~CustomComponentFlexBasisTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FLEXBASIS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexgrow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexgrow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..017130c3fe982b3ee9126fef8751ac80353e7416 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexgrow_test.cpp @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "customcomponent_flexgrow_test.h" + +namespace ArkUICApiDemo { + +napi_value CustomComponentFlexGrowTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFlexGrowTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFlexGrowTest", + "GetContext env or info is null"); + return nullptr; + } + + // 获取入参 + size_t argc = PARAM_3; + napi_value args[PARAM_3] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 获取父容器ID + int parentContainerID; + napi_get_value_int32(env, args[PARAM_1], &parentContainerID); + + // 获取父容器主轴方向ID + int directionID; + napi_get_value_int32(env, args[PARAM_2], &directionID); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 根据入参创建相应的父容器 + auto parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + + switch (parentContainerID) { + case PARAM_1: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_2: + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_3: + parentContainer = nodeAPI->createNode(ARKUI_NODE_FLEX); + break; + + default: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + } + + // 当布局为flex时根据入参创建相应的主轴方向 + auto direction = ARKUI_FLEX_DIRECTION_ROW; + + if (PARAM_3 == parentContainerID) { + switch (directionID) { + case PARAM_1: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + case PARAM_2: + direction = ARKUI_FLEX_DIRECTION_COLUMN; + break; + case PARAM_3: + direction = ARKUI_FLEX_DIRECTION_ROW_REVERSE; + break; + case PARAM_4: + direction = ARKUI_FLEX_DIRECTION_COLUMN_REVERSE; + break; + + default: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + } + } + + // 创建目标组件 + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 创建场景占位组件 + auto customCompare = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 创建设置flexgrow属性的场景占位组件 + auto customCompareFlexGrow = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 添加目标组件和占位组件到父容器 + nodeAPI->addChild(parentContainer, custom); + nodeAPI->addChild(parentContainer, customCompare); + nodeAPI->addChild(parentContainer, customCompareFlexGrow); + + // 设置父容器背景颜色 + ArkUI_NumberValue parent_background_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem parent_background_value_item = {parent_background_value, + sizeof(parent_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_BACKGROUND_COLOR, &parent_background_value_item); + + // 设置父容器宽 + ArkUI_NumberValue parent_width_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_width_item = {parent_width_value, + sizeof(parent_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_WIDTH, &parent_width_item); + + // 设置父容器高 + ArkUI_NumberValue parent_height_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_height_item = {parent_height_value, + sizeof(parent_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_HEIGHT, &parent_height_item); + + // 当父容器为flex时,设置主轴方向 direction + if (parentContainerID == PARAM_3) { + ArkUI_NumberValue parent_direction_value[] = {{.i32 = direction}}; + ArkUI_AttributeItem parent_direction_item = {parent_direction_value, + sizeof(parent_direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_FLEX_OPTION, &parent_direction_item); + } + + // 设置占位组件背景颜色 + ArkUI_NumberValue compare_background_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem compare_background_value_item = {compare_background_value, + sizeof(compare_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompare, NODE_BACKGROUND_COLOR, &compare_background_value_item); + + // 设置占位组件宽 + ArkUI_NumberValue compare_width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_width_item = {compare_width_value, + sizeof(compare_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompare, NODE_WIDTH, &compare_width_item); + + // 设置占位组件高 + ArkUI_NumberValue compare_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_height_item = {compare_height_value, + sizeof(compare_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompare, NODE_HEIGHT, &compare_height_item); + + // 设置带有flexgrow属性的场景占位组件背景颜色 + ArkUI_NumberValue compare_flexgrow_background_value[] = {{.u32 = COLOR_PURPLE}}; + ArkUI_AttributeItem compare_flexgrow_background_value_item = { + compare_flexgrow_background_value, sizeof(compare_flexgrow_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompareFlexGrow, NODE_BACKGROUND_COLOR, &compare_flexgrow_background_value_item); + + // 设置带有flexgrow属性的场景占位组件宽 + ArkUI_NumberValue compare_flexgrow_width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_flexgrow_width_item = { + compare_flexgrow_width_value, sizeof(compare_flexgrow_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompareFlexGrow, NODE_WIDTH, &compare_flexgrow_width_item); + + // 设置带有flexgrow属性的场景占位组件高 + ArkUI_NumberValue compare_flexgrow_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_flexgrow_height_item = { + compare_flexgrow_height_value, sizeof(compare_flexgrow_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompareFlexGrow, NODE_HEIGHT, &compare_flexgrow_height_item); + + // 设置带有flexgrow属性的场景占位组件的flexgrow + ArkUI_NumberValue compare_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem compare_item = {compare_value, sizeof(compare_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompareFlexGrow, NODE_FLEX_GROW, &compare_item); + + // 设置目标组件背景颜色 + ArkUI_NumberValue background_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_value_item); + + // 设置目标组件宽 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置目标组件高 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置目标组件测试属性flexgrow + ArkUI_NumberValue value[] = {{.f32 = PARAM_3}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_FLEX_GROW, &item); + + // 挂载组件 + std::string IDParentContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDParentContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFlexGrowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexgrow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexgrow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..344059364b2a56b6e61709f28dbbb45f75f97d3c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexgrow_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FLEXGROW_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FLEXGROW_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentFlexGrowTest { +public: + ~CustomComponentFlexGrowTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FLEXGROW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexshrink_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexshrink_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..153b2ad8f49100ef72cb2acc876a7edf298bcfcb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexshrink_test.cpp @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "common/common.h" +#include "customcomponent_flexshrink_test.h" + +namespace ArkUICApiDemo { + +napi_value CustomComponentFlexShrinkTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFlexShrinkTest", "CreateNativeNode"); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFlexShrinkTest", + "GetContext env or info is null"); + return nullptr; + } + + // 获取入参 + size_t argc = PARAM_3; + napi_value args[PARAM_3] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + // 获取父容器ID + int parentContainerID; + napi_get_value_int32(env, args[PARAM_1], &parentContainerID); + + // 获取父容器主轴方向ID + int directionID; + napi_get_value_int32(env, args[PARAM_2], &directionID); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 根据入参创建相应的父容器 + auto parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + + switch (parentContainerID) { + case PARAM_1: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + case PARAM_2: + parentContainer = nodeAPI->createNode(ARKUI_NODE_COLUMN); + break; + case PARAM_3: + parentContainer = nodeAPI->createNode(ARKUI_NODE_FLEX); + break; + + default: + parentContainer = nodeAPI->createNode(ARKUI_NODE_ROW); + break; + } + + // 当布局为flex时根据入参创建相应的主轴方向 + int direction = ARKUI_FLEX_DIRECTION_ROW; + + if (PARAM_3 == parentContainerID) { + switch (directionID) { + case PARAM_1: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + case PARAM_2: + direction = ARKUI_FLEX_DIRECTION_COLUMN; + break; + case PARAM_3: + direction = ARKUI_FLEX_DIRECTION_ROW_REVERSE; + break; + case PARAM_4: + direction = ARKUI_FLEX_DIRECTION_COLUMN_REVERSE; + break; + + default: + direction = ARKUI_FLEX_DIRECTION_ROW; + break; + } + } + + // 创建目标组件 + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 创建场景占位组件 + auto customCompare = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 创建设置flexshrink属性的场景占位组件 + auto customCompareFlexGrow = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 添加目标组件和占位组件到父容器 + nodeAPI->addChild(parentContainer, custom); + nodeAPI->addChild(parentContainer, customCompare); + nodeAPI->addChild(parentContainer, customCompareFlexGrow); + + // 设置父容器背景颜色 + ArkUI_NumberValue parent_background_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem parent_background_value_item = {parent_background_value, + sizeof(parent_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_BACKGROUND_COLOR, &parent_background_value_item); + + // 设置父容器宽 + ArkUI_NumberValue parent_width_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_width_item = {parent_width_value, + sizeof(parent_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_WIDTH, &parent_width_item); + + // 设置父容器高 + ArkUI_NumberValue parent_height_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem parent_height_item = {parent_height_value, + sizeof(parent_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_HEIGHT, &parent_height_item); + + // 当父容器为flex时,设置主轴方向 direction + if (parentContainerID == PARAM_3) { + ArkUI_NumberValue parent_direction_value[] = {{.i32 = direction}}; + ArkUI_AttributeItem parent_direction_item = {parent_direction_value, + sizeof(parent_direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentContainer, NODE_FLEX_OPTION, &parent_direction_item); + } + + // 设置占位组件背景颜色 + ArkUI_NumberValue compare_background_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem compare_background_value_item = {compare_background_value, + sizeof(compare_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompare, NODE_BACKGROUND_COLOR, &compare_background_value_item); + + // 设置占位组件宽 + ArkUI_NumberValue compare_width_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem compare_width_item = {compare_width_value, + sizeof(compare_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompare, NODE_WIDTH, &compare_width_item); + + // 设置占位组件高 + ArkUI_NumberValue compare_height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem compare_height_item = {compare_height_value, + sizeof(compare_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompare, NODE_HEIGHT, &compare_height_item); + + // 设置带有flexshrink属性的场景占位组件背景颜色 + ArkUI_NumberValue compare_flexshrink_background_value[] = {{.u32 = COLOR_PURPLE}}; + ArkUI_AttributeItem compare_flexshrink_background_value_item = { + compare_flexshrink_background_value, sizeof(compare_flexshrink_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompareFlexGrow, NODE_BACKGROUND_COLOR, &compare_flexshrink_background_value_item); + + // 设置带有flexshrink属性的场景占位组件宽 + ArkUI_NumberValue compare_flexshrink_width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_flexshrink_width_item = { + compare_flexshrink_width_value, sizeof(compare_flexshrink_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompareFlexGrow, NODE_WIDTH, &compare_flexshrink_width_item); + + // 设置带有flexshrink属性的场景占位组件高 + ArkUI_NumberValue compare_flexshrink_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem compare_flexshrink_height_item = { + compare_flexshrink_height_value, sizeof(compare_flexshrink_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompareFlexGrow, NODE_HEIGHT, &compare_flexshrink_height_item); + + // 设置带有flexshrink属性的场景占位组件的flexshrink + ArkUI_NumberValue compare_value[] = {{.f32 = PARAM_3}}; + ArkUI_AttributeItem compare_item = {compare_value, sizeof(compare_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customCompareFlexGrow, NODE_FLEX_SHRINK, &compare_item); + + // 设置目标组件背景颜色 + ArkUI_NumberValue background_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_value_item); + + // 设置目标组件宽 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置目标组件高 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置目标组件测试属性flexshrink + ArkUI_NumberValue value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_FLEX_SHRINK, &item); + + // 挂载组件 + std::string IDParentContainer(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(IDParentContainer), + parentContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFlexShrinkTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexshrink_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexshrink_test.h new file mode 100644 index 0000000000000000000000000000000000000000..58bfe7f581d175ae306a928dafc4cd33d1b2a466 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_flexshrink_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FLEXSHRINK_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FLEXSHRINK_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentFlexShrinkTest { +public: + ~CustomComponentFlexShrinkTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FLEXSHRINK_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_focusable_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_focusable_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c14e5226e06d19cd5e83f981edde452fb8345afe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_focusable_test.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_focusable_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool focusable) +{ + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue focusable_value[] = {{.i32 = focusable}}; + ArkUI_AttributeItem focusable_item = {focusable_value, sizeof(focusable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_FOCUSABLE, &focusable_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(custom, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(custom, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + return custom; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentFocusableTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFocusableTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentFocusableTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_FOCUS_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CustomComponentFocusableTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentFocusableTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFocusableTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = createChildNode(nodeAPI, true); + auto customCompare = createChildNode(nodeAPI, true); + auto customDisable = createChildNode(nodeAPI, false); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "FocusableTestCustomComponent"; + nodeAPI->setAttribute(custom, NODE_ID, &id_item); + id_item.string = "FocusableTestCustomComponentCompare"; + nodeAPI->setAttribute(customCompare, NODE_ID, &id_item); + id_item.string = "FocusableTestCustomComponentDisable"; + nodeAPI->setAttribute(customDisable, NODE_ID, &id_item); + + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, customCompare); + nodeAPI->addChild(column, customDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentFocusableTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_focusable_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_focusable_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6e4869778656f0c7841386792333340c61728342 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_focusable_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FOCUSABLE_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FOCUSABLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentFocusableTest { +public: + ~CustomComponentFocusableTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FOCUSABLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_foregroundblurstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_foregroundblurstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e11fa6a002cc721c78eae3d8b2176ab8c4fed5c2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_foregroundblurstyle_test.cpp @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_foregroundblurstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem background_image_value_item = {.string = "./resources/base/media/rectIcon.png"}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &background_image_value_item); + + return nodeHandle; +} + +static auto createChildNodeWithBlurStyle(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t blurStyle) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = blurStyle}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithThemeColorMode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t themeColorMode) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {.i32 = themeColorMode}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithAdaptiveColor(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t adaptiveColor) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {}, {.i32 = adaptiveColor}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithGrayScaleBlack(ArkUI_NativeNodeAPI_1 *nodeAPI, float grayScale) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {}, {}, {}, {.f32 = grayScale}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithGrayScaleWhite(ArkUI_NativeNodeAPI_1 *nodeAPI, float grayScale) +{ + auto nodeHandle = createChildNode(nodeAPI); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, {}, {}, {}, {}, {.f32 = grayScale}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +static auto createChildNodeWithNormalValue(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = createChildNode(nodeAPI); + ArkUI_NumberValue values[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_AVERAGE}, + {.f32 = 0.5}, + {.f32 = 20}, + {.f32 = 20}}; + ArkUI_AttributeItem item = {values, sizeof(values) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOREGROUND_BLUR_STYLE, &item); + + return nodeHandle; +} + +napi_value CustomComponentForegroundBlurStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentForegroundBlurStyleTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentForegroundBlurStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + ArkUI_NumberValue flexOptions[] = {{.i32 = ARKUI_FLEX_DIRECTION_ROW}, + {.i32 = ARKUI_FLEX_WRAP_WRAP}, + {.i32 = ARKUI_FLEX_ALIGNMENT_START}, + {.i32 = ARKUI_ITEM_ALIGNMENT_START}, + {.i32 = ARKUI_FLEX_ALIGNMENT_START}}; + ArkUI_AttributeItem flexOptionsItem = {flexOptions, sizeof(flexOptions) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_FLEX_OPTION, &flexOptionsItem); + + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_REGULAR)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_REGULAR)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_NONE)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_THIN)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_REGULAR)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK)); + nodeAPI->addChild(flex, createChildNodeWithBlurStyle(nodeAPI, ENUM_ABNORMAL_VALUE)); + + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ARKUI_COLOR_MODE_SYSTEM)); + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ARKUI_COLOR_MODE_LIGHT)); + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ARKUI_COLOR_MODE_DARK)); + nodeAPI->addChild(flex, createChildNodeWithThemeColorMode(nodeAPI, ENUM_ABNORMAL_VALUE)); + + nodeAPI->addChild(flex, createChildNodeWithAdaptiveColor(nodeAPI, ARKUI_ADAPTIVE_COLOR_DEFAULT)); + nodeAPI->addChild(flex, createChildNodeWithAdaptiveColor(nodeAPI, ARKUI_ADAPTIVE_COLOR_AVERAGE)); + nodeAPI->addChild(flex, createChildNodeWithAdaptiveColor(nodeAPI, ENUM_ABNORMAL_VALUE)); + + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, -1)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 0)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 20)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 127)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleBlack(nodeAPI, 200)); + + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, -1)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 0)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 20)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 127)); + nodeAPI->addChild(flex, createChildNodeWithGrayScaleWhite(nodeAPI, 200)); + + nodeAPI->addChild(flex, createChildNodeWithNormalValue(nodeAPI)); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), flex) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentForegroundBlurStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_foregroundblurstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_foregroundblurstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a6466bdc9ffcfe0b8ad07846ca0cfd5e93b171a3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_foregroundblurstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FOREGROUNDBLURSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FOREGROUNDBLURSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentForegroundBlurStyleTest { +public: + ~CustomComponentForegroundBlurStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_FOREGROUNDBLURSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_grayscale_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_grayscale_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4aa9da3ea8a004e935041c5c144e114636b5eefd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_grayscale_test.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_grayscale_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle CustomComponentGrayscaleTest::CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, float width, + float height, float grayscale) +{ + uint32_t background_color = 0xFFFF0000; + + auto custom = node_api->createNode(ARKUI_NODE_CUSTOM); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件灰度 + ArkUI_NumberValue grayscale_value[] = {{.f32 = grayscale}}; + ArkUI_AttributeItem grayscale_item = {grayscale_value, sizeof(grayscale_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_GRAY_SCALE, &grayscale_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + return custom; +} + +napi_value CustomComponentGrayscaleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentGrayscaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentGrayscaleTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 450}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + float grayscale = 0; + float width = 50; + float height = 50; + auto custom = CreateSubCustomNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + grayscale = 0.5; + width = 60; + height = 60; + custom = CreateSubCustomNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + grayscale = 0.8; + width = 70; + height = 70; + custom = CreateSubCustomNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + grayscale = 1; + width = 80; + height = 80; + custom = CreateSubCustomNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + grayscale = -1; + width = 90; + height = 90; + custom = CreateSubCustomNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + grayscale = 2; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, grayscale); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentGrayscaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_grayscale_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_grayscale_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2e2226fbb8bfc5b468ece4bfb4813c48a5545c2f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_grayscale_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_GRAYSCALE_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_GRAYSCALE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentGrayscaleTest { +public: + ~CustomComponentGrayscaleTest(); + static ArkUI_NodeHandle CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float opacity); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_GRAYSCALE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fc9db3c543f07fc02f5a3feafff81884bbb9f9de --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_height_test.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentHeightTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto largeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto abnormalCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(row, custom); + nodeAPI->addChild(row, abnormalCustom); + nodeAPI->addChild(row, largeCustom); + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置abnormalCustom组件宽度 + nodeAPI->setAttribute(abnormalCustom, NODE_WIDTH, &width_item); + + // 设置abnormalCustom组件高度 + ArkUI_NumberValue large_height_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem large_height_item = {large_height_value, + sizeof(large_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalCustom, NODE_HEIGHT, &large_height_item); + + // 设置abnormalCustom组件背景色 + ArkUI_NumberValue abnormal_background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem abnormal_background_color_item = { + abnormal_background_color_value, sizeof(abnormal_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalCustom, NODE_BACKGROUND_COLOR, &abnormal_background_color_item); + + // 设置largeCustom组件宽度 + nodeAPI->setAttribute(largeCustom, NODE_WIDTH, &width_item); + + // 设置largeCustom组件高度 + ArkUI_NumberValue abnormal_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem abnormal_height_item = {abnormal_height_value, + sizeof(abnormal_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(largeCustom, NODE_HEIGHT, &abnormal_height_item); + + // 设置largeCustom组件背景色 + ArkUI_NumberValue large_background_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem large_background_color_item = { + large_background_color_value, sizeof(large_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(largeCustom, NODE_BACKGROUND_COLOR, &large_background_color_item); + + // row组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ed73ee9eae8231a2029b0dc9e308f350d31208ca --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_height_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentHeightTest { +public: + ~CustomComponentHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_hittestbehavior_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_hittestbehavior_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e10dbc73caf02137997620496b0df4ca72384f9a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_hittestbehavior_test.cpp @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "customcomponent_hittestbehavior_test.h" +#include + +#define CUSTOM_ON_TOUCH_EVENT_ID 7001 +#define CUSTOM_BROTHER_ON_TOUCH_EVENT_ID 7002 +#define COLUMN_ON_TOUCH_EVENT_ID 7003 + +namespace ArkUICApiDemo { + +void CustomComponentHitTestBehaviorTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t backgroundColor = 0xFF0000FF; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == CUSTOM_ON_TOUCH_EVENT_ID) { + backgroundColor = 0xFF0000FF; + } else if (eventId == CUSTOM_BROTHER_ON_TOUCH_EVENT_ID) { + backgroundColor = 0xFF000000; + } else { + backgroundColor = 0xFFFFFFFF; + } + + if ((eventId == CUSTOM_ON_TOUCH_EVENT_ID) || (eventId == CUSTOM_BROTHER_ON_TOUCH_EVENT_ID) || + (eventId == COLUMN_ON_TOUCH_EVENT_ID)) { + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &backgroundColorItem); + return; + } +} + +ArkUI_NodeHandle CustomComponentHitTestBehaviorTest::CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, + int32_t hitTestBehavior, + const char *onTouchTestStack, + const char *onTouchTestCustomComponent, + const char *onTouchTestCustomComponentBrother) +{ + float stackWidth = 100; + float stackHeight = 100; + float customWidth = 60; + float customHeight = 60; + float customBrotherWidth = 80; + float customBrotherHeight = 80; + float columnWidth = 40; + float columnHeight = 40; + uint32_t stackBackgroundColor = 0xFF888888; + uint32_t customBackgroundColor = 0xFFFF0000; + uint32_t customBrotherBackgroundColor = 0xFF00FF00; + uint32_t columnBackgroundColor = 0xFFFF11FF; + // 创建组件 + auto stack = node_api->createNode(ARKUI_NODE_STACK); + auto customBrother = node_api->createNode(ARKUI_NODE_CUSTOM); + auto custom = node_api->createNode(ARKUI_NODE_CUSTOM); + auto column = node_api->createNode(ARKUI_NODE_COLUMN); + // 设置组件Id + ArkUI_AttributeItem idItem = {}; + idItem.string = onTouchTestStack; + node_api->setAttribute(stack, NODE_ID, &idItem); + + // 设置组件大小 + ArkUI_NumberValue stackWidthValue[] = {{.f32 = stackWidth}}; + ArkUI_AttributeItem stackWidthItem = {stackWidthValue, sizeof(stackWidthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &stackWidthItem); + + ArkUI_NumberValue stackHeightValue[] = {{.f32 = stackHeight}}; + ArkUI_AttributeItem stackHeightItem = {stackHeightValue, sizeof(stackHeightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &stackHeightItem); + + // 设置组件背景色 + ArkUI_NumberValue stackBackgroundColorValue[] = {{.u32 = stackBackgroundColor}}; + ArkUI_AttributeItem stackBackgroundColorItem = {stackBackgroundColorValue, + sizeof(stackBackgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &stackBackgroundColorItem); + + // 设置组件大小 + ArkUI_NumberValue customWidthValue[] = {{.f32 = customWidth}}; + ArkUI_AttributeItem customWidthItem = {customWidthValue, sizeof(customWidthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_WIDTH, &customWidthItem); + + ArkUI_NumberValue customHeightValue[] = {{.f32 = customHeight}}; + ArkUI_AttributeItem customHeightItem = {customHeightValue, sizeof(customHeightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_HEIGHT, &customHeightItem); + + // 设置组件背景色 + ArkUI_NumberValue customBackgroundColorValue[] = {{.u32 = customBackgroundColor}}; + ArkUI_AttributeItem customBackgroundColorItem = {customBackgroundColorValue, + sizeof(customBackgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_BACKGROUND_COLOR, &customBackgroundColorItem); + + ArkUI_NumberValue customBrotherHitTestBehaviorValue[] = {{.i32 = hitTestBehavior}}; + ArkUI_AttributeItem customBrotherHitTestBehaviorItem = { + customBrotherHitTestBehaviorValue, sizeof(customBrotherHitTestBehaviorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_HIT_TEST_BEHAVIOR, &customBrotherHitTestBehaviorItem); + + // 绑定组件 + node_api->registerNodeEvent(custom, NODE_TOUCH_EVENT, CUSTOM_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CUSTOM_ON_TOUCH_EVENT_ID", "CUSTOM_ON_TOUCH_EVENT_ID"); + + // 设置组件大小 + ArkUI_NumberValue customBrotherWidthValue[] = {{.f32 = customBrotherWidth}}; + ArkUI_AttributeItem customBrotherWidthItem = {customBrotherWidthValue, + sizeof(customBrotherWidthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(customBrother, NODE_WIDTH, &customBrotherWidthItem); + + ArkUI_NumberValue customBrotherHeightValue[] = {{.f32 = customBrotherHeight}}; + ArkUI_AttributeItem customBrotherHeightItem = {customBrotherHeightValue, + sizeof(customBrotherHeightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(customBrother, NODE_HEIGHT, &customBrotherHeightItem); + + // 设置组件背景色 + ArkUI_NumberValue customBrotherBackgroundColorValue[] = {{.u32 = customBrotherBackgroundColor}}; + ArkUI_AttributeItem customBrotherBackgroundColorItem = { + customBrotherBackgroundColorValue, sizeof(customBrotherBackgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(customBrother, NODE_BACKGROUND_COLOR, &customBrotherBackgroundColorItem); + + // 绑定组件 + node_api->registerNodeEvent(customBrother, NODE_TOUCH_EVENT, CUSTOM_BROTHER_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CUSTOM_BROTHER_ON_TOUCH_EVENT_ID", + "CUSTOM_BROTHER_ON_TOUCH_EVENT_ID"); + // 设置组件大小 + ArkUI_NumberValue columnWidthValue[] = {{.f32 = columnWidth}}; + ArkUI_AttributeItem columnWidthItem = {columnWidthValue, sizeof(columnWidthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(column, NODE_WIDTH, &columnWidthItem); + + ArkUI_NumberValue columnHeightValue[] = {{.f32 = columnHeight}}; + ArkUI_AttributeItem columnHeightItem = {columnHeightValue, sizeof(columnHeightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(column, NODE_HEIGHT, &columnHeightItem); + + ArkUI_NumberValue columnHittestbehaviorValue[] = {{.i32 = ARKUI_HIT_TEST_MODE_TRANSPARENT}}; + ArkUI_AttributeItem columnHittestbehaviorItem = {columnHittestbehaviorValue, + sizeof(columnHittestbehaviorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(column, NODE_HIT_TEST_BEHAVIOR, &columnHittestbehaviorItem); + + // 设置组件背景色 + ArkUI_NumberValue columnBackgroundColorValue[] = {{.u32 = columnBackgroundColor}}; + ArkUI_AttributeItem columnBackgroundColorItem = {columnBackgroundColorValue, + sizeof(columnBackgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(column, NODE_BACKGROUND_COLOR, &columnBackgroundColorItem); + // 绑定组件 + node_api->registerNodeEvent(column, NODE_TOUCH_EVENT, COLUMN_ON_TOUCH_EVENT_ID, nullptr); + // 添加组件到容器组件 + node_api->addChild(stack, customBrother); + // 添加组件到容器组件 + node_api->addChild(stack, custom); + // 添加组件到容器组件 + node_api->addChild(custom, column); + + return stack; +} + +napi_value CustomComponentHitTestBehaviorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentHitTestBehaviorTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建组件对象 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_DEFAULT; + string onTouchTestStack = "OnTouchTestStackDefault"; + string onTouchTestCustomComponent = "OnTouchTestCustomComponentDefault"; + string onTouchTestCustomComponentBrother = "OnTouchTestCustomComponentBrotherDefault"; + auto stack = CreateSubCustomNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), + onTouchTestCustomComponent.c_str(), onTouchTestCustomComponentBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_BLOCK; + onTouchTestStack = "OnTouchTestStackBlock"; + onTouchTestCustomComponent = "OnTouchTestCustomComponentBlock"; + onTouchTestCustomComponentBrother = "OnTouchTestCustomComponentBrotherBlock"; + stack = CreateSubCustomNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), onTouchTestCustomComponent.c_str(), + onTouchTestCustomComponentBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_TRANSPARENT; + onTouchTestStack = "OnTouchTestStackTransparent"; + onTouchTestCustomComponent = "OnTouchTestCustomComponentTransparent"; + onTouchTestCustomComponentBrother = "OnTouchTestCustomComponentBrotherTransparent"; + stack = CreateSubCustomNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), onTouchTestCustomComponent.c_str(), + onTouchTestCustomComponentBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_NONE; + onTouchTestStack = "OnTouchTestStackNone"; + onTouchTestCustomComponent = "OnTouchTestCustomComponentNone"; + onTouchTestCustomComponentBrother = "OnTouchTestCustomComponentBrotherNone"; + stack = CreateSubCustomNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), onTouchTestCustomComponent.c_str(), + onTouchTestCustomComponentBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + hitTestBehavior = PARAM_NEGATIVE_1; + onTouchTestStack = "OnTouchTestStackExceptBelow"; + onTouchTestCustomComponent = "OnTouchTestCustomComponentExceptBelow"; + onTouchTestCustomComponentBrother = "OnTouchTestCustomComponentBrotherExceptBelow"; + stack = CreateSubCustomNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), onTouchTestCustomComponent.c_str(), + onTouchTestCustomComponentBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + hitTestBehavior = PARAM_4; + onTouchTestStack = "OnTouchTestStackExceptAbove"; + onTouchTestCustomComponent = "OnTouchTestCustomComponentExceptAbove"; + onTouchTestCustomComponentBrother = "OnTouchTestCustomComponentBrotherExceptAbove"; + stack = CreateSubCustomNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str(), onTouchTestCustomComponent.c_str(), + onTouchTestCustomComponentBrother.c_str()); + // 添加组件到容器组件 + nodeAPI->addChild(column, stack); + + // 绑定事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 绑定事件 + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_hittestbehavior_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_hittestbehavior_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f252fbfd540e2f2ab39c9bd4fee9f732778267ad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_hittestbehavior_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_HITTESTBEHAVIOR_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_HITTESTBEHAVIOR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class CustomComponentHitTestBehaviorTest { +public: + ~CustomComponentHitTestBehaviorTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t hitTestBehavior, + const char *onTouchTestStack, const char *onTouchTestCustomComponent, + const char *onTouchTestCustomComponentBrother); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_HITTESTBEHAVIOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_id_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_id_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5a837d67b2b79468589892283b805ac5a52a1d25 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_id_test.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "customcomponent_id_test.h" +#include + +#define CUSTOM_FIRST_ON_TOUCH_EVENT_ID 7001 +#define CUSTOM_SECOND_ON_TOUCH_EVENT_ID 7002 + +namespace ArkUICApiDemo { + +void CustomComponentIdTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t backgroundColor = 0xFF0000FF; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == CUSTOM_FIRST_ON_TOUCH_EVENT_ID) { + backgroundColor = 0xFF0000FF; + } else { + backgroundColor = 0xFF000000; + } + + if ((eventId == CUSTOM_FIRST_ON_TOUCH_EVENT_ID) || (eventId == CUSTOM_SECOND_ON_TOUCH_EVENT_ID)) { + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &backgroundColorItem); + return; + } +} + +ArkUI_NodeHandle CustomComponentIdTest::CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, const char *id, + uint32_t eventId) +{ + float width = 200; + float height = 200; + uint32_t backgroundColor = 0xFFFF0000; + + // 创建组件 + auto custom = node_api->createNode(ARKUI_NODE_CUSTOM); + + // 设置组件Id + ArkUI_AttributeItem idItem = {}; + idItem.string = id; + node_api->setAttribute(custom, NODE_ID, &idItem); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_HEIGHT, &heightItem); + + // 设置组件背景色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + // 绑定组件事件 + node_api->registerNodeEvent(custom, NODE_TOUCH_EVENT, eventId, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CUSTOM_ON_TOUCH_EVENT_ID", "CUSTOM_ON_TOUCH_EVENT_ID"); + + return custom; +} + +napi_value CustomComponentIdTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentIdTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentIdTest", "GetConcustom env or info is null"); + return nullptr; + } + // 创建组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t commonAttrsFirstEventId = CUSTOM_FIRST_ON_TOUCH_EVENT_ID; + const char *commonAttrsFirstId = "onTouchFirst"; + ; + auto custom = CreateSubCustomNode(nodeAPI, commonAttrsFirstId, commonAttrsFirstEventId); + // 添加组件到容器组件 + nodeAPI->addChild(column, custom); + + int32_t commonAttrsSecondEventId = CUSTOM_SECOND_ON_TOUCH_EVENT_ID; + const char *commonAttrsSecondId = "onTouchSecond"; + ; + custom = CreateSubCustomNode(nodeAPI, commonAttrsSecondId, commonAttrsSecondEventId); + // 添加组件到容器组件 + nodeAPI->addChild(column, custom); + + // bind node callBack event receiver + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 绑定组件 + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentIdTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_id_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_id_test.h new file mode 100644 index 0000000000000000000000000000000000000000..4af90243714ab5f693ecb6974a67635df8098000 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_id_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ID_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ID_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class CustomComponentIdTest { +public: + ~CustomComponentIdTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, const char *id, uint32_t eventId); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ID_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_invert_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_invert_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e4603de010e70ef98f41db602f8f47bc0192c3d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_invert_test.cpp @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_invert_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle CustomComponentInvertTest::CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, float width, + float height, float invert) +{ + int32_t objectFit = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_NONE; + + auto custom = node_api->createNode(ARKUI_NODE_CUSTOM); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置反转输入的图像比例属性 + ArkUI_NumberValue invert_value[] = {{.f32 = invert}}; + ArkUI_AttributeItem invert_item = {invert_value, sizeof(invert_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_INVERT, &invert_item); + + // 设置组件图片填充效果属性 + ArkUI_NumberValue objectFitValue[] = {{.i32 = objectFit}}; + ArkUI_AttributeItem objectFitItem = {objectFitValue, sizeof(objectFitValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_IMAGE_OBJECT_FIT, &objectFitItem); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(custom, NODE_BACKGROUND_IMAGE, &src_item); + + return custom; +} + +napi_value CustomComponentInvertTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentInvertTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentInvertTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float invert = 0; + float width = 100; + float height = 100; + auto custom = CreateSubCustomNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + invert = 0.5; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + invert = 0.8; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + invert = 1; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + invert = -1; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + invert = 2; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, invert); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentInvertTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_invert_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_invert_test.h new file mode 100644 index 0000000000000000000000000000000000000000..101aa24c763570d35b4e0a5a255cf0bff0e278ba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_invert_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_INVERT_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_INVERT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentInvertTest { +public: + ~CustomComponentInvertTest(); + static ArkUI_NodeHandle CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float opacity); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_INVERT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_lineargradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_lineargradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f9479b8ae28665022197e60631f46c59ade4af66 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_lineargradient_test.cpp @@ -0,0 +1,740 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_lineargradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include +namespace ArkUICApiDemo { +napi_value CustomComponentLinearGradientTest::CreateNativeNodeLeft(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_TOP}, {.i32 = true}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeRight(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeLeftTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeLeftBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeRightTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeRightBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_NONE}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeCustom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = {{.f32 = 180}, {.i32 = -1}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentLinearGradientTest::CreateNativeNodeIllegalColorAbnormal(napi_env env, + napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + unsigned int colors[] = {123, 1234}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(custom, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), custom) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_lineargradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_lineargradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fe6fc5b288a83f72006f59371fb16be0dc67fca3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_lineargradient_test.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_LINEARGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_LINEARGRADIENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentLinearGradientTest { +public: + ~CustomComponentLinearGradientTest(); + static napi_value CreateNativeNodeLeft(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRight(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLeftTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLeftBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRightTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRightBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCustom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeIllegalColorAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_LINEARGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_margin_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_margin_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c3f852902bed2ca3019bfdfa176572e8e8459665 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_margin_test.cpp @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_margin_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value CustomComponentMarginTest::CreateNativeNodeUnified(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_MARGIN, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentMarginTest::CreateNativeNodeRespectively(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = 10}, {.f32 = 20}, {.f32 = 30}, {.f32 = 40}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_MARGIN, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentMarginTest::CreateNativeNodeUnifiedNegative(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_MARGIN, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentMarginTest::CreateNativeNodeRespectivelyNegative(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childMargin_value[] = {{.f32 = -10}, {.f32 = 20}, {.f32 = -30}, {.f32 = 40}}; + ArkUI_AttributeItem childMargin_item = {childMargin_value, sizeof(childMargin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_MARGIN, &childMargin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_margin_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_margin_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9503fb99330afb97410235d7ff877bf80dae0327 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_margin_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_MARGIN_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_MARGIN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentMarginTest { +public: + ~CustomComponentMarginTest(); + static napi_value CreateNativeNodeUnified(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectively(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUnifiedNegative(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelyNegative(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_MARGIN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_mask_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_mask_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..02a0e04b20dfe2a966e0763420f6d6ee2b13e908 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_mask_test.cpp @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_mask_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentMaskTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMaskTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMaskTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置初始图片 + ArkUI_NumberValue widthValue[] = {{.f32 = 100}}; + ArkUI_NumberValue heightValue[] = {{.f32 = 100}}; + ArkUI_NumberValue customBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem customWidthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem customHeightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem customBackground_color_item = { + customBackground_color_value, sizeof(customBackground_color_value) / sizeof(ArkUI_NumberValue)}; + + auto customBase = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customBase, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customBase, NODE_HEIGHT, &customHeightItem); + nodeAPI->setAttribute(customBase, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 第一个遮罩效果图片(矩形) + auto customMaskFirst = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customMaskFirst, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customMaskFirst, NODE_HEIGHT, &customHeightItem); + + ArkUI_NumberValue maskValueFirst[] = { + {.u32 = 0xFFFF0000}, {.u32 = 0xFF000000}, {.f32 = 2}, {.i32 = ARKUI_MASK_TYPE_RECTANGLE}, + {.f32 = 100}, {.f32 = 100}, {.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem maskFirstItem = {maskValueFirst, sizeof(maskValueFirst) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customMaskFirst, NODE_MASK, &maskFirstItem); + nodeAPI->setAttribute(customMaskFirst, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 第二个遮罩效果图片(圆形) + auto customMaskSecond = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customMaskSecond, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customMaskSecond, NODE_HEIGHT, &customHeightItem); + + ArkUI_NumberValue maskValueSecond[] = {{.u32 = 0xFFFF0000}, {.u32 = 0xFF000000}, + {.f32 = 5}, {.i32 = ARKUI_MASK_TYPE_CIRCLE}, + {.f32 = 100}, {.f32 = 100}}; + ArkUI_AttributeItem maskSecondItem = {maskValueSecond, sizeof(maskValueSecond) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customMaskSecond, NODE_MASK, &maskSecondItem); + nodeAPI->setAttribute(customMaskSecond, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 第三个遮罩效果图片(椭圆形) + auto customMaskThird = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customMaskThird, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customMaskThird, NODE_HEIGHT, &customHeightItem); + + ArkUI_NumberValue maskValueThird[] = {{.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, + {.f32 = 10}, {.i32 = ARKUI_MASK_TYPE_ELLIPSE}, + {.f32 = 100}, {.f32 = 50}}; + ArkUI_AttributeItem maskThirdItem = {maskValueThird, sizeof(maskValueThird) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customMaskThird, NODE_MASK, &maskThirdItem); + nodeAPI->setAttribute(customMaskThird, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 第四个遮罩效果图片(路径) + auto customMaskFourth = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customMaskFourth, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customMaskFourth, NODE_HEIGHT, &customHeightItem); + + ArkUI_NumberValue maskValueFourth[] = {{.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, {.f32 = 10}, + {.i32 = ARKUI_MASK_TYPE_PATH}, {.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem maskFourthItem = {maskValueFourth, sizeof(maskValueFourth) / sizeof(ArkUI_NumberValue)}; + maskFourthItem.string = "M0 0 H50 V50 H0 Z"; + nodeAPI->setAttribute(customMaskFourth, NODE_MASK, &maskFourthItem); + nodeAPI->setAttribute(customMaskFourth, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 第五个遮罩效果图片(进度) + auto customMaskFifth = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customMaskFifth, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customMaskFifth, NODE_HEIGHT, &customHeightItem); + + ArkUI_NumberValue mask_value_fifth[] = { + {.i32 = ARKUI_MASK_TYPE_PROGRESS}, + {.f32 = 50}, {.f32 = 100}, {.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem mask_fifth_item = {mask_value_fifth, sizeof(mask_value_fifth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customMaskFifth, NODE_MASK, &mask_fifth_item); + nodeAPI->setAttribute(customMaskFifth, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, customBase); + nodeAPI->addChild(column, customMaskFirst); + nodeAPI->addChild(column, customMaskSecond); + nodeAPI->addChild(column, customMaskThird); + nodeAPI->addChild(column, customMaskFourth); + nodeAPI->addChild(column, customMaskFifth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMaskTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentMaskTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMaskTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMaskTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置初始图片 + ArkUI_NumberValue widthValue[] = {{.f32 = 100}}; + ArkUI_NumberValue heightValue[] = {{.f32 = 100}}; + ArkUI_NumberValue customBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem customWidthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem customHeightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem customBackground_color_item = { + customBackground_color_value, sizeof(customBackground_color_value) / sizeof(ArkUI_NumberValue)}; + auto customBase = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customBase, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customBase, NODE_HEIGHT, &customHeightItem); + nodeAPI->setAttribute(customBase, NODE_BACKGROUND_COLOR, &customBackground_color_item); + + // 宽度高度均为负值(矩形) + auto customMaskFirst = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customMaskFirst, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customMaskFirst, NODE_HEIGHT, &customHeightItem); + ArkUI_NumberValue maskValueFirst[] = { + {.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, {.f32 = -10}, {.i32 = ARKUI_MASK_TYPE_RECTANGLE}, + {.f32 = -100}, {.f32 = -100}, {.f32 = -10}, {.f32 = -10}}; + ArkUI_AttributeItem maskFirstItem = {maskValueFirst, sizeof(maskValueFirst) / sizeof(ArkUI_NumberValue)}; + auto ret = nodeAPI->setAttribute(customMaskFirst, NODE_MASK, &maskFirstItem); + nodeAPI->setAttribute(customMaskFirst, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 宽度高度均为负值(圆形) + auto customMaskSecond = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customMaskSecond, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customMaskSecond, NODE_HEIGHT, &customHeightItem); + ArkUI_NumberValue maskValueSecond[] = {{.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, + {.f32 = -10}, {.i32 = ARKUI_MASK_TYPE_CIRCLE}, + {.f32 = -100}, {.f32 = -100}}; + ArkUI_AttributeItem maskSecondItem = {maskValueSecond, sizeof(maskValueSecond) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(customMaskSecond, NODE_MASK, &maskSecondItem); + nodeAPI->setAttribute(customMaskSecond, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 宽度高度均为负值(椭圆形) + auto customMaskThird = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customMaskThird, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customMaskThird, NODE_HEIGHT, &customHeightItem); + ArkUI_NumberValue maskValueThird[] = {{.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, + {.f32 = -10}, {.i32 = ARKUI_MASK_TYPE_ELLIPSE}, + {.f32 = -100}, {.f32 = -50}}; + ArkUI_AttributeItem maskThirdItem = {maskValueThird, sizeof(maskValueThird) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(customMaskThird, NODE_MASK, &maskThirdItem); + nodeAPI->setAttribute(customMaskThird, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 宽度高度均为负值(路径) + auto customMaskFourth = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customMaskFourth, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customMaskFourth, NODE_HEIGHT, &customHeightItem); + ArkUI_NumberValue maskValueFourth[] = {{.u32 = 0xFFFF3333}, {.u32 = 0xFF000000}, {.f32 = -10}, + {.i32 = ARKUI_MASK_TYPE_PATH}, {.f32 = -100}, {.f32 = -100}}; + ArkUI_AttributeItem maskFourthItem = {maskValueFourth, sizeof(maskValueFourth) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(customMaskFourth, NODE_MASK, &maskFourthItem); + nodeAPI->setAttribute(customMaskFourth, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 进度为负值(进度) + auto customMaskFifth = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + nodeAPI->setAttribute(customMaskFifth, NODE_WIDTH, &customWidthItem); + nodeAPI->setAttribute(customMaskFifth, NODE_HEIGHT, &customHeightItem); + ArkUI_NumberValue mask_value_fifth[] = { + {.i32 = ARKUI_MASK_TYPE_PROGRESS}, + {.f32 = -50}, {.f32 = 100}, {.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem mask_fifth_item = {mask_value_fifth, sizeof(mask_value_fifth) / sizeof(ArkUI_NumberValue)}; + ret = nodeAPI->setAttribute(customMaskFifth, NODE_MASK, &mask_fifth_item); + nodeAPI->setAttribute(customMaskFifth, NODE_BACKGROUND_COLOR, &customBackground_color_item); + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, customBase); + nodeAPI->addChild(column, customMaskFirst); + nodeAPI->addChild(column, customMaskSecond); + nodeAPI->addChild(column, customMaskThird); + nodeAPI->addChild(column, customMaskFourth); + nodeAPI->addChild(column, customMaskFifth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentMaskTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_mask_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_mask_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d4967ecb4cef50add0096e5e0d9fa25726068798 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_mask_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_MASK_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_MASK_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentMaskTest { +public: + ~CustomComponentMaskTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_MASK_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onappear_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onappear_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2c08b3c111f9d403146df41cee3f339c2166dbff --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onappear_test.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_onappear_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnAppearTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnAppearTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnAppearTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_APPEAR_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CustomComponentOnAppearTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnAppearTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnAppearTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnAppearTest"; + nodeAPI->setAttribute(custom, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom, NODE_HEIGHT, &width_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(custom, NODE_EVENT_ON_APPEAR, ON_APPEAR_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnAppearTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onappear_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onappear_test.h new file mode 100644 index 0000000000000000000000000000000000000000..de8bcedca1f936c90891ce97957178de0f377833 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onappear_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONAPPEAR_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONAPPEAR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentOnAppearTest { +public: + ~CustomComponentOnAppearTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONAPPEAR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onareachange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onareachange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2ee39916105155293e84d6861294b6d1e3ba6842 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onareachange_test.cpp @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_onareachange_test.h" +#include "../manager/plugin_manager.h" +#include + +#define ON_CLICK_EVENT_ID_OFFSET 16001 + +namespace ArkUICApiDemo { + +static bool hasOnAreaChangeInit = false; + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t initialColor, int32_t clickEventID) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = initialColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, clickEventID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnAreaChangeTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnAreaChangeTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnAreaChangeTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 点击时修改目标组件宽度,或者修改兄弟组件宽度,使目标组件发生位移 + if (eventId == ON_CLICK_EVENT_ID) { + hasOnAreaChangeInit = true; + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_WIDTH, &width_item); + return; + } + + // 点击时修改目标组件offset属性 + if (eventId == ON_CLICK_EVENT_ID_OFFSET) { + hasOnAreaChangeInit = true; + ArkUI_NumberValue offset_value[] = {{.f32 = SIZE_100}, {.f32 = SIZE_100}}; + ArkUI_AttributeItem offset_item = {offset_value, sizeof(offset_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_OFFSET, &offset_item); + return; + } + + // 事件回调时,修改组件背景色 + if (hasOnAreaChangeInit && eventId == ON_AREA_CHANGE_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CustomComponentOnAreaChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnAreaChangeTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnAreaChangeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowSize = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowMove = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowOffset = nodeAPI->createNode(ARKUI_NODE_ROW); + auto customSize = createChildNode(nodeAPI, COLOR_RED, ON_CLICK_EVENT_ID); + auto customMove = createChildNode(nodeAPI, COLOR_RED, ON_CLICK_EVENT_ID); + auto customMoveCompare = createChildNode(nodeAPI, COLOR_PURPLE, ON_CLICK_EVENT_ID); + auto customOffset = createChildNode(nodeAPI, COLOR_RED, ON_CLICK_EVENT_ID_OFFSET); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnAreaChangeTestCustomComponentSize"; + nodeAPI->setAttribute(customSize, NODE_ID, &id_item); + id_item.string = "OnAreaChangeTestCustomComponentMove"; + nodeAPI->setAttribute(customMove, NODE_ID, &id_item); + id_item.string = "OnAreaChangeTestCustomComponentMoveCompare"; + nodeAPI->setAttribute(customMoveCompare, NODE_ID, &id_item); + id_item.string = "OnAreaChangeTestCustomComponentOffset"; + nodeAPI->setAttribute(customOffset, NODE_ID, &id_item); + + // 添加子组件 + nodeAPI->addChild(rowSize, customSize); + nodeAPI->addChild(rowMove, customMove); + nodeAPI->addChild(rowMove, customMoveCompare); + nodeAPI->addChild(rowOffset, customOffset); + + nodeAPI->registerNodeEvent(customSize, NODE_EVENT_ON_AREA_CHANGE, ON_AREA_CHANGE_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(customMove, NODE_EVENT_ON_AREA_CHANGE, ON_AREA_CHANGE_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(customOffset, NODE_EVENT_ON_AREA_CHANGE, ON_AREA_CHANGE_EVENT_ID, nullptr); + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + nodeAPI->addChild(column, rowSize); + nodeAPI->addChild(column, rowMove); + nodeAPI->addChild(column, rowOffset); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnAreaChangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onareachange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onareachange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..4d5d9be3ea9b8af1f17b9412864b9c01a60f6d87 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onareachange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONAREA_CHANGE_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONAREA_CHANGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentOnAreaChangeTest { +public: + ~CustomComponentOnAreaChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONAREA_CHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onblur_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onblur_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..09517872198dd8c306cb386de44e4b87cfa0fe64 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onblur_test.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_onblur_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnBlurTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnBlurTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnBlurTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_BLUR_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CustomComponentOnBlurTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnBlurTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnBlurTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = createChildNode(nodeAPI, true); + auto customCompare = createChildNode(nodeAPI, true); + auto customDisable = createChildNode(nodeAPI, false); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnBlurTestCustomComponent"; + nodeAPI->setAttribute(custom, NODE_ID, &id_item); + id_item.string = "OnBlurTestCustomComponentCompare"; + nodeAPI->setAttribute(customCompare, NODE_ID, &id_item); + id_item.string = "OnBlurTestCustomComponentDisable"; + nodeAPI->setAttribute(customDisable, NODE_ID, &id_item); + + // 添加子组件 + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, customCompare); + nodeAPI->addChild(column, customDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onblur_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onblur_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7b3aaf9ed9272f6d9a82e3ef7b87ed85fe63e1f3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onblur_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONBLUR_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONBLUR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentOnBlurTest { +public: + ~CustomComponentOnBlurTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONBLUR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onclick_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onclick_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..34474701966add674e75de5341e7f56228012563 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onclick_test.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_onclick_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue enable_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enable_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enable_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnClickTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnClickTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnClickTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_CLICK_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CustomComponentOnClickTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnClickTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnClickTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = createChildNode(nodeAPI, true); + auto customDisable = createChildNode(nodeAPI, false); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnClickTestCustomComponent"; + nodeAPI->setAttribute(custom, NODE_ID, &id_item); + id_item.string = "OnClickTestCustomComponentDisable"; + nodeAPI->setAttribute(customDisable, NODE_ID, &id_item); + + // 添加子组件 + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, customDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnClickTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onclick_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onclick_test.h new file mode 100644 index 0000000000000000000000000000000000000000..364e2aa3b0ad6f0ad479c7ab24d2568a3efc9ca4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onclick_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONCLICK_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONCLICK_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentOnClickTest { +public: + ~CustomComponentOnClickTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONCLICK_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ondraw_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ondraw_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..26e3ed844a1cc0e7a6a26a54e5bf28d591354cc3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ondraw_test.cpp @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_ondraw_test.h" +#include "../manager/plugin_manager.h" +#include +#include +#include +#include + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeCustomEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnDrawTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnDrawTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeCustomEvent_GetEventTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnDrawTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeCustomEvent_GetNodeHandle(event); + + if (eventId == ON_DRAW_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_DrawContext *drawContext = OH_ArkUI_NodeCustomEvent_GetDrawContextInDraw(event); + OH_Drawing_Canvas *canvas = reinterpret_cast(OH_ArkUI_DrawContext_GetCanvas(drawContext)); + OH_Drawing_Pen *pen = OH_Drawing_PenCreate(); + + OH_Drawing_PenSetAntiAlias(pen, true); + OH_Drawing_PenSetColor(pen, COLOR_BLUE); + OH_Drawing_PenSetWidth(pen, SIZE_30); + OH_Drawing_CanvasAttachPen(canvas, pen); + OH_Drawing_CanvasDrawLine(canvas, SIZE_10, SIZE_10, SIZE_180, SIZE_180); + OH_Drawing_PenDestroy(pen); + pen = nullptr; + } +} + +napi_value CustomComponentOnDrawTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnDrawTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnDrawTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue sizeValue[] = {{.f32 = SIZE_200}, {.f32 = SIZE_200}}; + ArkUI_AttributeItem sizeItem = {sizeValue, sizeof(sizeValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SIZE, &sizeItem); + + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnDrawTest"; + nodeAPI->setAttribute(custom, NODE_ID, &id_item); + + nodeAPI->addChild(column, custom); + + nodeAPI->registerNodeCustomEventReceiver(&OnEventReceive); + nodeAPI->registerNodeCustomEvent(custom, ARKUI_NODE_CUSTOM_EVENT_ON_DRAW, ON_DRAW_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnDrawTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ondraw_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ondraw_test.h new file mode 100644 index 0000000000000000000000000000000000000000..25b10099f15fcb4c0472589d5a6fee85bb401c69 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ondraw_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_XTS_CUSTOMCOMPONENT_ONDRAW_TEST_H +#define ARKUI_CAPI_XTS_CUSTOMCOMPONENT_ONDRAW_TEST_H + +#include "../common/common.h" +#include +#include + +#include + +namespace ArkUICApiDemo { + +class CustomComponentOnDrawTest { +public: + ~CustomComponentOnDrawTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_XTS_CUSTOMCOMPONENT_ONDRAW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onfocus_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onfocus_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1a47ed1a7b735618cb16586eeb031e66f49c5e9a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onfocus_test.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_onfocus_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnFocusTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnFocusTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnFocusTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_FOCUS_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CustomComponentOnFocusTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnFocusTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnFocusTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = createChildNode(nodeAPI, true); + auto customCompare = createChildNode(nodeAPI, true); + auto customDisable = createChildNode(nodeAPI, false); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnFocusTestCustomComponent"; + nodeAPI->setAttribute(custom, NODE_ID, &id_item); + id_item.string = "OnFocusTestCustomComponentCompare"; + nodeAPI->setAttribute(customCompare, NODE_ID, &id_item); + id_item.string = "OnFocusTestCustomComponentDisable"; + nodeAPI->setAttribute(customDisable, NODE_ID, &id_item); + + // 添加子组件 + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, customCompare); + nodeAPI->addChild(column, customDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnFocusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onfocus_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onfocus_test.h new file mode 100644 index 0000000000000000000000000000000000000000..96056ad17ae7e9451ba1276d125d273dc3bee3b4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onfocus_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONFOCUS_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONFOCUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentOnFocusTest { +public: + ~CustomComponentOnFocusTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONFOCUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onlayout_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onlayout_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..de1d5d5b1ca6f4e7e91004b3201b02a36648a79e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onlayout_test.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_onlayout_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeCustomEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnLayoutTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnLayoutTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeCustomEvent_GetEventTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnLayoutTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeCustomEvent_GetNodeHandle(event); + + if (eventId == ON_LAYOUT_EVENT_ID) { + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->layoutNode(nodeAPI->getChildAt(nodeHandler, PARAM_0), SIZE_10, SIZE_10); + nodeAPI->layoutNode(nodeAPI->getChildAt(nodeHandler, PARAM_1), SIZE_100, SIZE_100); + } +} + +napi_value CustomComponentOnLayoutTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnLayoutTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnLayoutTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto innerComponent = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto innerComponentCompare = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue innerSizeValue[] = {{.f32 = SIZE_30}, {.f32 = SIZE_30}}; + ArkUI_AttributeItem innerSizeItem = {innerSizeValue, sizeof(innerSizeValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerComponent, NODE_SIZE, &innerSizeItem); + nodeAPI->setAttribute(innerComponentCompare, NODE_SIZE, &innerSizeItem); + + ArkUI_NumberValue innerBackgroundColorValue[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem innerBackgroundColorItem = {innerBackgroundColorValue, + sizeof(innerBackgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerComponent, NODE_BACKGROUND_COLOR, &innerBackgroundColorItem); + nodeAPI->setAttribute(innerComponentCompare, NODE_BACKGROUND_COLOR, &innerBackgroundColorItem); + + ArkUI_NumberValue sizeValue[] = {{.f32 = SIZE_200}, {.f32 = SIZE_200}}; + ArkUI_AttributeItem sizeItem = {sizeValue, sizeof(sizeValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SIZE, &sizeItem); + + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnLayoutTest"; + nodeAPI->setAttribute(custom, NODE_ID, &id_item); + + nodeAPI->addChild(custom, innerComponent); + nodeAPI->addChild(custom, innerComponentCompare); + nodeAPI->addChild(column, custom); + + nodeAPI->registerNodeCustomEventReceiver(&OnEventReceive); + nodeAPI->registerNodeCustomEvent(custom, ARKUI_NODE_CUSTOM_EVENT_ON_LAYOUT, ON_LAYOUT_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnLayoutTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onlayout_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onlayout_test.h new file mode 100644 index 0000000000000000000000000000000000000000..134488ad86cd14d6eeec6ecbc06004d12cad8abf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onlayout_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_XTS_CUSTOMCOMPONENT_ONLAYOUT_TEST_H +#define ARKUI_CAPI_XTS_CUSTOMCOMPONENT_ONLAYOUT_TEST_H + +#include "../common/common.h" +#include +#include + +#include + +namespace ArkUICApiDemo { + +class CustomComponentOnLayoutTest { +public: + ~CustomComponentOnLayoutTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_XTS_CUSTOMCOMPONENT_ONLAYOUT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onmeasure_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onmeasure_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fd393298969599c7a8244ebe9edab1f1a768620f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onmeasure_test.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_onmeasure_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeCustomEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnMeasureTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnMeasureTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeCustomEvent_GetEventTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnMeasureTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeCustomEvent_GetNodeHandle(event); + + if (eventId == ON_MEASURE_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setMeasuredSize(nodeHandler, SIZE_200, SIZE_200); + } +} + +napi_value CustomComponentOnMeasureTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnMeasureTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnMeasureTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnMeasureTest"; + nodeAPI->setAttribute(custom, NODE_ID, &id_item); + + nodeAPI->addChild(column, custom); + + nodeAPI->registerNodeCustomEventReceiver(&OnEventReceive); + nodeAPI->registerNodeCustomEvent(custom, ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE, ON_MEASURE_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnMeasureTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onmeasure_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onmeasure_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1b96892aa5857ab833068aa4f8eb7dcc55ac9f63 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_onmeasure_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_XTS_CUSTOMCOMPONENT_ONMEASURE_TEST_H +#define ARKUI_CAPI_XTS_CUSTOMCOMPONENT_ONMEASURE_TEST_H + +#include "../common/common.h" +#include +#include + +#include + +namespace ArkUICApiDemo { + +class CustomComponentOnMeasureTest { +public: + ~CustomComponentOnMeasureTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_XTS_CUSTOMCOMPONENT_ONMEASURE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ontouch_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ontouch_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..825c67efd17d4afd80dcc21cd9956eebd6900f0e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ontouch_test.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_ontouch_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue enable_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enable_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enable_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_TOUCH_EVENT, ON_TOUCH_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", + "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_TOUCH_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value CustomComponentOnTouchTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto columnOnTouch = createChildNode(nodeAPI, true); + auto columnOnTouchDisable = createChildNode(nodeAPI, false); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnTouchTest"; + nodeAPI->setAttribute(columnOnTouch, NODE_ID, &id_item); + id_item.string = "OnTouchTestDisable"; + nodeAPI->setAttribute(columnOnTouchDisable, NODE_ID, &id_item); + + // 添加子组件 + nodeAPI->addChild(column, columnOnTouch); + nodeAPI->addChild(column, columnOnTouchDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOnTouchTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ontouch_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ontouch_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3841c81aa236d9ed9bf2d607c0c3471b3bd40edc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_ontouch_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONTOUCH_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONTOUCH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentOnTouchTest { +public: + ~CustomComponentOnTouchTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_ONTOUCH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_opacity_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_opacity_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..782d6adef178701c25ea870097e33d8675de53d9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_opacity_test.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_opacity_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle CustomComponentOpacityTest::CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, float width, + float height, float opacity) +{ + uint32_t background_color = 0xFFFF0000; + + auto custom = node_api->createNode(ARKUI_NODE_CUSTOM); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件透明度值 + ArkUI_NumberValue opacity_value[] = {{.f32 = opacity}}; + ArkUI_AttributeItem opacity_item = {opacity_value, sizeof(opacity_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_OPACITY, &opacity_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + return custom; +} + +napi_value CustomComponentOpacityTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOpacityTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 450}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + float opacity = 0; + float width = 50; + float height = 50; + auto custom = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + opacity = 0.5; + width = 60; + height = 60; + custom = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + opacity = 0.8; + width = 70; + height = 70; + custom = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + opacity = 1; + width = 80; + height = 80; + custom = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + opacity = -1; + width = 90; + height = 90; + custom = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + opacity = 2; + width = 100; + height = 100; + custom = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, custom); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_opacity_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_opacity_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e9e4332de4ac8dc18aecaf42c4011f52060e1845 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_opacity_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_OPACITY_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_OPACITY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentOpacityTest { +public: + ~CustomComponentOpacityTest(); + static ArkUI_NodeHandle CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float opacity); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_OPACITY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_position_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_position_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8ca8ca2cd2dddb4c3e41874892aea8a3b95de6d3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_position_test.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_position_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentPositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentPositionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentPositionTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto secondCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, secondCustom); + + // 设置组件大小 + ArkUI_NumberValue parentWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem parentWidth_item = {parentWidth_value, sizeof(parentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &parentWidth_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &parentWidth_item); + + // 设置组件背景色 + ArkUI_NumberValue parentBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem parentBackground_color_item = { + parentBackground_color_value, sizeof(parentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &parentBackground_color_item); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom, NODE_HEIGHT, &width_item); + nodeAPI->setAttribute(secondCustom, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(secondCustom, NODE_HEIGHT, &width_item); + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue background_color_second_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem background_colo_second_item = { + background_color_second_value, sizeof(background_color_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(secondCustom, NODE_BACKGROUND_COLOR, &background_colo_second_item); + + // 设置组件position + ArkUI_NumberValue position_value[] = {{.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_POSITION, &position_item); + + ArkUI_NumberValue position_second_value[] = {{.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem position_second_item = {position_second_value, + sizeof(position_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(secondCustom, NODE_POSITION, &position_second_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentPositionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_position_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_position_test.h new file mode 100644 index 0000000000000000000000000000000000000000..4d53f353811d85495a0aee7e2a90eb2ff6995e90 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_position_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_POSITION_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_POSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentPositionTest { +public: + ~CustomComponentPositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_POSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_radialgradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_radialgradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..42f3c6b80a27971101fe6be3c5501306fc68b61c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_radialgradient_test.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_radialgradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentRadialGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentRadialGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentRadialGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建custom节点组件 + auto custom1 = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto custom2 = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto custom3 = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto custom4 = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto custom5 = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 设置custom组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(custom2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(custom3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(custom4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(custom5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(custom1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom5, NODE_WIDTH, &width_item); + + // custom组件放置父容器column中 + nodeAPI->addChild(column, custom1); + nodeAPI->addChild(column, custom2); + nodeAPI->addChild(column, custom3); + nodeAPI->addChild(column, custom4); + nodeAPI->addChild(column, custom5); + + // 设置custom组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(custom2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(custom3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(custom4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(custom5, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置custom组件径向颜色渐变 + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.3, 1}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue radialGradient_value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 0}}; + ArkUI_AttributeItem radialGradient_value_value_item = {radialGradient_value, + sizeof(radialGradient_value) / sizeof(ArkUI_NumberValue)}; + radialGradient_value_value_item.object = &colorStop; + nodeAPI->setAttribute(custom1, NODE_RADIAL_GRADIENT, &radialGradient_value_value_item); + + unsigned int colors_object[] = {0xFFFFFFFF, 0xFF0000FF, 0xFF000000}; + float stops_object[] = {0.2, 0.5, 1}; + ArkUI_ColorStop colorStop_object = {colors_object, stops_object, 3}; + ArkUI_NumberValue threeColors_value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 0}}; + ArkUI_AttributeItem threeColors_value_item = {threeColors_value, + sizeof(threeColors_value) / sizeof(ArkUI_NumberValue)}; + threeColors_value_item.object = &colorStop_object; + nodeAPI->setAttribute(custom2, NODE_RADIAL_GRADIENT, &threeColors_value_item); + + ArkUI_NumberValue repeat_value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 1}}; + ArkUI_AttributeItem repeat_value_item = {repeat_value, sizeof(repeat_value) / sizeof(ArkUI_NumberValue)}; + repeat_value_item.object = &colorStop; + nodeAPI->setAttribute(custom3, NODE_RADIAL_GRADIENT, &repeat_value_item); + + unsigned int colors_exception[] = {1234, 1234}; + ArkUI_ColorStop exception_colorStop = {colors_exception, stops, 2}; + ArkUI_NumberValue value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.object = &exception_colorStop; + nodeAPI->setAttribute(custom4, NODE_RADIAL_GRADIENT, &value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = -25}, {.f32 = -25}, {.f32 = -25}, {.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + exception_value_item.object = &colorStop; + nodeAPI->setAttribute(custom5, NODE_RADIAL_GRADIENT, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentRadialGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_radialgradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_radialgradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..684a04e11a5d946fc1297b8e0677786d6abd5452 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_radialgradient_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_RADIALGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_RADIALGRADIENT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentRadialGradientTest { +public: + ~CustomComponentRadialGradientTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_RADIALGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_scale_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_scale_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..76559f3ea0d9ea9a1b5f31f41e3e6fb42cce253f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_scale_test.cpp @@ -0,0 +1,370 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_scale_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value CustomComponentScaleTest::CreateNativeNodeReduceXY(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 0.5}, {.f32 = 0.5}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentScaleTest::CreateNativeNodeReduceX(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 0.5}, {.f32 = 1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentScaleTest::CreateNativeNodeEnlargeXY(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 2}, {.f32 = 2}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentScaleTest::CreateNativeNodeEnlargeX(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 2}, {.f32 = 1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentScaleTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = -1}, {.f32 = -1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_scale_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_scale_test.h new file mode 100644 index 0000000000000000000000000000000000000000..538d01298abddaf97157e3758c7ee1073c5f8232 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_scale_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SCALE_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SCALE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentScaleTest { +public: + ~CustomComponentScaleTest(); + static napi_value CreateNativeNodeReduceXY(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeReduceX(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnlargeXY(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnlargeX(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SCALE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sepia_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sepia_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5f3fbb97868f2fd05de154c6566d34b1e0d13414 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sepia_test.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_sepia_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle CustomComponentSepiaTest::CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, float width, + float height, float sepia) +{ + auto custom = node_api->createNode(ARKUI_NODE_CUSTOM); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件图像转换为深褐色比例属性 + ArkUI_NumberValue sepia_value[] = {{.f32 = sepia}}; + ArkUI_AttributeItem sepia_item = {sepia_value, sizeof(sepia_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(custom, NODE_SEPIA, &sepia_item); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(custom, NODE_BACKGROUND_IMAGE, &src_item); + + return custom; +} + +napi_value CustomComponentSepiaTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentSepiaTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentSepiaTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float opacity = 0; + float width = 100; + float height = 100; + auto checkbox = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 0.5; + width = 100; + height = 100; + checkbox = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 0.8; + width = 100; + height = 100; + checkbox = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 1; + width = 100; + height = 100; + checkbox = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = -1; + width = 100; + height = 100; + checkbox = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + opacity = 2; + width = 100; + height = 100; + checkbox = CreateSubCustomNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, checkbox); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentSepiaTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sepia_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sepia_test.h new file mode 100644 index 0000000000000000000000000000000000000000..97b35d81cad5c09720566a41c38b55f9c4122c05 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sepia_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SEPIA_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SEPIA_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentSepiaTest { +public: + ~CustomComponentSepiaTest(); + static ArkUI_NodeHandle CreateSubCustomNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float sepia); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SEPIA_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_shadow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_shadow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1cfd7e2d7f36ab032c912e538f7cea9ad974a76a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_shadow_test.cpp @@ -0,0 +1,588 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_shadow_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value CustomComponentShadowTest::CreateNativeNodeUltraSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentShadowTest::CreateNativeNodeSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentShadowTest::CreateNativeNodeMiddleShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentShadowTest::CreateNativeNodeLargeShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentShadowTest::CreateNativeNodeFloatingShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentShadowTest::CreateNativeNodeFloatingSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentShadowTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentShadowTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, custom); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = 7}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_shadow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_shadow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d28ea6cb0da00180826f25e6ee65bae505fd89ad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_shadow_test.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SHADOW_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SHADOW_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentShadowTest { +public: + ~CustomComponentShadowTest(); + static napi_value CreateNativeNodeUltraSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMiddleShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLargeShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFloatingShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFloatingSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SHADOW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sweepgradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sweepgradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c79b28fb2e530268b76cd4ab3d2e83dbe9739fea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sweepgradient_test.cpp @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_sweepgradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentSweepGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentSweepGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentSweepGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建custom节点组件 + auto custom1 = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto custom2 = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto custom3 = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto custom4 = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto custom5 = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + + // 设置custom组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(custom2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(custom3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(custom4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(custom5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(custom1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(custom5, NODE_WIDTH, &width_item); + + // custom组件放置父容器column中 + nodeAPI->addChild(column, custom1); + nodeAPI->addChild(column, custom2); + nodeAPI->addChild(column, custom3); + nodeAPI->addChild(column, custom4); + nodeAPI->addChild(column, custom5); + + // 设置custom组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(custom2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(custom3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(custom4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(custom5, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置custom组件角度颜色渐变 + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.3, 1}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue sweepGradient_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, + {.f32 = 180}, {.f32 = 90}, {.i32 = 0}}; + ArkUI_AttributeItem sweepGradient_value_item = {sweepGradient_value, + sizeof(sweepGradient_value) / sizeof(ArkUI_NumberValue)}; + sweepGradient_value_item.object = &colorStop; + nodeAPI->setAttribute(custom1, NODE_SWEEP_GRADIENT, &sweepGradient_value_item); + + unsigned int colors_object[] = {0xFFFFFFFF, 0xFF0000FF, 0xFF000000}; + float stops_object[] = {0.2, 0.5, 1}; + ArkUI_ColorStop colorStop_object = {colors_object, stops_object, 3}; + ArkUI_NumberValue threeColors_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, + {.f32 = 180}, {.f32 = 90}, {.i32 = 0}}; + ArkUI_AttributeItem threeColors_value_item = {threeColors_value, + sizeof(threeColors_value) / sizeof(ArkUI_NumberValue)}; + threeColors_value_item.object = &colorStop_object; + nodeAPI->setAttribute(custom2, NODE_SWEEP_GRADIENT, &threeColors_value_item); + + ArkUI_NumberValue repeat_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, {.f32 = 180}, {.f32 = 90}, {.i32 = 1}}; + ArkUI_AttributeItem repeat_value_item = {repeat_value, sizeof(repeat_value) / sizeof(ArkUI_NumberValue)}; + repeat_value_item.object = &colorStop; + nodeAPI->setAttribute(custom3, NODE_SWEEP_GRADIENT, &repeat_value_item); + + unsigned int colors_exception[] = {1234, 1234}; + ArkUI_ColorStop exception_colorStop = {colors_exception, stops, 2}; + ArkUI_NumberValue value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, {.f32 = 180}, {.f32 = 90}, {.i32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.object = &exception_colorStop; + nodeAPI->setAttribute(custom4, NODE_SWEEP_GRADIENT, &value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = -50}, {.f32 = -50}, {.f32 = -1}, + {.f32 = -180}, {.f32 = -90}, {.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + exception_value_item.object = &colorStop; + nodeAPI->setAttribute(custom5, NODE_RADIAL_GRADIENT, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentSweepGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sweepgradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sweepgradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7b8a78a50d13313e78cb169e45945d90e7d7d914 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_sweepgradient_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SWEEPGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SWEEPGRADIENT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentSweepGradientTest { +public: + ~CustomComponentSweepGradientTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_SWEEPGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_transform_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_transform_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1c47d0147e95a29115f59001b03e09dffe0b6aab --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_transform_test.cpp @@ -0,0 +1,282 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_transform_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentTransformTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentTransformTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentTransformTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置矩阵 + const char *imageUrl = "./resources/base/media/icon.png"; + + ArkUI_NumberValue heightValue[] = {{.f32 = 150}}; + ArkUI_NumberValue widthValue[] = {{.f32 = 150}}; + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue backgroundValue[] = {{.i32 = ARKUI_IMAGE_REPEAT_NONE}}; + + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem backgroundItem = {backgroundValue, sizeof(backgroundValue) / sizeof(ArkUI_NumberValue), + imageUrl}; + + auto customFirst = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customFirst, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customFirst, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customFirst, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customFirst, NODE_BACKGROUND_IMAGE, &backgroundItem); + + auto customSecond = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customSecond, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customSecond, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customSecond, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customSecond, NODE_BACKGROUND_IMAGE, &backgroundItem); + + auto customThird = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customThird, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customThird, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customThird, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customThird, NODE_BACKGROUND_IMAGE, &backgroundItem); + + // 添加到父控件 + auto columnP1 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(columnP1, customFirst); + nodeAPI->addChild(columnP1, customSecond); + nodeAPI->addChild(columnP1, customThird); + + // 向Y反向平移20 + auto customFirstRight = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(customFirstRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customFirstRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customFirstRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customFirstRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueFirst[] = { + {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = -20}, {.f32 = 0}, {.f32 = 1.00}}; + ArkUI_AttributeItem transformItemFirst = {transformValueFirst, + sizeof(transformValueFirst) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customFirstRight, NODE_TRANSFORM, &transformItemFirst); + + // 绕Z轴旋转30度 + auto customSecondRight = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(customSecondRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customSecondRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customSecondRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customSecondRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueSecond[] = {{.f32 = static_cast(cos(30))}, + {.f32 = static_cast(-sin(30))}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = static_cast(sin(30))}, + {.f32 = static_cast(cos(30))}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 1}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 1}}; + ArkUI_AttributeItem transformItemSecond = {transformValueSecond, + sizeof(transformValueSecond) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customSecondRight, NODE_TRANSFORM, &transformItemSecond); + + // 缩小为原来的一半 + auto customThirdRight = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->setAttribute(customThirdRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customThirdRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customThirdRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customThirdRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueThird[] = { + {.f32 = 0.50}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0.50}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 0.50}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1.00}}; + ArkUI_AttributeItem transformItemThird = {transformValueThird, + sizeof(transformValueThird) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customThirdRight, NODE_TRANSFORM, &transformItemThird); + + // 添加到父控件 + auto columnP2 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(columnP2, customFirstRight); + nodeAPI->addChild(columnP2, customSecondRight); + nodeAPI->addChild(columnP2, customThirdRight); + + auto rowBase = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(rowBase, columnP1); + nodeAPI->addChild(rowBase, columnP2); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), rowBase) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentTransformTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value CustomComponentTransformTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentTransformTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentTransformTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置矩阵 + const char *imageUrl = "./resources/base/media/icon.png"; + + ArkUI_NumberValue heightValue[] = {{.f32 = 150}}; + ArkUI_NumberValue widthValue[] = {{.f32 = 150}}; + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue backgroundValue[] = {{.i32 = ARKUI_IMAGE_REPEAT_NONE}}; + + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem backgroundItem = {backgroundValue, sizeof(backgroundValue) / sizeof(ArkUI_NumberValue), + imageUrl}; + + auto customFirst = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customFirst, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customFirst, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customFirst, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customFirst, NODE_BACKGROUND_IMAGE, &backgroundItem); + + auto customSecond = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customSecond, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customSecond, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customSecond, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customSecond, NODE_BACKGROUND_IMAGE, &backgroundItem); + + auto customThird = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customThird, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customThird, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customThird, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customThird, NODE_BACKGROUND_IMAGE, &backgroundItem); + + // 添加到父控件 + auto columnP1 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(columnP1, customFirst); + nodeAPI->addChild(columnP1, customSecond); + nodeAPI->addChild(columnP1, customThird); + + // 4阶矩阵只传入14个参数 + auto customFirstRight = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customFirstRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customFirstRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customFirstRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customFirstRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueFirst[] = {{.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = -20}}; + ArkUI_AttributeItem transformItemFirst = {transformValueFirst, + sizeof(transformValueFirst) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customFirstRight, NODE_TRANSFORM, &transformItemFirst); + + // 4阶矩阵行列式为0 + auto customSecondRight = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customSecondRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customSecondRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customSecondRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customSecondRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueSecond[] = { + {.f32 = 0}, {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1.00}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1.00}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem transformItemSecond = {transformValueSecond, + sizeof(transformValueSecond) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customSecondRight, NODE_TRANSFORM, &transformItemSecond); + + // 4阶矩阵不传入参数 + auto customThirdRight = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->setAttribute(customThirdRight, NODE_HEIGHT, &heightItem); + nodeAPI->setAttribute(customThirdRight, NODE_WIDTH, &widthItem); + nodeAPI->setAttribute(customThirdRight, NODE_BACKGROUND_COLOR, &backgroundColorItem); + nodeAPI->setAttribute(customThirdRight, NODE_BACKGROUND_IMAGE, &backgroundItem); + ArkUI_NumberValue transformValueThird[] = {}; + ArkUI_AttributeItem transformItemThird = {transformValueThird, + sizeof(transformValueThird) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(customThirdRight, NODE_TRANSFORM, &transformItemThird); + + // 添加到父控件 + auto columnP2 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(columnP2, customFirstRight); + nodeAPI->addChild(columnP2, customSecondRight); + nodeAPI->addChild(columnP2, customThirdRight); + + auto rowBase = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(rowBase, columnP1); + nodeAPI->addChild(rowBase, columnP2); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), rowBase) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentTransformTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_transform_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_transform_test.h new file mode 100644 index 0000000000000000000000000000000000000000..be464ee22ac14c8dae00d0f9c1e9ced7cdd2f4cc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_transform_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_TRANSFORM_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_TRANSFORM_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentTransformTest { +public: + ~CustomComponentTransformTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_TRANSFORM_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..36d8c239e58f3aeaff8cb006d8f834001e46d8fa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_width_test.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customcomponent_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value CustomComponentWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentWidthTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto custom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto largeCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + auto abnormalCustom = nodeAPI->createNode(ARKUI_NODE_CUSTOM); + nodeAPI->addChild(column, custom); + nodeAPI->addChild(column, largeCustom); + nodeAPI->addChild(column, abnormalCustom); + // 设置组件宽度 + ArkUI_NumberValue ParentWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem ParentWidth_item = {ParentWidth_value, sizeof(ParentWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &ParentWidth_item); + + // 设置组件高度 + ArkUI_NumberValue ParentHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem ParentHeight_item = {ParentHeight_value, + sizeof(ParentHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &ParentHeight_item); + + // 设置组件背景色 + ArkUI_NumberValue ParentBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem ParentBackground_color_item = { + ParentBackground_color_value, sizeof(ParentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &ParentBackground_color_item); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(custom, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置largeCustom组件宽度 + ArkUI_NumberValue large_width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem large_width_item = {large_width_value, sizeof(large_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(largeCustom, NODE_WIDTH, &large_width_item); + + // 设置largeCustom组件高度 + nodeAPI->setAttribute(largeCustom, NODE_HEIGHT, &height_item); + + // 设置largeCustom组件背景色 + ArkUI_NumberValue large_background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem large_background_color_item = { + large_background_color_value, sizeof(large_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(largeCustom, NODE_BACKGROUND_COLOR, &large_background_color_item); + + // 设置abnormalCustom组件宽度 + ArkUI_NumberValue abnormal_width_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem abnormal_large_width_item = {abnormal_width_value, + sizeof(abnormal_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalCustom, NODE_WIDTH, &abnormal_large_width_item); + + // 设置abnormalCustom组件高度 + nodeAPI->setAttribute(abnormalCustom, NODE_HEIGHT, &height_item); + + // 设置abnormalCustom组件背景色 + ArkUI_NumberValue abnormal_background_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem abnormal_background_color_item = { + abnormal_background_color_value, sizeof(abnormal_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(abnormalCustom, NODE_BACKGROUND_COLOR, &abnormal_background_color_item); + + // column组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomComponentWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b40a3cf60318c4f9bd755e81ffcb98906253a39e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customcomponent/customcomponent_width_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomComponentWidthTest { +public: + ~CustomComponentWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMCOMPONENT_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_alignment_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_alignment_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bfd0f03b2015c8372752a45f8bc3a5132b3d70a7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_alignment_test.cpp @@ -0,0 +1,340 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customdialog_alignment_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static const auto dialogAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_DIALOG, "ArkUI_NativeDialogAPI_1")); +static auto customDialog = dialogAPI->create(); + +static auto createCustomDialog(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NativeDialogAPI_1 *dialogAPI, int32_t alignment, + float offsetX, float offsetY) +{ + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + // 设置组件边距 + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_MARGIN, &margin_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + dialogAPI->setContent(customDialog, column); + dialogAPI->setBackgroundColor(customDialog, 0xCCCCCCCC); + dialogAPI->setContentAlignment(customDialog, alignment, offsetX, offsetY); + dialogAPI->show(customDialog, false); + + return customDialog; +} + +napi_value CustomDialogAlignmentTest::CreateNativeNodeTopStart(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogAlignmentTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_TOP_START, PARAM_0, PARAM_0); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CustomDialogAlignmentTest::CreateNativeNodeTop(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogAlignmentTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_TOP, PARAM_0, PARAM_0); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CustomDialogAlignmentTest::CreateNativeNodeTopEnd(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogAlignmentTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_TOP_END, PARAM_0, PARAM_0); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CustomDialogAlignmentTest::CreateNativeNodeStart(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogAlignmentTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_START, PARAM_0, PARAM_0); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CustomDialogAlignmentTest::CreateNativeNodeCenter(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogAlignmentTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_CENTER, SIZE_50, SIZE_50); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CustomDialogAlignmentTest::CreateNativeNodeEnd(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogAlignmentTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_END, PARAM_0, PARAM_0); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CustomDialogAlignmentTest::CreateNativeNodeBottomStart(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogAlignmentTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_BOTTOM_START, PARAM_0, PARAM_0); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CustomDialogAlignmentTest::CreateNativeNodeBottom(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogAlignmentTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_BOTTOM, PARAM_0, PARAM_0); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CustomDialogAlignmentTest::CreateNativeNodeBottomEnd(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogAlignmentTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_BOTTOM_END, PARAM_0, PARAM_0); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value CustomDialogAlignmentTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogAlignmentTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, PARAM_NEGATIVE_1, PARAM_0, PARAM_0); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_alignment_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_alignment_test.h new file mode 100644 index 0000000000000000000000000000000000000000..faa933f93667359c4752af7a23a32691ba2fb17c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_alignment_test.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMDIALOG_ALIGNMENT_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMDIALOG_ALIGNMENT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomDialogAlignmentTest { +public: + ~CustomDialogAlignmentTest(); + static napi_value CreateNativeNodeTopStart(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTopEnd(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeStart(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCenter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnd(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBottomStart(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBottomEnd(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMDIALOG_ALIGNMENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_close_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_close_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..253bcc206df12126f382a6317760a02024daa588 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_close_test.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customdialog_close_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t backgroundColor) +{ + auto nodehandle = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodehandle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodehandle, NODE_HEIGHT, &height_item); + + // 设置组件边距 + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodehandle, NODE_MARGIN, &margin_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodehandle, NODE_BACKGROUND_COLOR, &background_color_item); + + return nodehandle; +} + +napi_value CustomDialogCloseTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogCloseTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建dialogAPI + ArkUI_NativeDialogAPI_1 *dialogAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_DIALOG, ArkUI_NativeDialogAPI_1, dialogAPI); + + auto customDialog = dialogAPI->create(); + dialogAPI->setContent(customDialog, createChildNode(nodeAPI, COLOR_GREEN)); + dialogAPI->setBackgroundColor(customDialog, 0xCCCCCCCC); + dialogAPI->show(customDialog, true); + dialogAPI->close(customDialog); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_close_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_close_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a92b0f3497907393484049548594cd9c0f8d4cc8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_close_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMDIALOG_CLOSE_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMDIALOG_CLOSE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomDialogCloseTest { +public: + ~CustomDialogCloseTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMDIALOG_CLOSE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_customstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_customstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bf14503f13e86e4bbac7bdbed9eacf0c1fed3095 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_customstyle_test.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customdialog_customstyle_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static const auto dialogAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_DIALOG, "ArkUI_NativeDialogAPI_1")); + +static auto createCustomDialog(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NativeDialogAPI_1 *dialogAPI, int32_t alignment, + int32_t customStyle) +{ + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + // 设置组件边距 + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_MARGIN, &margin_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + auto customDialog = dialogAPI->create(); + + dialogAPI->setContent(customDialog, column); + dialogAPI->setBackgroundColor(customDialog, 0xCCCCCCCC); + dialogAPI->setContentAlignment(customDialog, alignment, PARAM_0, PARAM_0); + dialogAPI->enableCustomStyle(customDialog, customStyle); + dialogAPI->show(customDialog, false); + + return customDialog; +} + +napi_value CustomDialogCustomStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogCustomStyleTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_TOP, true); + createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_CENTER, false); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_customstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_customstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6a3124edf3b14c68874db65e99c9c4792769bf4b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_customstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMDIALOG_CUSTOMSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMDIALOG_CUSTOMSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomDialogCustomStyleTest { +public: + ~CustomDialogCustomStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMDIALOG_CUSTOMSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_maskcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_maskcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..85dd32f335a1142ef0e5a93341da6bebd3948ef8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_maskcolor_test.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customdialog_maskcolor_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static const auto dialogAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_DIALOG, "ArkUI_NativeDialogAPI_1")); + +static auto createCustomDialog(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NativeDialogAPI_1 *dialogAPI, int32_t alignment) +{ + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + // 设置组件边距 + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_MARGIN, &margin_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + auto customDialog = dialogAPI->create(); + + dialogAPI->setContent(customDialog, column); + dialogAPI->setBackgroundColor(customDialog, 0xCCCCCCCC); + dialogAPI->setContentAlignment(customDialog, alignment, PARAM_0, PARAM_0); + + return customDialog; +} + +napi_value CustomDialogMaskColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogMaskColorTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + ArkUI_Rect maskRect = {PARAM_0, PARAM_0, SIZE_500, SIZE_500}; + auto customDialog = createCustomDialog(nodeAPI, dialogAPI, ARKUI_ALIGNMENT_TOP); + dialogAPI->setMask(customDialog, COLOR_RED, &maskRect); + dialogAPI->show(customDialog, false); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_maskcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_maskcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..4dac1ad3d26b1672ddefcdccbdbdfc4511d82ee4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_maskcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMDIALOG_MASKCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMDIALOG_MASKCOLOR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomDialogMaskColorTest { +public: + ~CustomDialogMaskColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMDIALOG_MASKCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_open_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_open_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d1bb92b5f97d6c693806d1aa628be703b80cb7b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_open_test.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "customdialog_open_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t backgroundColor) +{ + auto nodehandle = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodehandle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodehandle, NODE_HEIGHT, &height_item); + + // 设置组件边距 + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodehandle, NODE_MARGIN, &margin_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodehandle, NODE_BACKGROUND_COLOR, &background_color_item); + + return nodehandle; +} + +napi_value CustomDialogOpenTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CustomDialogOpenTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建dialogAPI + ArkUI_NativeDialogAPI_1 *dialogAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_DIALOG, ArkUI_NativeDialogAPI_1, dialogAPI); + + auto customDialog = dialogAPI->create(); + dialogAPI->setContent(customDialog, createChildNode(nodeAPI, COLOR_GREEN)); + dialogAPI->setBackgroundColor(customDialog, 0xCCCCCCCC); + dialogAPI->show(customDialog, false); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_open_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_open_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e7d5d17f065440b974cc140c6d9eca72d93b019b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/customdialog/customdialog_open_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_CUSTOMDIALOG_OPEN_TEST_H +#define ARKUI_CAPI_DEMO_CUSTOMDIALOG_OPEN_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class CustomDialogOpenTest { +public: + ~CustomDialogOpenTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_CUSTOMDIALOG_OPEN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_disappeartextstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_disappeartextstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d483431c98e5788a88ee324591cf321568351171 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_disappeartextstyle_test.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "datepicker_disappeartextstyle_test.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem selected_value_item = {.string = "2024-5-1"}; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_value_item); + return datePicker; +} + +napi_value DatePickerDisappearTextStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker1 = createChildNode(nodeAPI); + auto datePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, datePicker1); + nodeAPI->addChild(column, datePicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;bold;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(datePicker1, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerDisappearTextStyleTest", + "NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE is %{public}d", ret); + + ArkUI_AttributeItem abnormal_item = {}; + abnormal_item.string = "abnormal"; + nodeAPI->setAttribute(datePicker2, NODE_DATE_PICKER_DISAPPEAR_TEXT_STYLE, &abnormal_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_disappeartextstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_disappeartextstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..faec3e3e82ed00e062506d2d44264519fa525156 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_disappeartextstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_DISAPPEARTEXTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_DISAPPEARTEXTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerDisappearTextStyleTest { +public: + ~DatePickerDisappearTextStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_DISAPPEARTEXTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_enabled_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_enabled_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..728673daf2b79ca502406140669cf03f796a7237 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_enabled_test.cpp @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_enabled_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + if (enabled != SIZE_100) { + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + } + + // set background color + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + // set width + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // set margin + ArkUI_NumberValue margin_value[] = {{.f32 = SIZE_10}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + auto ret = nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + // set selected date + const char *date_picker_value = "2024-01-01"; + ArkUI_AttributeItem date_picker_value_item = {}; + date_picker_value_item.string = date_picker_value; + nodeAPI->setAttribute(nodeHandle, NODE_DATE_PICKER_SELECTED, &date_picker_value_item); + + // set focusable + ArkUI_NumberValue focusable_value[] = {{.i32 = FOCUSABLE_TRUE}}; + ArkUI_AttributeItem focusable_item = {focusable_value, sizeof(focusable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOCUSABLE, &focusable_item); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "DatePickerEnabledTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerEnabledTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + uint32_t color = COLOR_PURPLE; + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "DatePickerEnabledTest", "OnEventReceive eventId: %{public}d", + eventId); + switch (eventId) { + case ON_CLICK_EVENT_ID: + color = COLOR_GREEN; + break; + case ON_FOCUS_EVENT_ID: + color = COLOR_BLUE; + break; + case ON_BLUR_EVENT_ID: + color = COLOR_YELLOW; + break; + default: + break; + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value DatePickerEnabledTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerEnabledTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerEnabledTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // 设置column组件高度 + ArkUI_NumberValue height_column_value[] = {{.f32 = SIZE_600}}; + ArkUI_AttributeItem height_column_item = {height_column_value, + sizeof(height_column_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_column_item); + + // 设置text组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件id + ArkUI_AttributeItem id_item_text = {}; + id_item_text.string = "TextClick"; + + // 设置text组件获取焦点 + ArkUI_NumberValue focusable_value[] = {{.i32 = FOCUSABLE_TRUE}}; + ArkUI_AttributeItem focusable_item = {focusable_value, sizeof(focusable_value) / sizeof(ArkUI_NumberValue)}; + + // first text + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + ArkUI_NumberValue position_value[] = {{.f32 = PARAM_0}, {.f32 = PARAM_0}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_POSITION, &position_item); + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text, NODE_ID, &id_item_text); + nodeAPI->setAttribute(text, NODE_FOCUSABLE, &focusable_item); + + // first datePicker + auto datePicker = createChildNode(nodeAPI, PARAM_1); + ArkUI_AttributeItem id_item = {}; + id_item.string = "EnabledDatePicker"; + nodeAPI->setAttribute(datePicker, NODE_ID, &id_item); + nodeAPI->registerNodeEvent(datePicker, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + // second datePicker + auto datePickerDisabled = createChildNode(nodeAPI, PARAM_0); + ArkUI_AttributeItem id_second_item = {}; + id_second_item.string = "DisabledDatePicker"; + nodeAPI->setAttribute(datePickerDisabled, NODE_ID, &id_second_item); + nodeAPI->registerNodeEvent(datePickerDisabled, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + // third datePicker + auto datePickerAbnormal = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + ArkUI_AttributeItem id_third_item = {}; + id_third_item.string = "AbnormalDatePicker"; + nodeAPI->setAttribute(datePickerAbnormal, NODE_ID, &id_third_item); + nodeAPI->registerNodeEvent(datePickerAbnormal, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + // datePicker for click + auto datePickerClick = createChildNode(nodeAPI, PARAM_1); + ArkUI_AttributeItem id_item_click = {}; + id_item_click.string = "OnClickEnabledDatePicker"; + nodeAPI->setAttribute(datePickerClick, NODE_ID, &id_item_click); + nodeAPI->registerNodeEvent(datePickerClick, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // datePicker for click + auto datePickerDisabledClick = createChildNode(nodeAPI, PARAM_0); + ArkUI_AttributeItem id_second_item_click = {}; + id_second_item_click.string = "OnClickDisabledDatePicker"; + nodeAPI->setAttribute(datePickerDisabledClick, NODE_ID, &id_second_item_click); + nodeAPI->registerNodeEvent(datePickerDisabledClick, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // datePicker for click + auto datePickerAbnormalClick = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + ArkUI_AttributeItem id_third_item_click = {}; + id_third_item_click.string = "OnClickAbnormalDatePicker"; + nodeAPI->setAttribute(datePickerAbnormalClick, NODE_ID, &id_third_item_click); + nodeAPI->registerNodeEvent(datePickerAbnormalClick, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // datePicker for blur + auto datePickerBlur = createChildNode(nodeAPI, PARAM_1); + ArkUI_AttributeItem id_item_blur = {}; + id_item_blur.string = "OnBlurEnabledDatePicker"; + nodeAPI->setAttribute(datePickerBlur, NODE_ID, &id_item_blur); + nodeAPI->registerNodeEvent(datePickerBlur, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(datePickerBlur, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + + // datePicker for blur + auto datePickerDisabledBlur = createChildNode(nodeAPI, PARAM_0); + ArkUI_AttributeItem id_second_item_blur = {}; + id_second_item_blur.string = "OnBlurDisabledDatePicker"; + nodeAPI->setAttribute(datePickerDisabledBlur, NODE_ID, &id_second_item_blur); + nodeAPI->registerNodeEvent(datePickerDisabledBlur, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(datePickerDisabledBlur, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + + // datePicker for blur + auto datePickerAbnormalBlur = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + ArkUI_AttributeItem id_third_item_blur = {}; + id_third_item_blur.string = "OnBlurAbnormalDatePicker"; + nodeAPI->setAttribute(datePickerAbnormalBlur, NODE_ID, &id_third_item_blur); + nodeAPI->registerNodeEvent(datePickerAbnormalBlur, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(datePickerAbnormalBlur, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + + // row + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(rowFirst, datePickerClick); + nodeAPI->addChild(rowFirst, datePicker); + nodeAPI->addChild(rowFirst, datePickerBlur); + nodeAPI->addChild(rowSecond, datePickerDisabledClick); + nodeAPI->addChild(rowSecond, datePickerDisabled); + nodeAPI->addChild(rowSecond, datePickerDisabledBlur); + nodeAPI->addChild(rowThird, datePickerAbnormalClick); + nodeAPI->addChild(rowThird, datePickerAbnormal); + nodeAPI->addChild(rowThird, datePickerAbnormalBlur); + + nodeAPI->addChild(column, text); + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + + // Bind click event + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_enabled_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_enabled_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5cc7fd8966217599d905d41542d03c20dcd0efff --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_enabled_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_ENABLED_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_ENABLED_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +#define YEAR 2024 +#define MONTH 1 +#define DATE 1 + +#define FOCUSABLE_TRUE 1 + +class DatePickerEnabledTest { +public: + ~DatePickerEnabledTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_ENABLED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_end_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_end_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d5f3004bd990814abb2aa395db085b3b20394689 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_end_test.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_end_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value DatePickerEndTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "DatePickerEndTest", "CreateNativeNode"); + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerEndTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + auto datePickerAbnormal = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(datePickerAbnormal, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(datePickerAbnormal, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, datePicker); + nodeAPI->addChild(column, datePickerAbnormal); + + ArkUI_AttributeItem start_value_item = {.string = "2024-1-1"}; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_START, &start_value_item); + ArkUI_AttributeItem end_value_item = {.string = "2025-2-2"}; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_END, &end_value_item); + + nodeAPI->setAttribute(datePickerAbnormal, NODE_DATE_PICKER_START, &start_value_item); + ArkUI_AttributeItem end_value_abnormal = {.string = ""}; + nodeAPI->setAttribute(datePickerAbnormal, NODE_DATE_PICKER_END, &end_value_abnormal); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerEndTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerEndTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "DatePickerEndTest", "CreateNativeNode"); + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerEndTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePickerLowerAbnormal = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + auto datePickerUpperAbnormal = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePickerLowerAbnormal, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(datePickerUpperAbnormal, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePickerLowerAbnormal, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(datePickerUpperAbnormal, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, datePickerLowerAbnormal); + nodeAPI->addChild(column, datePickerUpperAbnormal); + + ArkUI_AttributeItem start_value_item = {.string = "2024-1-1"}; + nodeAPI->setAttribute(datePickerLowerAbnormal, NODE_DATE_PICKER_START, &start_value_item); + ArkUI_AttributeItem end_value_item = {.string = "1111-1-1"}; + nodeAPI->setAttribute(datePickerLowerAbnormal, NODE_DATE_PICKER_END, &end_value_item); + + nodeAPI->setAttribute(datePickerUpperAbnormal, NODE_DATE_PICKER_START, &start_value_item); + ArkUI_AttributeItem end_value_abnormal = {.string = "9999-1-1"}; + nodeAPI->setAttribute(datePickerUpperAbnormal, NODE_DATE_PICKER_END, &end_value_abnormal); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerEndTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_end_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_end_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7f22953853fc3ea07ea2ccd42a99d34889def246 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_end_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_END_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_END_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerEndTest { +public: + ~DatePickerEndTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_END_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_lunar_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_lunar_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ea58ec914030ea3f5aedd8f26ee737a5fd945085 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_lunar_test.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_lunar_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value DatePickerLunarTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "DatePickerLunarTest", "CreateNativeNode"); + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerLunarTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker1 = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + auto datePicker2 = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + auto datePicker3 = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(datePicker2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(datePicker3, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(datePicker2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(datePicker3, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, datePicker1); + nodeAPI->addChild(column, datePicker2); + nodeAPI->addChild(column, datePicker3); + + ArkUI_AttributeItem selected_value_item = {.string = "2024-5-1"}; + nodeAPI->setAttribute(datePicker1, NODE_DATE_PICKER_SELECTED, &selected_value_item); + nodeAPI->setAttribute(datePicker2, NODE_DATE_PICKER_SELECTED, &selected_value_item); + nodeAPI->setAttribute(datePicker3, NODE_DATE_PICKER_SELECTED, &selected_value_item); + + ArkUI_NumberValue true_value[] = {{.i32 = true}}; + ArkUI_AttributeItem true_value_item = {true_value, sizeof(true_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker1, NODE_DATE_PICKER_LUNAR, &true_value_item); + + ArkUI_NumberValue false_value[] = {{.i32 = false}}; + ArkUI_AttributeItem false_value_item = {false_value, sizeof(false_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker2, NODE_DATE_PICKER_LUNAR, &false_value_item); + + ArkUI_NumberValue exception_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker3, NODE_DATE_PICKER_LUNAR, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerLunarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_lunar_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_lunar_test.h new file mode 100644 index 0000000000000000000000000000000000000000..90c2e80de645e68c9aa2f6a8922dfba1de09d824 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_lunar_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_LUNAR_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_LUNAR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerLunarTest { +public: + ~DatePickerLunarTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_LUNAR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_ondatechange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_ondatechange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..552f029d902a733154b6a4673777e4218b82f306 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_ondatechange_test.cpp @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_ondatechange_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem selected_value_item = {.string = "2024-5-1"}; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_value_item); + + nodeAPI->registerNodeEvent(datePicker, NODE_DATE_PICKER_EVENT_ON_DATE_CHANGE, ON_CHANGE_EVENT_ID, nullptr); + + return datePicker; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_CHANGE_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} +napi_value DatePickerOnDateChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerOnDateChangeTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = createChildNode(nodeAPI); + + nodeAPI->addChild(column, datePicker); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "datePickerOnDateChangeTest"; + nodeAPI->setAttribute(datePicker, NODE_ID, &id_item); + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerOnDateChangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_ondatechange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_ondatechange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c0ead51d6b2d7e073db82be0f861ae425f2bbf2b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_ondatechange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_ONDATECHANGE_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_ONDATECHANGE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerOnDateChangeTest { +public: + ~DatePickerOnDateChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_ONDATECHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selected_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selected_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e2fcd22c6eaa3477ac0c9c0b1ba28b59aa77c957 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selected_test.cpp @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_selected_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value DatePickerSelectedTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "DatePickerSelectedTest", "CreateNativeNode"); + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerSelectedTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + auto datePickerAbnormal = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(datePickerAbnormal, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(datePickerAbnormal, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, datePicker); + nodeAPI->addChild(column, datePickerAbnormal); + + ArkUI_AttributeItem selected_value_item = {.string = "2024-5-1"}; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_value_item); + + ArkUI_AttributeItem abnormal_value_item = {.string = ""}; + nodeAPI->setAttribute(datePickerAbnormal, NODE_DATE_PICKER_SELECTED, &abnormal_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerSelectedTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerSelectedTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "DatePickerSelectedTest", "CreateNativeNode"); + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerSelectedTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePickerLowerAbnormal = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + auto datePickerUpperAbnormal = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePickerLowerAbnormal, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(datePickerUpperAbnormal, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePickerLowerAbnormal, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(datePickerUpperAbnormal, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, datePickerLowerAbnormal); + nodeAPI->addChild(column, datePickerUpperAbnormal); + + ArkUI_AttributeItem selected_value_item = {.string = "1111-1-1"}; + nodeAPI->setAttribute(datePickerLowerAbnormal, NODE_DATE_PICKER_SELECTED, &selected_value_item); + + ArkUI_AttributeItem abnormal_value_item = {.string = "9999-1-1"}; + nodeAPI->setAttribute(datePickerUpperAbnormal, NODE_DATE_PICKER_SELECTED, &abnormal_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerSelectedTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selected_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selected_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7166cf25b2e8ffe9606b0cdfcf25d020f037d85c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selected_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_SELECTED_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_SELECTED_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerSelectedTest { +public: + ~DatePickerSelectedTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_SELECTED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selectedtextstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selectedtextstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7b852079d7cb334276ccaf8bb2efe93d5e6482c7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selectedtextstyle_test.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "datepicker_selectedtextstyle_test.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem selected_value_item = {.string = "2024-5-1"}; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_value_item); + + return datePicker; +} + +napi_value DatePickerSelectedTextStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker1 = createChildNode(nodeAPI); + auto datePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, datePicker1); + nodeAPI->addChild(column, datePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;normal;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(datePicker1, NODE_DATE_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + ArkUI_AttributeItem abnormal_item = {}; + abnormal_item.string = "abnormal"; + auto abnormal_ret = nodeAPI->setAttribute(datePicker2, NODE_DATE_PICKER_SELECTED_TEXT_STYLE, &abnormal_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selectedtextstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selectedtextstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..26bbca777f0baac7f9850f08df2880b7229d3d2f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_selectedtextstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_SELECTEDTEXTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_SELECTEDTEXTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerSelectedTextStyleTest { +public: + ~DatePickerSelectedTextStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_SELECTEDTEXTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_start_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_start_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c8bb4cf857c5f7140b724eb962aecd092aa99fd8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_start_test.cpp @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_start_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value DatePickerStartTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "DatePickerStartTest", "CreateNativeNode"); + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerStartTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + auto datePickerAbnormal = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(datePickerAbnormal, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(datePickerAbnormal, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, datePicker); + nodeAPI->addChild(column, datePickerAbnormal); + + ArkUI_AttributeItem start_value_item = {.string = "2024-1-1"}; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_START, &start_value_item); + + ArkUI_AttributeItem start_value_abnormal = {.string = ""}; + nodeAPI->setAttribute(datePickerAbnormal, NODE_DATE_PICKER_START, &start_value_abnormal); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerStartTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerStartTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "DatePickerStartTest", "CreateNativeNode"); + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerStartTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePickerLowerAbnormal = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + auto datePickerUpperAbnormal = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePickerLowerAbnormal, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(datePickerUpperAbnormal, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePickerLowerAbnormal, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(datePickerUpperAbnormal, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, datePickerLowerAbnormal); + nodeAPI->addChild(column, datePickerUpperAbnormal); + + ArkUI_AttributeItem start_value_item = {.string = "1111-1-1"}; + nodeAPI->setAttribute(datePickerLowerAbnormal, NODE_DATE_PICKER_START, &start_value_item); + + ArkUI_AttributeItem start_value_abnormal = {.string = "9999-1-1"}; + nodeAPI->setAttribute(datePickerUpperAbnormal, NODE_DATE_PICKER_START, &start_value_abnormal); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerStartTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_start_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_start_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8b2ce2825fb59e6ca0035c73ad64c71da7ed239f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_start_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_START_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_START_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerStartTest { +public: + ~DatePickerStartTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_START_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_textstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_textstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..13a80a3ce612ad901a6a058bfd9ff223935a4c0e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_textstyle_test.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "datepicker_textstyle_test.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem selected_value_item = {.string = "2024-5-1"}; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &selected_value_item); + + return datePicker; +} + +napi_value DatePickerTextStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto datePicker1 = createChildNode(nodeAPI); + auto datePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, datePicker1); + nodeAPI->addChild(column, datePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;normal;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(datePicker1, NODE_DATE_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + ArkUI_AttributeItem abnormal_item = {}; + abnormal_item.string = "abnormal"; + auto abnormal_ret = nodeAPI->setAttribute(datePicker2, NODE_DATE_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_textstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_textstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cd35aac4af7a6ce91e490cbb3854189212336748 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_textstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_TEXTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_TEXTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerTextStyleTest { +public: + ~DatePickerTextStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_TEXTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cbb2b1dd615418cf1550e601adbbb70579143f8f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_width_test.cpp @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "datepicker_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define SIZE_NEGATIVE_100 -100 +#define YEAR 2024 +#define MONTH 1 +#define DATE 1 + +napi_value DatePickerWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerWidthTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置datePicker组件显示日期 + const char *date_picker_value = "2024-01-01"; + ArkUI_AttributeItem date_picker_value_item = {}; + date_picker_value_item.string = date_picker_value; + + // 设置datePicker组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置datePicker组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first datePicker + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(datePicker, NODE_MARGIN, &margin_item); + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &date_picker_value_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // second datePicker + auto datePicker_second = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + nodeAPI->setAttribute(datePicker_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(datePicker_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = SIZE_NEGATIVE_100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker_second, NODE_WIDTH, &width_second_item); + nodeAPI->setAttribute(datePicker_second, NODE_DATE_PICKER_SELECTED, &date_picker_value_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, datePicker); + nodeAPI->insertChildAfter(column, datePicker_second, datePicker); + + // datePicker组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value DatePickerWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerWidthTest", "CreateNativeNodeLarge"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为500 + auto datePicker = nodeAPI->createNode(ARKUI_NODE_DATE_PICKER); + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(datePicker, NODE_WIDTH, &width_item); + + // 设置datePicker组件显示日期 + const char *date_picker_value = "2024-01-01"; + ArkUI_AttributeItem date_picker_value_item = {}; + date_picker_value_item.string = date_picker_value; + nodeAPI->setAttribute(datePicker, NODE_DATE_PICKER_SELECTED, &date_picker_value_item); + + nodeAPI->addChild(column, datePicker); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "DatePickerWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..32572c07ec5accf812cfc975c9383e54089acb70 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/datepicker/datepicker_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_DATEPICKER_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_DATEPICKER_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class DatePickerWidthTest { +public: + ~DatePickerWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_DATEPICKER_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8b32460b61a112f2b3bec4658f08a997f24a0b6a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_height_test.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "flex_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define SIZE_NEGATIVE_50 (-50) + +napi_value FlexHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexHeightTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置flex组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置flex组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置flex组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置flex组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first flex + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + nodeAPI->setAttribute(flex, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(flex, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(flex, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &height_item); + + // second flex + auto flex_second = nodeAPI->createNode(ARKUI_NODE_FLEX); + nodeAPI->setAttribute(flex_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(flex_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(flex_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(flex_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = SIZE_NEGATIVE_50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, flex); + nodeAPI->insertChildAfter(column, flex_second, flex); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value FlexHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexHeightTest", "CreateNativeNodeLarge"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置高度为500 + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &height_item); + + // 设置flex组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置宽度为200 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &width_item); + + nodeAPI->addChild(column, flex); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9297cac4b3105b1dc4ae4b2bc18d1e789987467a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_FLEX_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_FLEX_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class FlexHeightTest { +public: + ~FlexHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_FLEX_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..95d8fa28a9495e6647901b477ac9b5d904effa10 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_width_test.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "flex_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define SIZE_NEGATIVE_100 (-100) + +napi_value FlexWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexWidthTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置flex组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置flex组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置flex组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置flex组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first flex + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + nodeAPI->setAttribute(flex, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(flex, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(flex, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &width_item); + + // second flex + auto flex_second = nodeAPI->createNode(ARKUI_NODE_FLEX); + nodeAPI->setAttribute(flex_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(flex_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(flex_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(flex_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = SIZE_NEGATIVE_100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, flex); + nodeAPI->insertChildAfter(column, flex_second, flex); + + // flex组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value FlexWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexWidthTest", "CreateNativeNodeLarge"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为500 + auto flex = nodeAPI->createNode(ARKUI_NODE_FLEX); + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_WIDTH, &width_item); + + // 设置flex组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置flex组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(flex, NODE_HEIGHT, &default_height_item); + + nodeAPI->addChild(column, flex); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "FlexWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a92edb72a042e3024081268c625cdb6290b2e1bf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/flex/flex_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_FLEX_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_FLEX_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class FlexWidthTest { +public: + ~FlexWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_FLEX_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_alt_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_alt_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a2c023b9a18e9ee17ebfd1fa05379ca33ef8329f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_alt_test.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "image_alt_test.h" +#include +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageAltTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, const char *value) +{ + float width = 200; + float height = 200; + int32_t objectFit = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_NONE; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件背景图片 + ArkUI_AttributeItem srcItem = {}; + srcItem.string = value; + node_api->setAttribute(image, NODE_IMAGE_ALT, &srcItem); + + // 设置组件图片填充效果属性 + ArkUI_NumberValue objectFitValue[] = {{.i32 = objectFit}}; + ArkUI_AttributeItem objectFitItem = {objectFitValue, sizeof(objectFitValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_IMAGE_OBJECT_FIT, &objectFitItem); + + return image; +} + +napi_value ImageAltTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageAltTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageAltTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + const char *value = "resource://media/icon.png"; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = "resource://media/src.jpg"; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = "resource://src/rectIcon.png"; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ""; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = "https://gitee.com/openharmony/docs/raw/master/zh-cn/application-dev/" + "reference/apis-arkui/arkui-ts/figures/edgewidths.png"; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageAltTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_alt_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_alt_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b7d6141ab24c1251b540ea1ed11dd902ae0d8dc1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_alt_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_ALT_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_ALT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageAltTest { +public: + ~ImageAltTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, const char *value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_ALT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_autoresize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_autoresize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6fc65a2cbba4e0410cdff34a4679b77e032b39e6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_autoresize_test.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_autoresize_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageAutoResizeTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t value) +{ + float width = 50; + float height = 50; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(image, NODE_IMAGE_SRC, &src_item); + + // 设置组件图源自动缩放属性 + ArkUI_NumberValue autoresize_value[] = {{.i32 = value}}; + ArkUI_AttributeItem autoresize_item = {autoresize_value, sizeof(autoresize_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_IMAGE_AUTO_RESIZE, &autoresize_item); + + return image; +} + +napi_value ImageAutoResizeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageAutoResizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageAutoResizeTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t value = false; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = true; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageAutoResizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_autoresize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_autoresize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c83f24444a5af36da15cd53cfe6d63ba0648c985 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_autoresize_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_AUTORESIZE_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_AUTORESIZE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageAutoResizeTest { +public: + ~ImageAutoResizeTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_AUTORESIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0da286ff39639888f8dfad77210faf369d6f8f5e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_backgroundcolor_test.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_backgroundcolor_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageBackgroundColorTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, uint32_t color) +{ + float width = 100; + float height = 100; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + if ((node_api->setAttribute(image, NODE_BACKGROUND_COLOR, &background_color_item)) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageBackgroundColorTest", + "set image attribute abnormal value,return result 401"); + } + + return image; +} + +napi_value ImageBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + uint32_t color = 0xFFFF0000; + auto image = CreateSubImageNode(nodeAPI, color); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + color = 0xFF000000; + image = CreateSubImageNode(nodeAPI, color); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b771690ecbfce1691d3f9ba1ef16da9088351b12 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_backgroundcolor_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageBackgroundColorTest { +public: + ~ImageBackgroundColorTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, uint32_t color); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_blur_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_blur_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..df9dadf0481ba95767ef5d5fee679f4a3cf6c2f9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_blur_test.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_blur_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +using namespace std; + +ArkUI_NodeHandle ImageBlurTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float value) +{ + float width = 200; + float height = 200; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(image, NODE_IMAGE_SRC, &src_item); + + // 设置组件模糊半径系数 + ArkUI_NumberValue blur_value[] = {{.f32 = value}}; + ArkUI_AttributeItem blur_item = {blur_value, sizeof(blur_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BLUR, &blur_item); + + return image; +} + +napi_value ImageBlurTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBlurTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBlurTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float value = 0; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 30; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 100; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = -10; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_blur_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_blur_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a7c5a0f4450d479f257d15e715de3019cd4c732d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_blur_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_BLUR_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_BLUR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageBlurTest { +public: + ~ImageBlurTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_ROTATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_bordercolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_bordercolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d1df9f4957697118e7482f22c1d35f73f19a5b1e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_bordercolor_test.cpp @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_bordercolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageBorderColorTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, uint32_t border_color) +{ + float width = 50; + float height = 50; + float border_width = 10; + + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_WIDTH, &border_width_item); + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = border_color}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_COLOR, &border_color_item); + + return image; +} + +ArkUI_NodeHandle ImageBorderColorTest::CreateSubImageNodeWithColors(ArkUI_NativeNodeAPI_1 *node_api, + uint32_t border_color_top, + uint32_t border_color_bottom, + uint32_t border_color_left, + uint32_t border_color_right) +{ + float width = 50; + float height = 50; + float border_width = 10; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_WIDTH, &border_width_item); + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = border_color_top}, + {.u32 = border_color_bottom}, + {.u32 = border_color_left}, + {.u32 = border_color_right}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_COLOR, &border_color_item); + + return image; +} + +napi_value ImageBorderColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + uint32_t border_color = 0xFFFF11FF; + auto image = CreateSubImageNode(nodeAPI, border_color); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + border_color = 0xFF000000; + image = CreateSubImageNode(nodeAPI, border_color); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + uint32_t border_color_top = 0xFF00FF00; + uint32_t border_color_bottom = 0xFFFF0000; + uint32_t border_color_left = 0xFFFFFF00; + uint32_t border_color_right = 0xFFFFFFFF; + image = CreateSubImageNodeWithColors(nodeAPI, border_color_top, border_color_bottom, border_color_left, + border_color_right); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + border_color_top = 0xFF888888; + border_color_bottom = 0xFF00FF00; + border_color_left = 0xFFCCCCCC; + border_color_right = 0xFFFF00FF; + image = CreateSubImageNodeWithColors(nodeAPI, border_color_top, border_color_bottom, border_color_left, + border_color_right); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_bordercolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_bordercolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b17b71b0073190dc42e8d1a4b2fb4677b07ef3a0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_bordercolor_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_BORDERCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_BORDERCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageBorderColorTest { +public: + ~ImageBorderColorTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, uint32_t border_color); + static ArkUI_NodeHandle CreateSubImageNodeWithColors(ArkUI_NativeNodeAPI_1 *node_api, uint32_t border_color_top, + uint32_t border_color_bottom, uint32_t border_color_left, + uint32_t border_color_right); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_BORDERCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderradius_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderradius_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9127a925a1dc2e4172e6675094a9ababaabb3cbd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderradius_test.cpp @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_borderradius_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageBorderRadiusTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float border_radius) +{ + float width = 50; + float height = 50; + float border_width = 10; + + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件边框圆角值 + ArkUI_NumberValue border_radius_value[] = {{.f32 = border_radius}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_RADIUS, &border_radius_item); + + return image; +} + +ArkUI_NodeHandle ImageBorderRadiusTest::CreateSubImageNodeWithBorderRadius(ArkUI_NativeNodeAPI_1 *node_api, + float border_radius_left_top, + float border_radius_right_top, + float border_radius_left_bottom, + float border_radius_right_bottom) +{ + float width = 50; + float height = 50; + float border_width = 10; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_WIDTH, &border_width_item); + // 设置组件边框圆角值 + ArkUI_NumberValue border_radius_value[] = {{.f32 = border_radius_left_top}, + {.f32 = border_radius_right_top}, + {.f32 = border_radius_left_bottom}, + {.f32 = border_radius_right_bottom}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_RADIUS, &border_radius_item); + + return image; +} + +napi_value ImageBorderRadiusTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderRadiusTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + uint32_t border_radius = 5; + auto image = CreateSubImageNode(nodeAPI, border_radius); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + border_radius = 15; + image = CreateSubImageNode(nodeAPI, border_radius); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + border_radius = 35; + image = CreateSubImageNode(nodeAPI, border_radius); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + uint32_t border_radius_left_top = 5; + uint32_t border_radius_right_top = 8; + uint32_t border_radius_left_bottom = 10; + uint32_t border_radius_right_bottom = 12; + image = CreateSubImageNodeWithBorderRadius(nodeAPI, border_radius_left_top, border_radius_right_top, + border_radius_left_bottom, border_radius_right_bottom); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + border_radius_left_top = 15; + border_radius_right_top = 16; + border_radius_left_bottom = 17; + border_radius_right_bottom = 18; + image = CreateSubImageNodeWithBorderRadius(nodeAPI, border_radius_left_top, border_radius_right_top, + border_radius_left_bottom, border_radius_right_bottom); + nodeAPI->addChild(column, image); + + border_radius_left_top = 35; + border_radius_right_top = 35; + border_radius_left_bottom = 35; + border_radius_right_bottom = 35; + image = CreateSubImageNodeWithBorderRadius(nodeAPI, border_radius_left_top, border_radius_right_top, + border_radius_left_bottom, border_radius_right_bottom); + nodeAPI->addChild(column, image); + + border_radius = -10; + image = CreateSubImageNode(nodeAPI, border_radius); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + border_radius_left_top = -10; + border_radius_right_top = -10; + border_radius_left_bottom = -10; + border_radius_right_bottom = -10; + image = CreateSubImageNodeWithBorderRadius(nodeAPI, border_radius_left_top, border_radius_right_top, + border_radius_left_bottom, border_radius_right_bottom); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderradius_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderradius_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8cc12f4099eea045a56d297390744a0246833c14 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderradius_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_BORDERRADIUS_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_BORDERRADIUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageBorderRadiusTest { +public: + ~ImageBorderRadiusTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float border_radius); + static ArkUI_NodeHandle CreateSubImageNodeWithBorderRadius(ArkUI_NativeNodeAPI_1 *node_api, + float border_radius_left_top, + float border_radius_right_top, + float border_radius_left_bottom, + float border_radius_right_bottom); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_BORDERRADIUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..72f916932d4507eb0f3f9c16fd8ac57e4c32bc5d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderstyle_test.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_borderstyle_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageBorderStyleTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t borderStyle) +{ + float width = 100; + float height = 100; + float borderWidth = 10; + uint32_t backgroundColor = 0xFFFF0000; + auto image = nodeApi->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件背景色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + // 设置组件边框宽度 + ArkUI_NumberValue borderWidthValue[] = {{.f32 = borderWidth}}; + ArkUI_AttributeItem borderWidthItem = {borderWidthValue, sizeof(borderWidthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_BORDER_WIDTH, &borderWidthItem); + + // 设置组件边框线条样式属性 + ArkUI_NumberValue borderStyleValue[] = {{.i32 = borderStyle}}; + ArkUI_AttributeItem borderStyleItem = {borderStyleValue, sizeof(borderStyleValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_BORDER_STYLE, &borderStyleItem); + + return image; +} + +ArkUI_NodeHandle ImageBorderStyleTest::CreateSubImageNodeWithStyles(ArkUI_NativeNodeAPI_1 *nodeApi, + int32_t borderStyleTop, int32_t borderStyleRight, + int32_t borderStyleBottom, int32_t borderStyleLeft) +{ + float width = 100; + float height = 100; + float borderWidth = 10; + uint32_t backgroundColor = 0xFFFF0000; + auto image = nodeApi->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件背景色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + // 设置组件边框宽度 + ArkUI_NumberValue borderWidthValue[] = {{.f32 = borderWidth}}; + ArkUI_AttributeItem borderWidthItem = {borderWidthValue, sizeof(borderWidthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_BORDER_WIDTH, &borderWidthItem); + + // 设置组件边框线条样式属性 + ArkUI_NumberValue borderStyleValue[] = { + {.i32 = borderStyleTop}, {.i32 = borderStyleRight}, {.i32 = borderStyleBottom}, {.i32 = borderStyleLeft}}; + ArkUI_AttributeItem borderStyleItem = {borderStyleValue, sizeof(borderStyleValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_BORDER_STYLE, &borderStyleItem); + + return image; +} + +napi_value ImageBorderStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderStyleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderStyleTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t borderStyle = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID; + auto image = CreateSubImageNode(nodeAPI, borderStyle); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + borderStyle = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DASHED; + image = CreateSubImageNode(nodeAPI, borderStyle); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + borderStyle = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DOTTED; + image = CreateSubImageNode(nodeAPI, borderStyle); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + int32_t borderStyleTop = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID; + int32_t borderStyleRight = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DASHED; + int32_t borderStyleBottom = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID; + int32_t borderStyleLeft = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DOTTED; + image = CreateSubImageNodeWithStyles(nodeAPI, borderStyleTop, borderStyleRight, borderStyleBottom, borderStyleLeft); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + borderStyleTop = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID; + borderStyleRight = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID; + borderStyleBottom = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID; + borderStyleLeft = ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID; + image = CreateSubImageNodeWithStyles(nodeAPI, borderStyleTop, borderStyleRight, borderStyleBottom, borderStyleLeft); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + borderStyle = PARAM_NEGATIVE_1; + image = CreateSubImageNode(nodeAPI, borderStyle); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + borderStyle = DEFAULT_MARGIN; + image = CreateSubImageNode(nodeAPI, borderStyle); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..44722b433e2637adc625a1e8ac89ff3a95d9be6b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderstyle_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_BORDERSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_BORDERSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageBorderStyleTest { +public: + ~ImageBorderStyleTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t borderStyle); + static ArkUI_NodeHandle CreateSubImageNodeWithStyles(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t borderStyleTop, + int32_t borderStyleRight, int32_t borderStyleBottom, + int32_t borderStyleLeft); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_BORDERSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderwidth_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderwidth_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..265cdee64fd4006971dae8d08aec071b12a0ec10 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderwidth_test.cpp @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_borderwidth_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageBorderWidthTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float border_width) +{ + float width = 50; + float height = 50; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_WIDTH, &border_width_item); + + return image; +} + +ArkUI_NodeHandle ImageBorderWidthTest::CreateSubImageNodeWithWidths(ArkUI_NativeNodeAPI_1 *node_api, + float border_width_top, float border_width_bottom, + float border_width_left, float border_width_right) +{ + float width = 50; + float height = 50; + uint32_t border_color = 0xFFFFFFFF; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width_top}, + {.f32 = border_width_bottom}, + {.f32 = border_width_left}, + {.f32 = border_width_right}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_WIDTH, &border_width_item); + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = border_color}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_COLOR, &border_color_item); + + return image; +} + +napi_value ImageBorderWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float border_width = 5; + auto image = CreateSubImageNode(nodeAPI, border_width); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + border_width = 20; + image = CreateSubImageNode(nodeAPI, border_width); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + float border_width_top = 5; + float border_width_bottom = 2; + float border_width_left = 2; + float border_width_right = 10; + image = CreateSubImageNodeWithWidths(nodeAPI, border_width_top, border_width_bottom, border_width_left, + border_width_right); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + border_width_top = 10; + border_width_bottom = 20; + border_width_left = 30; + border_width_right = 20; + image = CreateSubImageNodeWithWidths(nodeAPI, border_width_top, border_width_bottom, border_width_left, + border_width_right); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + border_width = -10; + image = CreateSubImageNode(nodeAPI, border_width); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + border_width_top = -10; + border_width_bottom = -10; + border_width_left = -10; + border_width_right = -10; + image = CreateSubImageNodeWithWidths(nodeAPI, border_width_top, border_width_bottom, border_width_left, + border_width_right); + // 添加组件到容器 + nodeAPI->addChild(column, image); + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderwidth_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderwidth_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e740570daad387e2c73d37a9b92cd5dfbd9479fc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_borderwidth_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_BORDERWIDTH_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_BORDERWIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageBorderWidthTest { +public: + ~ImageBorderWidthTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float border_width); + static ArkUI_NodeHandle CreateSubImageNodeWithWidths(ArkUI_NativeNodeAPI_1 *node_api, float border_width_top, + float border_width_bottom, float border_width_left, + float border_width_right); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_BORDERWIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_brightness_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_brightness_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b58316b073faff5c3ec009a7c7b88f7bbb452a77 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_brightness_test.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_brightness_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageBrightnessTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float value) +{ + float width = 50; + float height = 50; + uint32_t background_color = 0xFFFF0000; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件高光效果系数 + ArkUI_NumberValue brightness_value[] = {{.f32 = value}}; + ArkUI_AttributeItem brightness_item = {brightness_value, sizeof(brightness_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BRIGHTNESS, &brightness_item); + + return image; +} + +napi_value ImageBrightnessTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBrightnessTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBrightnessTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float value = 0; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 0.5; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 1; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 1.5; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 2; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = -1; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 3; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_brightness_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_brightness_test.h new file mode 100644 index 0000000000000000000000000000000000000000..650e05f765c66f7dc503c098e97be6d7b33d8cfe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_brightness_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_BRIGHTNESS_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_BRIGHTNESS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageBrightnessTest { +public: + ~ImageBrightnessTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_BRIGHTNESS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7ee2a8698a82f3fe07099157b7d5ad943716987e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_clip_test.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_clip_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageClipTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t value) +{ + float width = 100; + float height = 100; + float clipTypeRectangleWidth = 100; + float clipTypeRectangleHeight = 80; + float clipTypeRectangleRadiusWidth = 20; + float clipTypeRectangleRadiusHeight = 20; + float clipTypeCircleWidth = 80; + float clipTypeCircleHeight = 80; + float clipTypeEllipseWidth = 80; + float clipTypeEllipseHeight = 60; + float clipTypePathWidth = 100; + float clipTypePathHeight = 100; + const char *typePath = "M30 0 L50 50 L0 50 Z"; + + uint32_t backgroundColor = 0xFFFF0000; + auto image = nodeApi->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件背景色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + // 设置按指定的形状对当前组件进行裁剪 + switch (value) { + case ArkUI_ClipType::ARKUI_CLIP_TYPE_RECTANGLE: { + ArkUI_NumberValue clipShapeValue[] = {{.i32 = ArkUI_ClipType::ARKUI_CLIP_TYPE_RECTANGLE}, + {.f32 = clipTypeRectangleWidth}, + {.f32 = clipTypeRectangleHeight}, + {.f32 = clipTypeRectangleRadiusWidth}, + {.f32 = clipTypeRectangleRadiusHeight}}; + ArkUI_AttributeItem clipShapeItem = {clipShapeValue, sizeof(clipShapeValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_CLIP_SHAPE, &clipShapeItem); + } break; + case ArkUI_ClipType::ARKUI_CLIP_TYPE_CIRCLE: { + ArkUI_NumberValue clipShapeValue[] = {{.i32 = ArkUI_ClipType::ARKUI_CLIP_TYPE_CIRCLE}, + {.f32 = clipTypeCircleWidth}, + {.f32 = clipTypeCircleHeight}}; + ArkUI_AttributeItem clipShapeItem = {clipShapeValue, sizeof(clipShapeValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_CLIP_SHAPE, &clipShapeItem); + } break; + case ArkUI_ClipType::ARKUI_CLIP_TYPE_ELLIPSE: { + ArkUI_NumberValue clipShapeValue[] = {{.i32 = ArkUI_ClipType::ARKUI_CLIP_TYPE_ELLIPSE}, + {.f32 = clipTypeEllipseWidth}, + {.f32 = clipTypeEllipseHeight}}; + ArkUI_AttributeItem clipShapeItem = {clipShapeValue, sizeof(clipShapeValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_CLIP_SHAPE, &clipShapeItem); + } break; + case ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH: { + ArkUI_NumberValue clipShapeValue[] = { + {.i32 = ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH}, {.f32 = clipTypePathWidth}, {.f32 = clipTypePathHeight}}; + ArkUI_AttributeItem clipShapeItem = {clipShapeValue, sizeof(clipShapeValue) / sizeof(ArkUI_NumberValue)}; + clipShapeItem.string = typePath; + nodeApi->setAttribute(image, NODE_CLIP_SHAPE, &clipShapeItem); + } break; + default: + break; + } + + return image; +} + +napi_value ImageClipTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageClipTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageClipTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t value = ArkUI_ClipType::ARKUI_CLIP_TYPE_RECTANGLE; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ClipType::ARKUI_CLIP_TYPE_CIRCLE; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ClipType::ARKUI_CLIP_TYPE_ELLIPSE; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e0584f3a4f2ddf4841ad0994838c6ae3f9acefe0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_clip_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_CLIP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class ImageClipTest { +public: + ~ImageClipTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_colorfilter_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_colorfilter_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6291b1d19c80373cd9ca076d1bcab2ac29b85653 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_colorfilter_test.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_colorfilter_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageColorFilterTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, float colorFilter[20]) +{ + float width = 200; + float height = 200; + auto image = nodeApi->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件背景图片 + ArkUI_AttributeItem srcItem = {}; + srcItem.string = "resource://media/icon.png"; + nodeApi->setAttribute(image, NODE_IMAGE_SRC, &srcItem); + + // 设置组件颜色滤镜效果 + ArkUI_NumberValue colorFilterValue[20] = { + {.f32 = colorFilter[0]}, {.f32 = colorFilter[1]}, {.f32 = colorFilter[2]}, {.f32 = colorFilter[3]}, + {.f32 = colorFilter[4]}, {.f32 = colorFilter[5]}, {.f32 = colorFilter[6]}, {.f32 = colorFilter[7]}, + {.f32 = colorFilter[8]}, {.f32 = colorFilter[9]}, {.f32 = colorFilter[10]}, {.f32 = colorFilter[11]}, + {.f32 = colorFilter[12]}, {.f32 = colorFilter[13]}, {.f32 = colorFilter[14]}, {.f32 = colorFilter[15]}, + {.f32 = colorFilter[16]}, {.f32 = colorFilter[17]}, {.f32 = colorFilter[18]}, {.f32 = colorFilter[19]}}; + ArkUI_AttributeItem colorFilterItem = {colorFilterValue, sizeof(colorFilterValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_IMAGE_COLOR_FILTER, &colorFilterItem); + + return image; +} + +napi_value ImageColorFilterTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageColorFilterTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageColorFilterTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float colorFilterOriginal[20] = {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0}; + auto image = CreateSubImageNode(nodeAPI, colorFilterOriginal); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + float colorFilterGreen[20] = {1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 255}; + image = CreateSubImageNode(nodeAPI, colorFilterGreen); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + float colorFilterException[20] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; + image = CreateSubImageNode(nodeAPI, colorFilterException); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageColorFilterTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_colorfilter_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_colorfilter_test.h new file mode 100644 index 0000000000000000000000000000000000000000..33379482f6ce449f3e7b337980c6aebf12918f36 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_colorfilter_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_COLORFILTER_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_COLORFILTER_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageColorFilterTest { +public: + ~ImageColorFilterTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float colorFilter[20]); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_COLORFILTER_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..223d988d481d9f861692d80e200b0fb13ee03a05 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_height_test.cpp @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ImageHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置image组件背景图片 + const char *image_url = "./resources/base/media/icon.png"; + ArkUI_AttributeItem background_image_value_item = {}; + background_image_value_item.string = image_url; + + // 设置image组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置image组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置image组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first image + auto image = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(image, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(image, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(image, NODE_IMAGE_SRC, &background_image_value_item); + nodeAPI->setAttribute(image, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(image, NODE_HEIGHT, &height_item); + + // second image + auto image_second = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(image_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(image_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(image_second, NODE_IMAGE_SRC, &background_image_value_item); + nodeAPI->setAttribute(image_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(image_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, image); + nodeAPI->insertChildAfter(column, image_second, image); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ImageHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置高度为500 + auto image = nodeAPI->createNode(ARKUI_NODE_IMAGE); + ArkUI_NumberValue height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置image组件背景图片 + const char *image_url = "./resources/base/media/icon.png"; + ArkUI_AttributeItem background_image_value_item = {}; + background_image_value_item.string = image_url; + nodeAPI->setAttribute(image, NODE_IMAGE_SRC, &background_image_value_item); + + // 设置宽度为200 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(image, NODE_WIDTH, &width_item); + + nodeAPI->addChild(column, image); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..632ec5be8245e30475b51fd8b34a6fc6764c4676 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageHeightTest { +public: + ~ImageHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_hittestbehavior_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_hittestbehavior_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d7f6ba093ee3a57670c4f4fa51f9248d19768f3b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_hittestbehavior_test.cpp @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_hittestbehavior_test.h" +#include "../manager/plugin_manager.h" +#include + +#define IMAGE_ON_TOUCH_EVENT_ID 7001 +#define IMAGE_BROTHER_ON_TOUCH_EVENT_ID 7002 + +namespace ArkUICApiDemo { + +void ImageHitTestBehaviorTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t backgroundColor = 0xFF0000FF; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == IMAGE_ON_TOUCH_EVENT_ID) { + backgroundColor = 0xFF0000FF; + } else { + backgroundColor = 0xFF000000; + } + // 如果是触摸事件 + if ((eventId == IMAGE_ON_TOUCH_EVENT_ID) || (eventId == IMAGE_BROTHER_ON_TOUCH_EVENT_ID)) { + // 修改组件背景色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &backgroundColorItem); + return; + } +} + +ArkUI_NodeHandle ImageHitTestBehaviorTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t hitTestBehavior, + const char *onTouchTestStack) +{ + float stackWidth = 80; + float stackHeight = 80; + float imageWidth = 60; + float imageHeight = 60; + float imageBrotherWidth = 40; + float imageBrotherHeight = 40; + uint32_t stackBackgroundColor = 0xFF888888; + uint32_t imageBackgroundColor = 0xFFFF0000; + uint32_t imageBrotherBackgroundColor = 0xFF00FF00; + + // 创建容器组件 + auto stack = nodeApi->createNode(ARKUI_NODE_STACK); + auto image = nodeApi->createNode(ARKUI_NODE_IMAGE); + auto imageBrother = nodeApi->createNode(ARKUI_NODE_IMAGE); + + // 设置容器ID + ArkUI_AttributeItem idItem = {}; + idItem.string = onTouchTestStack; + nodeApi->setAttribute(stack, NODE_ID, &idItem); + + // 设置容器大小 + ArkUI_NumberValue stackWidthValue[] = {{.f32 = stackWidth}}; + ArkUI_AttributeItem stackWidthItem = {stackWidthValue, sizeof(stackWidthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(stack, NODE_WIDTH, &stackWidthItem); + + ArkUI_NumberValue stackHeightValue[] = {{.f32 = stackHeight}}; + ArkUI_AttributeItem stackHeightItem = {stackHeightValue, sizeof(stackHeightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(stack, NODE_HEIGHT, &stackHeightItem); + + // 设置容器组件背景色 + ArkUI_NumberValue stackBackgroundColorValue[] = {{.u32 = stackBackgroundColor}}; + ArkUI_AttributeItem stackBackgroundColorItem = {stackBackgroundColorValue, + sizeof(stackBackgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(stack, NODE_BACKGROUND_COLOR, &stackBackgroundColorItem); + + // 设置image组件大小 + ArkUI_NumberValue imageWidthValue[] = {{.f32 = imageWidth}}; + ArkUI_AttributeItem imageWidthItem = {imageWidthValue, sizeof(imageWidthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_WIDTH, &imageWidthItem); + + ArkUI_NumberValue imageHeightValue[] = {{.f32 = imageHeight}}; + ArkUI_AttributeItem imageHeightItem = {imageHeightValue, sizeof(imageHeightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_HEIGHT, &imageHeightItem); + + // 设置image组件背景色 + ArkUI_NumberValue imageBackgroundColorValue[] = {{.u32 = imageBackgroundColor}}; + ArkUI_AttributeItem imageBackgroundColorItem = {imageBackgroundColorValue, + sizeof(imageBackgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_BACKGROUND_COLOR, &imageBackgroundColorItem); + + // 绑定image触摸事件 + nodeApi->registerNodeEvent(image, NODE_TOUCH_EVENT, IMAGE_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "IMAGE_ON_TOUCH_EVENT_ID", "IMAGE_ON_TOUCH_EVENT_ID"); + + // 添加组件到容器 + nodeApi->addChild(stack, image); + + // 设置imageBrother组件大小 + ArkUI_NumberValue imageBrotherWidthValue[] = {{.f32 = imageBrotherWidth}}; + ArkUI_AttributeItem imageBrotherWidthItem = {imageBrotherWidthValue, + sizeof(imageBrotherWidthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(imageBrother, NODE_WIDTH, &imageBrotherWidthItem); + + ArkUI_NumberValue imageBrotherHeightValue[] = {{.f32 = imageBrotherHeight}}; + ArkUI_AttributeItem imageBrotherHeightItem = {imageBrotherHeightValue, + sizeof(imageBrotherHeightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(imageBrother, NODE_HEIGHT, &imageBrotherHeightItem); + + // 设置imageBrother组件背景色 + ArkUI_NumberValue imageBrotherBackgroundColorValue[] = {{.u32 = imageBrotherBackgroundColor}}; + ArkUI_AttributeItem imageBrotherBackgroundColorItem = { + imageBrotherBackgroundColorValue, sizeof(imageBrotherBackgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(imageBrother, NODE_BACKGROUND_COLOR, &imageBrotherBackgroundColorItem); + + // 设置imageBrother组件触摸测试类型值 + ArkUI_NumberValue imageBrotherHitTestBehaviorValue[] = {{.i32 = hitTestBehavior}}; + ArkUI_AttributeItem imageBrotherHitTestBehaviorItem = { + imageBrotherHitTestBehaviorValue, sizeof(imageBrotherHitTestBehaviorValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(imageBrother, NODE_HIT_TEST_BEHAVIOR, &imageBrotherHitTestBehaviorItem); + + nodeApi->registerNodeEvent(imageBrother, NODE_TOUCH_EVENT, IMAGE_BROTHER_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "IMAGE_BROTHER_ON_TOUCH_EVENT_ID", + "IMAGE_BROTHER_ON_TOUCH_EVENT_ID"); + + // 添加组件到容器 + nodeApi->addChild(stack, imageBrother); + + return stack; +} + +napi_value ImageHitTestBehaviorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageHitTestBehaviorTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_DEFAULT; + string onTouchTestStack = "OnTouchTestStackDefault"; + auto stack = CreateSubImageNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_BLOCK; + onTouchTestStack = "OnTouchTestStackBlock"; + stack = CreateSubImageNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_TRANSPARENT; + onTouchTestStack = "OnTouchTestStackTransparent"; + stack = CreateSubImageNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + hitTestBehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_NONE; + onTouchTestStack = "OnTouchTestStackNone"; + stack = CreateSubImageNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + hitTestBehavior = PARAM_NEGATIVE_1; + onTouchTestStack = "OnTouchTestStackExceptBelow"; + stack = CreateSubImageNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + hitTestBehavior = PARAM_4; + onTouchTestStack = "OnTouchTestStackExceptAbove"; + stack = CreateSubImageNode(nodeAPI, hitTestBehavior, onTouchTestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_hittestbehavior_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_hittestbehavior_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b80a537ddea58df29e0c238377db9266c28387ff --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_hittestbehavior_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_HITTESTBEHAVIOR_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_HITTESTBEHAVIOR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class ImageHitTestBehaviorTest { +public: + ~ImageHitTestBehaviorTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t hitTestBehavior, + const char *onTouchTestStack); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_HITTESTBEHAVIOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_id_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_id_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bdd98dd8eeb2d9f8ed16c734aa4e9b25ef830613 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_id_test.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "image_id_test.h" +#include + +#define IMAGE_FIRST_ON_TOUCH_EVENT_ID 7001 +#define IMAGE_SECOND_ON_TOUCH_EVENT_ID 7002 + +namespace ArkUICApiDemo { + +void ImageIdTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t backgroundColor = 0xFF0000FF; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == IMAGE_FIRST_ON_TOUCH_EVENT_ID) { + backgroundColor = 0xFF0000FF; + } else { + backgroundColor = 0xFF000000; + } + + if ((eventId == IMAGE_FIRST_ON_TOUCH_EVENT_ID) || (eventId == IMAGE_SECOND_ON_TOUCH_EVENT_ID)) { + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &backgroundColorItem); + return; + } +} + +ArkUI_NodeHandle ImageIdTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, const char *id, uint32_t eventId) +{ + float width = 200; + float height = 200; + uint32_t backgroundColor = 0xFFFF0000; + + // 创建组件 + auto text = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件Id + ArkUI_AttributeItem idItem = {}; + idItem.string = id; + node_api->setAttribute(text, NODE_ID, &idItem); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(text, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(text, NODE_HEIGHT, &heightItem); + + // 设置组件背景色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(text, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + // 绑定组件事件 + node_api->registerNodeEvent(text, NODE_TOUCH_EVENT, eventId, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "IMAGE_ON_TOUCH_EVENT_ID", "IMAGE_ON_TOUCH_EVENT_ID"); + + return text; +} + +napi_value ImageIdTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageIdTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageIdTest", "GetContext env or info is null"); + return nullptr; + } + // 创建组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t commonAttrsFirstEventId = IMAGE_FIRST_ON_TOUCH_EVENT_ID; + const char *commonAttrsFirstId = "onTouchFirst"; + ; + auto text = CreateSubImageNode(nodeAPI, commonAttrsFirstId, commonAttrsFirstEventId); + // 添加组件到容器组件 + nodeAPI->addChild(column, text); + + int32_t commonAttrsSecondEventId = IMAGE_SECOND_ON_TOUCH_EVENT_ID; + const char *commonAttrsSecondId = "onTouchSecond"; + ; + text = CreateSubImageNode(nodeAPI, commonAttrsSecondId, commonAttrsSecondEventId); + // 添加组件到容器组件 + nodeAPI->addChild(column, text); + + // bind node callBack event receiver + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 绑定组件 + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageIdTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_id_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_id_test.h new file mode 100644 index 0000000000000000000000000000000000000000..960b9944c268fb6d192690c8583fc9c44f5dcb61 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_id_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_ID_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_ID_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class ImageIdTest { +public: + ~ImageIdTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, const char *id, uint32_t eventId); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_ID_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_interpolation_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_interpolation_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a417226c349282a4406ed2e12b467b5fc6f1eb37 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_interpolation_test.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_interpolation_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageInterpolationTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t value) +{ + float width = 130; + float height = 130; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(image, NODE_IMAGE_SRC, &src_item); + + // 设置组件图片的插值效果 + ArkUI_NumberValue interpolation_value[] = {{.i32 = value}}; + ArkUI_AttributeItem interpolation_item = {interpolation_value, + sizeof(interpolation_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_IMAGE_INTERPOLATION, &interpolation_item); + + return image; +} + +napi_value ImageInterpolationTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageInterpolationTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageInterpolationTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t value = ArkUI_ImageInterpolation::ARKUI_IMAGE_INTERPOLATION_NONE; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ImageInterpolation::ARKUI_IMAGE_INTERPOLATION_LOW; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ImageInterpolation::ARKUI_IMAGE_INTERPOLATION_MEDIUM; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ImageInterpolation::ARKUI_IMAGE_INTERPOLATION_HIGH; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = -1; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 10; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageInterpolationTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_interpolation_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_interpolation_test.h new file mode 100644 index 0000000000000000000000000000000000000000..35dbb76c334222c48663f4b057deb54395fb0fda --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_interpolation_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_INTERPOLATION_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_INTERPOLATION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageInterpolationTest { +public: + ~ImageInterpolationTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_INTERPOLATION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_lineargradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_lineargradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7ab731680e66ed708bfefe62b7a5dbe64e07f340 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_lineargradient_test.cpp @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_lineargradient_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageLinearGradientTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float angle, + int32_t direction, int32_t repeating, uint32_t color) +{ + float width = 70; + float height = 70; + uint32_t background_colors_value[] = {0xFFFF0000, color}; + float stops[] = {0.0, 0.5}; + int32_t background_colors_count_value = 2; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件颜色渐变效果 + ArkUI_ColorStop color_stop = {background_colors_value, stops, background_colors_count_value}; + ArkUI_NumberValue lineargradient_value[] = {{.f32 = angle}, {.i32 = direction}, {.i32 = repeating}}; + ArkUI_AttributeItem lineargradient_item = {lineargradient_value, + sizeof(lineargradient_value) / sizeof(ArkUI_NumberValue)}; + lineargradient_item.object = &color_stop; + node_api->setAttribute(image, NODE_LINEAR_GRADIENT, &lineargradient_item); + + return image; +} + +napi_value ImageLinearGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column_left = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto column_right = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + + float angle = 0; + int32_t direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT; + int32_t repeating = false; + uint32_t color = 0xFF00FF00; + auto image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_left, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_TOP; + repeating = false; + color = 0xFF00FF00; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_left, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT; + repeating = false; + color = 0xFF00FF00; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_left, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM; + repeating = false; + color = 0xFF00FF00; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_left, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP; + repeating = false; + color = 0xFF00FF00; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_left, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM; + repeating = false; + color = 0xFF00FF00; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_left, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP; + repeating = false; + color = 0xFF00FF00; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_left, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM; + repeating = false; + color = 0xFF00FF00; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_left, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_NONE; + repeating = false; + color = 0xFF00FF00; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_left, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM; + repeating = false; + color = 0xFF00FF00; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_left, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT; + repeating = true; + color = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_right, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_TOP; + repeating = true; + color = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_right, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT; + repeating = true; + color = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_right, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM; + repeating = true; + color = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_right, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP; + repeating = true; + color = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_right, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM; + repeating = true; + color = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_right, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP; + repeating = true; + color = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_right, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM; + repeating = true; + color = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_right, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_NONE; + repeating = true; + color = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_right, image); + + angle = 0; + direction = ArkUI_LinearGradientDirection::ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM; + repeating = true; + color = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, angle, direction, repeating, color); + // 添加组件到容器 + nodeAPI->addChild(column_right, image); + + // 添加组件到容器 + nodeAPI->addChild(row, column_left); + nodeAPI->addChild(row, column_right); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_lineargradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_lineargradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cea56597c57b8bf3c98dd17168c38f817cedd5ae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_lineargradient_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_LINEARGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_LINEARGRADIENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageLinearGradientTest { +public: + ~ImageLinearGradientTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float angle, int32_t direction, + int32_t repeating, uint32_t color); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_LINEARGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectfit_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectfit_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2fcae80605c437797980cc7dd3572bdbc0e6fe88 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectfit_test.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_objectfit_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageObjectFitTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t value) +{ + float width = 100; + float height = 100; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件背景图片 + ArkUI_AttributeItem srcItem = {}; + srcItem.string = "resource://media/icon.png"; + node_api->setAttribute(image, NODE_IMAGE_SRC, &srcItem); + + // 设置组件图片填充效果属性 + ArkUI_NumberValue objectFitValue[] = {{.i32 = value}}; + ArkUI_AttributeItem objectFitItem = {objectFitValue, sizeof(objectFitValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_IMAGE_OBJECT_FIT, &objectFitItem); + + return image; +} + +napi_value ImageObjectFitTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageObjectFitTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageObjectFitTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t value = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_CONTAIN; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_COVER; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_AUTO; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_FILL; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_SCALE_DOWN; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_NONE; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = PARAM_NEGATIVE_1; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = DEFAULT_MARGIN; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageObjectFitTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectfit_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectfit_test.h new file mode 100644 index 0000000000000000000000000000000000000000..15def411184cd6707642b2ad4ef49d1e9e428a98 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectfit_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_OBJECTFIT_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_OBJECTFIT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageObjectFitTest { +public: + ~ImageObjectFitTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_OBJECTFIT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectrepeat_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectrepeat_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a28589e3a762554836b3c2706dcdbba8dd15fafd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectrepeat_test.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_objectrepeat_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageObjectRepeatTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t value) +{ + float width = 100; + float height = 100; + int32_t objectFit = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_NONE; + + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon_small.png"; + node_api->setAttribute(image, NODE_IMAGE_SRC, &src_item); + + // 设置组件图片填充效果属性 + ArkUI_NumberValue objectfit_value[] = {{.i32 = objectFit}}; + ArkUI_AttributeItem objectfit_item = {objectfit_value, sizeof(objectfit_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_IMAGE_OBJECT_FIT, &objectfit_item); + + // 设置组件图片重复样式属性 + ArkUI_NumberValue objectrepeat_value[] = {{.i32 = value}}; + ArkUI_AttributeItem objectrepeat_item = {objectrepeat_value, + sizeof(objectrepeat_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_IMAGE_OBJECT_REPEAT, &objectrepeat_item); + + return image; +} + +napi_value ImageObjectRepeatTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageObjectRepeatTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageObjectRepeatTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t value = ArkUI_ImageRepeat::ARKUI_IMAGE_REPEAT_NONE; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ImageRepeat::ARKUI_IMAGE_REPEAT_X; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ImageRepeat::ARKUI_IMAGE_REPEAT_Y; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ImageRepeat::ARKUI_IMAGE_REPEAT_XY; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = -1; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 10; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageObjectRepeatTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectrepeat_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectrepeat_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f7425927962a2cf709cc083a2115d6086a5d7143 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_objectrepeat_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_OBJECTREPEAT_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_OBJECTREPEAT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageObjectRepeatTest { +public: + ~ImageObjectRepeatTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_OBJECTREPEAT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_oncomplete_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_oncomplete_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..adf76956c4fb21c5696a60847109cd23dca47b17 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_oncomplete_test.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "image_oncomplete_test.h" +#include + +#define ON_TOUCH_EVENT_ID 7001 +#define ON_COMPLETE_EVENT_ID 8001 + +namespace ArkUICApiDemo { + +static bool hasOnCompleteInit = false; + +void ImageOnCompleteTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t backgroundColor = COLOR_GREEN; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_TOUCH_EVENT_ID) { + hasOnCompleteInit = true; + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + nodeAPI->setAttribute(nodeHandler, NODE_IMAGE_SRC, &src_item); + } + + if ((hasOnCompleteInit == true) || (eventId == ON_COMPLETE_EVENT_ID)) { + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &backgroundColorItem); + return; + } +} + +ArkUI_NodeHandle ImageOnCompleteTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, const char *id, + uint32_t eventId) +{ + float width = SIZE_200; + float height = SIZE_200; + uint32_t backgroundColor = COLOR_RED; + + // 创建节点组件 + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置image组件id + ArkUI_AttributeItem idItem = {}; + idItem.string = id; + node_api->setAttribute(image, NODE_ID, &idItem); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件背景颜色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + // 绑定image触摸事件 + node_api->registerNodeEvent(image, NODE_TOUCH_EVENT, eventId, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "IMAGE_ON_TOUCH_EVENT_ID", "IMAGE_ON_TOUCH_EVENT_ID"); + + return image; +} + +napi_value ImageOnCompleteTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageOnCompleteTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageOnCompleteTest", "GetConimage env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t onTouchEventId = ON_TOUCH_EVENT_ID; + const char *imageId = "onTouchEvent"; + ; + auto image = CreateSubImageNode(nodeAPI, imageId, onTouchEventId); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEvent(image, NODE_IMAGE_ON_COMPLETE, ON_COMPLETE_EVENT_ID, nullptr); + + // 绑定组件回调函数 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageOnCompleteTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_oncomplete_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_oncomplete_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d0c9667a51a56caf89cc320d053a662f2f6d4f83 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_oncomplete_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_ONCOMPLETE_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_ONCOMPLETE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class ImageOnCompleteTest { +public: + ~ImageOnCompleteTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, const char *id, + uint32_t eventOnComplete); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_ONCOMPLETE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_onerror_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_onerror_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e19f559b4a645c2e820e06aeb33a68514895101a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_onerror_test.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "image_onerror_test.h" +#include + +#define ON_TOUCH_EVENT_ID 7001 +#define ON_ERROR_EVENT_ID 8001 + +namespace ArkUICApiDemo { + +static bool hasOnCompleteInit = false; + +void ImageOnErrorTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t backgroundColor = COLOR_GREEN; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageEventOnTouchTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_TOUCH_EVENT_ID) { + hasOnCompleteInit = true; + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon1.png"; + nodeAPI->setAttribute(nodeHandler, NODE_IMAGE_SRC, &src_item); + } + + if ((hasOnCompleteInit == true) || (eventId == ON_ERROR_EVENT_ID)) { + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &backgroundColorItem); + return; + } +} + +ArkUI_NodeHandle ImageOnErrorTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, const char *id, uint32_t eventId) +{ + float width = SIZE_200; + float height = SIZE_200; + uint32_t backgroundColor = COLOR_RED; + + // 创建节点组件 + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置image组件id + ArkUI_AttributeItem idItem = {}; + idItem.string = id; + node_api->setAttribute(image, NODE_ID, &idItem); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件背景颜色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + // 绑定image触摸事件 + node_api->registerNodeEvent(image, NODE_TOUCH_EVENT, eventId, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "IMAGE_ON_TOUCH_EVENT_ID", "IMAGE_ON_TOUCH_EVENT_ID"); + + return image; +} + +napi_value ImageOnErrorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageOnErrorTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageOnErrorTest", "GetConimage env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t onTouchEventId = ON_TOUCH_EVENT_ID; + const char *imageId = "onTouchEvent"; + ; + auto image = CreateSubImageNode(nodeAPI, imageId, onTouchEventId); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEvent(image, NODE_IMAGE_ON_COMPLETE, ON_ERROR_EVENT_ID, nullptr); + + // 绑定组件回调函数 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageOnErrorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_onerror_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_onerror_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b389929fe8a6ef1789d5374631584b82bdaf9196 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_onerror_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_ONERROR_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_ONERROR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class ImageOnErrorTest { +public: + ~ImageOnErrorTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, const char *id, uint32_t eventOnError); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_ONERROR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_opacity_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_opacity_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..87c0ec413b17376aea4f74e9d94070756ad8451b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_opacity_test.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_opacity_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageOpacityTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float opacity) +{ + uint32_t background_color = 0xFFFF0000; + + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件透明度值 + ArkUI_NumberValue opacity_value[] = {{.f32 = opacity}}; + ArkUI_AttributeItem opacity_item = {opacity_value, sizeof(opacity_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_OPACITY, &opacity_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BACKGROUND_COLOR, &background_color_item); + + return image; +} + +napi_value ImageOpacityTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageOpacityTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float opacity = 0; + float width = 50; + float height = 50; + auto image = CreateSubImageNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + opacity = 0.5; + width = 60; + height = 60; + image = CreateSubImageNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + opacity = 0.8; + width = 70; + height = 70; + image = CreateSubImageNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + opacity = 1; + width = 80; + height = 80; + image = CreateSubImageNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + opacity = -1; + width = 90; + height = 90; + image = CreateSubImageNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + opacity = 2; + width = 100; + height = 100; + image = CreateSubImageNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_opacity_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_opacity_test.h new file mode 100644 index 0000000000000000000000000000000000000000..4ed03b38e4f04e1786fab223f135b7ad1fc834fc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_opacity_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_OPACITY_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_OPACITY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageOpacityTest { +public: + ~ImageOpacityTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float opacity); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_OPACITY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_position_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_position_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0de3831e6c04565f99eb7ee238ed7ff5d9fa41c9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_position_test.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_position_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ImagePositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImagePositionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImagePositionTest", "GetConimage env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置image组件背景图片 + const char *image_url = "./resources/base/media/icon.png"; + ArkUI_AttributeItem background_image_value_item = {}; + background_image_value_item.string = image_url; + + // 设置image组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置image组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + + // first image,设置position为{10,10} + auto image = nodeAPI->createNode(ARKUI_NODE_IMAGE); + ArkUI_NumberValue position_value[] = {{.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(image, NODE_POSITION, &position_item); + nodeAPI->setAttribute(image, NODE_IMAGE_SRC, &background_image_value_item); + nodeAPI->setAttribute(image, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(image, NODE_HEIGHT, &height_item); + + // second image,设置position为{-10,-10} + auto image_second = nodeAPI->createNode(ARKUI_NODE_IMAGE); + ArkUI_NumberValue position_second_value[] = {{.f32 = -10}, {.f32 = -10}}; + ArkUI_AttributeItem position_second_item = {position_second_value, + sizeof(position_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(image_second, NODE_POSITION, &position_second_item); + nodeAPI->setAttribute(image_second, NODE_IMAGE_SRC, &background_image_value_item); + nodeAPI->setAttribute(image_second, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(image_second, NODE_HEIGHT, &height_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, image); + nodeAPI->insertChildAfter(column, image_second, image); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImagePositionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_position_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_position_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9d95444018cfe25ae647c78fa67d5f2721a95fee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_position_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_POSITION_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_POSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImagePositionTest { +public: + ~ImagePositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_POSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_radialgradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_radialgradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9114324eb4b9e166e8fa793e6082efc763834b2c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_radialgradient_test.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_radialgradient_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageRadialGradientTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, float x, float y, + float radial, int32_t repeating, uint32_t firstColor, + uint32_t secondColor) +{ + float width = 100; + float height = 100; + uint32_t backgroundColorsValue[] = {firstColor, secondColor}; + float stops[] = {0.0, 0.5}; + int32_t backgroundColorsCountValue = 2; + auto image = nodeApi->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件径向渐变渐变效果 + ArkUI_ColorStop colorStop = {backgroundColorsValue, stops, backgroundColorsCountValue}; + ArkUI_NumberValue radialGradientValue[] = {{.f32 = x}, {.f32 = y}, {.f32 = radial}, {.i32 = repeating}}; + ArkUI_AttributeItem radialGradientItem = {radialGradientValue, + sizeof(radialGradientValue) / sizeof(ArkUI_NumberValue)}; + radialGradientItem.object = &colorStop; + nodeApi->setAttribute(image, NODE_RADIAL_GRADIENT, &radialGradientItem); + + return image; +} + +napi_value ImageRadialGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageRadialGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageRadialGradientTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto leftColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rightColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + + float x = 50.0; + float y = 50.0; + float radial = 0.0; + int32_t repeating = false; + uint32_t firstColor = 0xFFFF0000; + uint32_t secondColor = 0xFF0000FF; + auto image = CreateSubImageNode(nodeAPI, x, y, radial, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, image); + + x = 50.0; + y = 50.0; + radial = 50.0; + repeating = false; + firstColor = 0xFFFF0000; + secondColor = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, x, y, radial, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, image); + + x = 50.0; + y = 50.0; + radial = 80.0; + repeating = false; + firstColor = 0xFFFF0000; + secondColor = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, x, y, radial, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, image); + + x = 50.0; + y = 50.0; + radial = 50.0; + repeating = true; + firstColor = 0xFFFF0000; + secondColor = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, x, y, radial, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, image); + + x = 50.0; + y = 50.0; + radial = 80.0; + repeating = true; + firstColor = 0xFFFF0000; + secondColor = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, x, y, radial, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, image); + + // 添加组件到容器 + nodeAPI->addChild(row, leftColumn); + nodeAPI->addChild(row, rightColumn); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageRadialGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_radialgradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_radialgradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f8300453db9f00db2df6ad09fa1a4d1a46fd1343 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_radialgradient_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_RADIALGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_RADIALGRADIENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageRadialGradientTest { +public: + ~ImageRadialGradientTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, float x, float y, float radial, + int32_t repeating, uint32_t firstColor, uint32_t secondColor); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_RADIALGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_rotate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_rotate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..662136b2a5fe0d1bed3c25e2dc326d83e040389d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_rotate_test.cpp @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_rotate_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageRotateTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y, float z, + float angle, float perspective) +{ + float width = 50; + float height = 50; + float border_width = 10; + uint32_t background_color = 0xFFFF0000; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件旋转系数 + ArkUI_NumberValue rotate_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}, {.f32 = angle}, {.f32 = perspective}}; + ArkUI_AttributeItem rotate_item = {rotate_value, sizeof(rotate_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_ROTATE, &rotate_item); + + return image; +} + +napi_value ImageRotateTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageRotateTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float x = 0; + float y = 0; + float z = 0; + float angle = 0; + float perspective = 0; + auto image = CreateSubImageNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + x = 0; + y = 0; + z = 1; + angle = 300; + perspective = 0; + image = CreateSubImageNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + x = 1; + y = 0; + z = 1; + angle = -180; + perspective = 0; + image = CreateSubImageNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + x = 0; + y = 1; + z = 1; + angle = 60; + perspective = 0; + image = CreateSubImageNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_rotate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_rotate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b99cf6c804aea6741b2099de3ee838c7133b077e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_rotate_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_ROTATE_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_ROTATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageRotateTest { +public: + ~ImageRotateTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y, float z, float angle, + float perspective); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_ROTATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_saturate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_saturate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ecfa480ff75fcc13f0aa200e49c2f7b806e5edba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_saturate_test.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_saturate_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageSaturateTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float value) +{ + float width = 100; + float height = 100; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(image, NODE_IMAGE_SRC, &src_item); + + // 设置组件饱和度效果系数 + ArkUI_NumberValue saturate_value[] = {{.f32 = value}}; + ArkUI_AttributeItem saturate_item = {saturate_value, sizeof(saturate_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_SATURATION, &saturate_item); + + return image; +} + +napi_value ImageSaturateTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSaturateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSaturateTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float value = 0; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 1; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 5; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = 20; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = FLT_MAX; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = -1; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = FLT_MAX + 1; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_saturate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_saturate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..79892179e9e0c6dddc1ee558ee95659b30a38622 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_saturate_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_SATURATIONE_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_SATURATIONE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageSaturateTest { +public: + ~ImageSaturateTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_SATURATIONE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_scale_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_scale_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b9193380c1250c50a0f3b4c60d87c7ef2bc05463 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_scale_test.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_scale_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageScaleTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y) +{ + float width = 50; + float height = 50; + float border_width = 10; + uint32_t background_color = 0xFFFF0000; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件缩放系数 + ArkUI_NumberValue scale_value[] = {{.f32 = x}, {.f32 = y}}; + ArkUI_AttributeItem scale_item = {scale_value, sizeof(scale_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_SCALE, &scale_item); + + return image; +} + +napi_value ImageScaleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageScaleTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float x = 0.5; + float y = 0.5; + auto image = CreateSubImageNode(nodeAPI, x, y); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + x = 1; + y = 1; + image = CreateSubImageNode(nodeAPI, x, y); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + x = 2; + y = 2; + image = CreateSubImageNode(nodeAPI, x, y); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + x = -2; + y = -2; + image = CreateSubImageNode(nodeAPI, x, y); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_scale_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_scale_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1aa81aa0b855d11ed41b1c00e27ce3ab2eee8772 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_scale_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_SCALE_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_SCALE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageScaleTest { +public: + ~ImageScaleTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_SCALE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_shadow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_shadow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0561989b5d2f53471889299fee2702b744714b88 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_shadow_test.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_shadow_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageShadowTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t value) +{ + float width = 50; + float height = 50; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件背景图片 + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + node_api->setAttribute(image, NODE_IMAGE_SRC, &src_item); + + // 设置组件阴影效果属性 + ArkUI_NumberValue shadow_value[] = {{.i32 = value}}; + ArkUI_AttributeItem shadow_item = {shadow_value, sizeof(shadow_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_SHADOW, &shadow_item); + + return image; +} + +napi_value ImageShadowTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageShadowTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t value = ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_shadow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_shadow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5ef9fbed354c6b2c66198e2b9a7f06c45a758a2b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_shadow_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_SHADOW_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_SHADOW_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageShadowTest { +public: + ~ImageShadowTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_SHADOW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_src_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_src_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1a041c489eac3b92325d9ddb897c32e32798fe75 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_src_test.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "image_src_test.h" +#include +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageSrcTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, const char *value) +{ + float width = 200; + float height = 200; + int32_t objectFit = ArkUI_ObjectFit::ARKUI_OBJECT_FIT_NONE; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件背景图片 + ArkUI_AttributeItem srcItem = {}; + srcItem.string = value; + node_api->setAttribute(image, NODE_IMAGE_SRC, &srcItem); + + // 设置组件图片填充效果属性 + ArkUI_NumberValue objectFitValue[] = {{.i32 = objectFit}}; + ArkUI_AttributeItem objectFitItem = {objectFitValue, sizeof(objectFitValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_IMAGE_OBJECT_FIT, &objectFitItem); + + return image; +} + +napi_value ImageSrcTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSrcTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSrcTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + const char *value = "resource://media/icon.png"; + auto image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = "resource://media/src.jpg"; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = "resource://src/rectIcon.png"; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = ""; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + value = "https://gitee.com/openharmony/docs/raw/master/zh-cn/application-dev/" + "reference/apis-arkui/arkui-ts/figures/edgewidths.png"; + image = CreateSubImageNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSrcTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_src_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_src_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6117434b9548d13aaa0f523ae81bf1ea635cc041 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_src_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_SRC_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_SRC_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageSrcTest { +public: + ~ImageSrcTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, const char *value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_SRC_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_sweepgradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_sweepgradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..debd2c38a835ec06c401a50ef90b5462f97f6896 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_sweepgradient_test.cpp @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_sweepgradient_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageSweepGradientTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, float x, float y, + float start, float end, float rotation, int32_t repeating, + uint32_t firstColor, uint32_t secondColor) +{ + float width = 100; + float height = 100; + uint32_t backgroundColorsValue[] = {firstColor, secondColor}; + float stops[] = {0.5, 1}; + int32_t backgroundColorsCountValue = 2; + auto image = nodeApi->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(image, NODE_HEIGHT, &heightItem); + + // 设置组件角度渐变效果 + ArkUI_ColorStop colorStop = {backgroundColorsValue, stops, backgroundColorsCountValue}; + ArkUI_NumberValue sweepGradientValue[] = {{.f32 = x}, {.f32 = y}, {.f32 = start}, + {.f32 = end}, {.f32 = rotation}, {.i32 = repeating}}; + ArkUI_AttributeItem sweepGradientItem = {sweepGradientValue, + sizeof(sweepGradientValue) / sizeof(ArkUI_NumberValue)}; + sweepGradientItem.object = &colorStop; + nodeApi->setAttribute(image, NODE_SWEEP_GRADIENT, &sweepGradientItem); + + return image; +} + +napi_value ImageSweepGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSweepGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSweepGradientTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto leftColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rightColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + + float x = 50.0; + float y = 50.0; + float start = 0.0; + float end = 0.0; + float rotation = 0.0; + int32_t repeating = false; + uint32_t firstColor = 0xFFFF0000; + uint32_t secondColor = 0xFF0000FF; + auto image = CreateSubImageNode(nodeAPI, x, y, start, end, rotation, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, image); + + x = 50.0; + y = 50.0; + start = 0.0; + end = 359.0; + rotation = 45.0; + repeating = false; + firstColor = 0xFFFF0000; + secondColor = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, x, y, start, end, rotation, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, image); + + x = 50.0; + y = 50.0; + start = 0.0; + end = 359.0; + rotation = 45.0; + repeating = false; + firstColor = 0x456; + secondColor = 0x1234; + image = CreateSubImageNode(nodeAPI, x, y, start, end, rotation, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, image); + + x = 50.0; + y = 50.0; + start = 0.0; + end = 0.0; + rotation = 0.0; + repeating = true; + firstColor = 0xFFFF0000; + secondColor = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, x, y, start, end, rotation, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, image); + + x = 50.0; + y = 50.0; + start = 0.0; + end = 359.0; + rotation = 45.0; + repeating = true; + firstColor = 0xFFFF0000; + secondColor = 0xFF0000FF; + image = CreateSubImageNode(nodeAPI, x, y, start, end, rotation, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, image); + + x = 50.0; + y = 50.0; + start = 0.0; + end = 359.0; + rotation = 60.0; + repeating = true; + firstColor = 0x456; + secondColor = 0x1234; + image = CreateSubImageNode(nodeAPI, x, y, start, end, rotation, repeating, firstColor, secondColor); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, image); + + // 添加组件到容器 + nodeAPI->addChild(row, leftColumn); + nodeAPI->addChild(row, rightColumn); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSweepGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_sweepgradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_sweepgradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6453a7ca9bdce3f721c412cc1b33b3fd74641d92 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_sweepgradient_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_SWEEPGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_SWEEPGRADIENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageSweepGradientTest { +public: + ~ImageSweepGradientTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *nodeApi, float x, float y, float start, float end, + float rotation, int32_t repeating, uint32_t firstColor, + uint32_t secondColor); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_SWEEPGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_transform_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_transform_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..67d21bc65709767bbdf3a4ce23e0024f861a6a5e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_transform_test.cpp @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_transform_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ImageTransformTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageTransformTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageTransformTest", "GetConimage env or info is null"); + return nullptr; + } + + const auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float widthColumn = 400; + float heightColumn = 400; + float widthImage = 100; + float heightImage = 100; + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = widthColumn}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = heightColumn}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建image节点组件 + auto imageFirst = nodeAPI->createNode(ARKUI_NODE_IMAGE); + auto imageSecond = nodeAPI->createNode(ARKUI_NODE_IMAGE); + auto imageThird = nodeAPI->createNode(ARKUI_NODE_IMAGE); + auto imageFourth = nodeAPI->createNode(ARKUI_NODE_IMAGE); + auto imageFive = nodeAPI->createNode(ARKUI_NODE_IMAGE); + + // 设置image组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = widthImage}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = heightImage}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageFirst, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(imageSecond, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(imageThird, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(imageFourth, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(imageFive, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(imageFirst, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(imageSecond, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(imageThird, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(imageFourth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(imageFive, NODE_WIDTH, &width_item); + + // image组件放置父容器column中 + nodeAPI->addChild(column, imageFirst); + nodeAPI->addChild(column, imageSecond); + nodeAPI->addChild(column, imageThird); + nodeAPI->addChild(column, imageFourth); + nodeAPI->addChild(column, imageFive); + + // 设置image组件背景色 + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue white_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_NumberValue black_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_NumberValue yellow_color_value[] = {{.u32 = 0XFFFFFF00}}; + ArkUI_NumberValue blue_color_value[] = {{.u32 = 0XFF0000FF}}; + + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem white_color_item = {white_color_value, sizeof(white_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem black_color_item = {black_color_value, sizeof(black_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem yellow_color_item = {yellow_color_value, + sizeof(yellow_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem blue_color_item = {blue_color_value, sizeof(blue_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageFirst, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(imageSecond, NODE_BACKGROUND_COLOR, &white_color_item); + nodeAPI->setAttribute(imageThird, NODE_BACKGROUND_COLOR, &black_color_item); + nodeAPI->setAttribute(imageFourth, NODE_BACKGROUND_COLOR, &yellow_color_item); + nodeAPI->setAttribute(imageFive, NODE_BACKGROUND_COLOR, &blue_color_item); + + // 设置image组件矩阵变换 + ArkUI_NumberValue matrix_value[] = {{.f32 = 0.5}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0.5}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, + {.f32 = 100}, {.f32 = 100}, {.f32 = 0}, {.f32 = 1}}; + ArkUI_AttributeItem matrix_value_item = {matrix_value, sizeof(matrix_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageFirst, NODE_TRANSFORM, &matrix_value_item); + + ArkUI_NumberValue exception_value[] = { + {.f32 = -1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = -1}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = -1}, {.f32 = 0}, {.f32 = -100}, {.f32 = -100}, {.f32 = 0}, {.f32 = 1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSecond, NODE_TRANSFORM, &exception_value_item); + + ArkUI_NumberValue rotateException_value[] = {{.f32 = static_cast(cos(45))}, + {.f32 = static_cast(-sin(45))}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = static_cast(sin(45))}, + {.f32 = static_cast(cos(45))}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 1}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 1}}; + ArkUI_AttributeItem rotateException_value_item = {rotateException_value, + sizeof(rotateException_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageThird, NODE_TRANSFORM, &rotateException_value_item); + + ArkUI_NumberValue translateException_value[] = { + {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, {.f32 = 1000}, {.f32 = 1000}, {.f32 = 0}, {.f32 = 1}}; + ArkUI_AttributeItem translateException_value_item = {translateException_value, + sizeof(translateException_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageFourth, NODE_TRANSFORM, &translateException_value_item); + + ArkUI_NumberValue boundaryException_value[] = { + {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem boundaryException_value_item = {boundaryException_value, + sizeof(boundaryException_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageFive, NODE_TRANSFORM, &boundaryException_value_item); + // 所有组件挂载到XComponent + std::string columnId(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(columnId), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageTransformTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_transform_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_transform_test.h new file mode 100644 index 0000000000000000000000000000000000000000..39e220bdfc2f84142f4950e1b27b9dd5b0f0333b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_transform_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_TRANSFORM_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_TRANSFORM_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageTransformTest { +public: + ~ImageTransformTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_TRANSFORM_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_translate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_translate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1c0e3ce2c55531f3e1e9a4f402f6720bf715c7cd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_translate_test.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_translate_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ImageTranslateTest::CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y, float z) +{ + float width = 50; + float height = 50; + float border_width = 10; + uint32_t background_color = 0xFFFF0000; + auto image = node_api->createNode(ARKUI_NODE_IMAGE); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_HEIGHT, &height_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件平移距离 + ArkUI_NumberValue translate_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}}; + ArkUI_AttributeItem translate_item = {translate_value, sizeof(translate_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(image, NODE_TRANSLATE, &translate_item); + + return image; +} + +napi_value ImageTranslateTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageTranslateTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float x = 0; + float y = 0; + float z = 0; + auto image = CreateSubImageNode(nodeAPI, x, y, z); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + x = 10; + y = 10; + z = 10; + image = CreateSubImageNode(nodeAPI, x, y, z); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + x = 10000; + y = 10000; + z = 10000; + image = CreateSubImageNode(nodeAPI, x, y, z); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + x = -10; + y = -10; + z = -10; + image = CreateSubImageNode(nodeAPI, x, y, z); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + x = -10000; + y = -10000; + z = -10000; + image = CreateSubImageNode(nodeAPI, x, y, z); + // 添加组件到容器 + nodeAPI->addChild(column, image); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_translate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_translate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7e4df9547ada2f0a75a8815e8f3ad3e50ff260be --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_translate_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_TRANSLATE_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_TRANSLATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageTranslateTest { +public: + ~ImageTranslateTest(); + static ArkUI_NodeHandle CreateSubImageNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y, float z); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_TRANSLATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4b431a49752575129de467efa48b392869acc7b8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_width_test.cpp @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "image_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ImageWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageWidthTest", "GetConimage env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置image组件背景图片 + const char *image_url = "./resources/base/media/icon.png"; + ArkUI_AttributeItem background_image_value_item = {}; + background_image_value_item.string = image_url; + + // 设置image组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置image组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置image组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first image + auto image = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(image, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(image, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(image, NODE_IMAGE_SRC, &background_image_value_item); + nodeAPI->setAttribute(image, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(image, NODE_WIDTH, &width_item); + + // second image + auto image_second = nodeAPI->createNode(ARKUI_NODE_IMAGE); + nodeAPI->setAttribute(image_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(image_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(image_second, NODE_IMAGE_SRC, &background_image_value_item); + nodeAPI->setAttribute(image_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(image_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, image); + nodeAPI->insertChildAfter(column, image_second, image); + + // image组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ImageWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageWidthTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为500 + auto image = nodeAPI->createNode(ARKUI_NODE_IMAGE); + ArkUI_NumberValue width_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(image, NODE_WIDTH, &width_item); + + // 设置image组件背景图片 + const char *image_url = "./resources/base/media/icon.png"; + ArkUI_AttributeItem background_image_value_item = {}; + background_image_value_item.string = image_url; + nodeAPI->setAttribute(image, NODE_IMAGE_SRC, &background_image_value_item); + + // 设置image组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(image, NODE_HEIGHT, &default_height_item); + + nodeAPI->addChild(column, image); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5d0c1283ee7367ff1cda9e5bfb6deb968997a895 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/image/image_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGE_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_IMAGE_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageWidthTest { +public: + ~ImageWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGE_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..34dd517e8f9953300db119d3f48c8bb62eb24ca7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_height_test.cpp @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "imagespan/imagespan_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ImageSpanHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanHeightTest", "GetContext env or info is null"); + return nullptr; + } + + // 设置imageSpan组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置imageSpan组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置imageSpan背景颜色 + ArkUI_NumberValue red_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue green_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem green_color_item = {green_color_value, sizeof(green_color_value) / sizeof(ArkUI_NumberValue)}; + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // first imageSpan,设置高度为200 + auto imageSpan = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + nodeAPI->setAttribute(imageSpan, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(imageSpan, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(imageSpan, NODE_BACKGROUND_COLOR, &red_color_item); + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_HEIGHT, &height_item); + + // second imageSpan,设置宽度为异常值 + auto imageSpan_second = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + nodeAPI->setAttribute(imageSpan_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(imageSpan_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(imageSpan_second, NODE_BACKGROUND_COLOR, &green_color_item); + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, imageSpan); + nodeAPI->insertChildAfter(column, imageSpan_second, imageSpan); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ImageSpanHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置imageSpan组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置imageSpan组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置imageSpan背景颜色 + ArkUI_NumberValue red_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为超大值500 + auto imageSpan = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + nodeAPI->setAttribute(imageSpan, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(imageSpan, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(imageSpan, NODE_BACKGROUND_COLOR, &red_color_item); + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, imageSpan); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fc750cd4c82087be1faa17831018d933eabbe4ab --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGESPAN_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_IMAGESPAN_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageSpanHeightTest { +public: + ~ImageSpanHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGESPAN_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_objectfit_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_objectfit_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..652a02780c21ae8580da8d58e8de5d00cfea4119 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_objectfit_test.cpp @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "imagespan_objectfit_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + // 背景图片路径 + const char *image_url = "./resources/base/media/icon.png"; + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &border_item); + + ArkUI_AttributeItem background_image_value_item = {}; + background_image_value_item.string = image_url; + nodeAPI->setAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC, &background_image_value_item); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t objectFit) +{ + auto nodeHandle = createDefaultChildNode(nodeAPI); + ArkUI_NumberValue objectFit_value[] = {{.i32 = objectFit}}; + ArkUI_AttributeItem objectFit_item = {objectFit_value, sizeof(objectFit_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT, &objectFit_item); + + return nodeHandle; +} + +napi_value ImageSpanObjectFitTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageSpanObjectFitTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanObjectFitTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowFourth = nodeAPI->createNode(ARKUI_NODE_ROW); + auto imageSpanFirst = createChildNode(nodeAPI, ARKUI_OBJECT_FIT_CONTAIN); + auto imageSpanFirstEnd = createChildNode(nodeAPI, ARKUI_OBJECT_FIT_COVER); + auto imageSpanSecond = createChildNode(nodeAPI, ARKUI_OBJECT_FIT_AUTO); + auto imageSpanSecondEnd = createChildNode(nodeAPI, ARKUI_OBJECT_FIT_FILL); + auto imageSpanThird = createChildNode(nodeAPI, ARKUI_OBJECT_FIT_SCALE_DOWN); + auto imageSpanThirdEnd = createChildNode(nodeAPI, ARKUI_OBJECT_FIT_NONE); + auto imageSpanFourth = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + + nodeAPI->addChild(rowFirst, imageSpanFirst); + nodeAPI->addChild(rowFirst, imageSpanFirstEnd); + nodeAPI->addChild(rowSecond, imageSpanSecond); + nodeAPI->addChild(rowSecond, imageSpanSecondEnd); + nodeAPI->addChild(rowThird, imageSpanThird); + nodeAPI->addChild(rowThird, imageSpanThirdEnd); + nodeAPI->addChild(rowFourth, imageSpanFourth); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + nodeAPI->addChild(column, rowFourth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanObjectFitTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_objectfit_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_objectfit_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b0cbda00ab90cec39eac48a1226dd73c29494ee9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_objectfit_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGESPAN_OBJECTFIT_TEST_H +#define ARKUI_CAPI_DEMO_IMAGESPAN_OBJECTFIT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageSpanObjectFitTest { +public: + ~ImageSpanObjectFitTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGESPAN_OBJECTFIT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_padding_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_padding_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..79debf40042fc372fe2cee45d8633fdb5118ef7c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_padding_test.cpp @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "imagespan_padding_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + // 背景图片路径 + const char *image_url = "./resources/base/media/icon.png"; + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &border_item); + + ArkUI_AttributeItem background_image_value_item = {}; + background_image_value_item.string = image_url; + nodeAPI->setAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC, &background_image_value_item); + + ArkUI_NumberValue objectFit_value[] = {{.i32 = ARKUI_OBJECT_FIT_FILL}}; + ArkUI_AttributeItem objectFit_item = {objectFit_value, sizeof(objectFit_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT, &objectFit_item); + + return nodeHandle; +} + +napi_value ImageSpanPaddingTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageSpanPaddingTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanPaddingTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowFourth = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue first_padding_value[] = {{.f32 = 10}}; + ArkUI_NumberValue second_padding_value[] = {{.f32 = -10}}; + ArkUI_NumberValue third_padding_value[] = {{.f32 = 20}, {.f32 = 20}, {.f32 = 50}, {.f32 = 50}}; + ArkUI_NumberValue fourth_padding_value[] = {{.f32 = -20}, {.f32 = -20}, {.f32 = -50}, {.f32 = -50}}; + auto imageSpanFirst = createChildNode(nodeAPI); + ArkUI_AttributeItem padding_item = {first_padding_value, sizeof(first_padding_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpanFirst, NODE_PADDING, &padding_item); + auto imageSpanSecond = createChildNode(nodeAPI); + ArkUI_AttributeItem second_padding_item = {second_padding_value, + sizeof(second_padding_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpanSecond, NODE_PADDING, &second_padding_item); + auto imageSpanThird = createChildNode(nodeAPI); + ArkUI_AttributeItem third_padding_item = {third_padding_value, + sizeof(third_padding_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpanThird, NODE_PADDING, &third_padding_item); + auto imageSpanFourth = createChildNode(nodeAPI); + ArkUI_AttributeItem fourth_padding_item = {fourth_padding_value, + sizeof(fourth_padding_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpanFourth, NODE_PADDING, &fourth_padding_item); + + nodeAPI->addChild(rowFirst, imageSpanFirst); + nodeAPI->addChild(rowSecond, imageSpanSecond); + nodeAPI->addChild(rowThird, imageSpanThird); + nodeAPI->addChild(rowFourth, imageSpanFourth); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + nodeAPI->addChild(column, rowFourth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanPaddingTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_padding_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_padding_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8001611f273e5d8e4ea165ddd98159195e24302f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_padding_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGESPAN_PADDING_TEST_H +#define ARKUI_CAPI_DEMO_IMAGESPAN_PADDING_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageSpanPaddingTest { +public: + ~ImageSpanPaddingTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGESPAN_PADDING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_verticalalign_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_verticalalign_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0ae0f8bff08fbdcb7ada3831a337e2649efc1135 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_verticalalign_test.cpp @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "imagespan_verticalalign_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + // 背景图片路径 + const char *image_url = "./resources/base/media/icon.png"; + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem background_image_value_item = {}; + background_image_value_item.string = image_url; + nodeAPI->setAttribute(nodeHandle, NODE_IMAGE_SPAN_SRC, &background_image_value_item); + + return nodeHandle; +} + +static auto createImageSpanChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t verticalAlign) +{ + auto nodeHandle = createDefaultChildNode(nodeAPI); + ArkUI_NumberValue verticalAlign_value[] = {{.i32 = verticalAlign}}; + ArkUI_AttributeItem verticalAlign_item = {verticalAlign_value, + sizeof(verticalAlign_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_IMAGE_SPAN_VERTICAL_ALIGNMENT, &verticalAlign_item); + + return nodeHandle; +} + +static auto createTextChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle imageSpan) +{ + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto span = nodeAPI->createNode(ARKUI_NODE_SPAN); + + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BORDER_WIDTH, &border_item); + // span text + ArkUI_AttributeItem content_item = {}; + content_item.string = "123456789"; + nodeAPI->setAttribute(span, NODE_SPAN_CONTENT, &content_item); + // span decoration + ArkUI_NumberValue decoration_value[] = {{.i32 = ARKUI_TEXT_DECORATION_TYPE_UNDERLINE}}; + ArkUI_AttributeItem decoration_item = {decoration_value, sizeof(decoration_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(span, NODE_TEXT_DECORATION, &decoration_item); + + nodeAPI->addChild(text, imageSpan); + nodeAPI->addChild(text, span); + + return text; +} + +napi_value ImageSpanVerticalAlignTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ImageSpanVerticalAlignTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanVerticalAlignTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + auto textFirst = + createTextChildNode(nodeAPI, createImageSpanChildNode(nodeAPI, ARKUI_IMAGE_SPAN_ALIGNMENT_BASELINE)); + auto textFirstEnd = + createTextChildNode(nodeAPI, createImageSpanChildNode(nodeAPI, ARKUI_IMAGE_SPAN_ALIGNMENT_BOTTOM)); + auto textSecond = + createTextChildNode(nodeAPI, createImageSpanChildNode(nodeAPI, ARKUI_IMAGE_SPAN_ALIGNMENT_CENTER)); + auto textSecondEnd = + createTextChildNode(nodeAPI, createImageSpanChildNode(nodeAPI, ARKUI_IMAGE_SPAN_ALIGNMENT_TOP)); + auto textThird = createTextChildNode(nodeAPI, createImageSpanChildNode(nodeAPI, PARAM_NEGATIVE_1)); + + nodeAPI->addChild(rowFirst, textFirst); + nodeAPI->addChild(rowFirst, textFirstEnd); + nodeAPI->addChild(rowSecond, textSecond); + nodeAPI->addChild(rowSecond, textSecondEnd); + nodeAPI->addChild(rowThird, textThird); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanVerticalAlignTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_verticalalign_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_verticalalign_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a6cf553d154f2ad942c4400e87e68cf95d77a60d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_verticalalign_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGESPAN_VERTICALALIGN_TEST_H +#define ARKUI_CAPI_DEMO_IMAGESPAN_VERTICALALIGN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageSpanVerticalAlignTest { +public: + ~ImageSpanVerticalAlignTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGESPAN_VERTICALALIGN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d99043a17de063a227699f7b45b94e86a00f45a4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_width_test.cpp @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "imagespan/imagespan_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ImageSpanWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置imageSpan组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置imageSpan组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置imageSpan背景颜色 + ArkUI_NumberValue red_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue green_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem green_color_item = {green_color_value, sizeof(green_color_value) / sizeof(ArkUI_NumberValue)}; + + // first imageSpan,设置宽度为300 + auto imageSpan = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + nodeAPI->setAttribute(imageSpan, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(imageSpan, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(imageSpan, NODE_BACKGROUND_COLOR, &red_color_item); + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_WIDTH, &width_item); + + // second imageSpan,设置宽度为异常值 + auto imageSpan_second = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + nodeAPI->setAttribute(imageSpan_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(imageSpan_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(imageSpan_second, NODE_BACKGROUND_COLOR, &green_color_item); + ArkUI_NumberValue width_second_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, imageSpan); + nodeAPI->insertChildAfter(column, imageSpan_second, imageSpan); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ImageSpanWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanWidthTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置imageSpan组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置imageSpan组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置imageSpan背景颜色 + ArkUI_NumberValue red_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为超大值500 + auto imageSpan = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + nodeAPI->setAttribute(imageSpan, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(imageSpan, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(imageSpan, NODE_BACKGROUND_COLOR, &red_color_item); + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan, NODE_WIDTH, &width_item); + + nodeAPI->addChild(column, imageSpan); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageSpanWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..64371be4ced3e0d8163edf38c1392699cdd4b0ce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/imagespan/imagespan_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_IMAGESPAN_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_IMAGESPAN_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ImageSpanWidthTest { +public: + ~ImageSpanWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_IMAGESPAN_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0ebbff24f15c8fd0a59bc660fff8d4c91dec372d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_backgroundcolor_test.cpp @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "list_backgroundcolor_test.h" +#include + +namespace ArkUICApiDemo { +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t backgroundColor) +{ + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue BackgroundColor_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem BackgroundColor_item = {BackgroundColor_value, + sizeof(BackgroundColor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &BackgroundColor_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + return list; +} + +napi_value ListBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBackgroundColorTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = createChildNode(nodeAPI, 0xFF00FF00); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + nodeAPI->addChild(list, listItem); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childBackgroundColor_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childBackgroundColor_item = {childBackgroundColor_value, + sizeof(childBackgroundColor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childBackgroundColor_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListBackgroundColorTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBackgroundColorTest", "CreateNativeNodeNull"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBackgroundColorTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = createChildNode(nodeAPI, napi_null); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + nodeAPI->addChild(list, listItem); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childBackgroundColor_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childBackgroundColor_item = {childBackgroundColor_value, + sizeof(childBackgroundColor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childBackgroundColor_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListBackgroundColorTest::CreateNativeNodeUndefined(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBackgroundColorTest", "CreateNativeNodeUndefined"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBackgroundColorTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = createChildNode(nodeAPI, napi_undefined); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + nodeAPI->addChild(list, listItem); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childBackgroundColor_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childBackgroundColor_item = {childBackgroundColor_value, + sizeof(childBackgroundColor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childBackgroundColor_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b8e727e11a3c799648eefc87922bb145d9ac45d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_backgroundcolor_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_LIST_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListBackgroundColorTest { +public: + ~ListBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUndefined(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_blur_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_blur_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..33da84a62e76bb157f32b884da7593d55558acc8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_blur_test.cpp @@ -0,0 +1,274 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_blur_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListBlurTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBlurTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBlurTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + nodeAPI->addChild(column, list); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue blur_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem blur_item = {blur_value, sizeof(blur_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BLUR, &blur_item); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListBlurTest::CreateNativeNodeDefaultValue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBlurTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBlurTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + nodeAPI->addChild(column, list); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue blur_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem blur_item = {blur_value, sizeof(blur_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BLUR, &blur_item); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListBlurTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBlurTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBlurTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + nodeAPI->addChild(column, list); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue blur_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem blur_item = {blur_value, sizeof(blur_value) / sizeof(ArkUI_NumberValue)}; + int32_t ret = nodeAPI->setAttribute(list, NODE_BLUR, &blur_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "setAttribute", "ret is %{public}d", ret); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_blur_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_blur_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b3eb2cf74f07c854bea7b62cf91bec384da44404 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_blur_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_BLUR_TEST_H +#define ARKUI_CAPI_DEMO_LIST_BLUR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListBlurTest { +public: + ~ListBlurTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDefaultValue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_BLUR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_bordercolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_bordercolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e32c69373aff472e7c95fcd26d71a7e342800e6d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_bordercolor_test.cpp @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "list_bordercolor_test.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t borderColor) +{ + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = borderColor}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + return list; +} + +napi_value ListBorderColorTest::CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = createChildNode(nodeAPI, 0xFFFF11FF); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderColor_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childBorderColor_item = {childBorderColor_value, + sizeof(childBorderColor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderColor_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} +napi_value ListBorderColorTest::CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = { + {.u32 = 0xFFFF11FF}, {.u32 = 0xFF00FFFF}, {.u32 = 0xFFFFFF00}, {.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = { + {.u32 = 0xFFFF11FF}, {.u32 = 0xFF00FFFF}, {.u32 = 0xFFFFFF00}, {.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListBorderColorTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = createChildNode(nodeAPI, napi_null); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderColor_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childBorderColor_item = {childBorderColor_value, + sizeof(childBorderColor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderColor_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value ListBorderColorTest::CreateNativeNodeUndefined(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = createChildNode(nodeAPI, napi_undefined); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderColor_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childBorderColor_item = {childBorderColor_value, + sizeof(childBorderColor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderColor_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_bordercolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_bordercolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..891ee259befc44c12619921d9aa92300af563290 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_bordercolor_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_BORDERCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_LIST_BORDERCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListBorderColorTest { +public: + ~ListBorderColorTest(); + static napi_value CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUndefined(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_BORDERCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderradius_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderradius_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..61ee9bf73d15c6e81762995994afe01b3ecd108d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderradius_test.cpp @@ -0,0 +1,406 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_borderradius_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListBorderRadiusTest::CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_RADIUS, &border_radius_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderRadius_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childBorderRadius_item = {childBorderRadius_value, + sizeof(childBorderRadius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderRadius_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBorder_radius_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_radius_item = {childBorder_radius_value, + sizeof(childBorder_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_RADIUS, &childBorder_radius_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} +napi_value ListBorderRadiusTest::CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_RADIUS, &border_radius_item); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderRadius_value[] = {{.f32 = 370}}; + ArkUI_AttributeItem childBorderRadius_item = {childBorderRadius_value, + sizeof(childBorderRadius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderRadius_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBorder_radius_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem childBorder_radius_item = {childBorder_radius_value, + sizeof(childBorder_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_RADIUS, &childBorder_radius_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListBorderRadiusTest::CreateNativeNodeUnifiedSettingsLowerBoundAbnormal(napi_env env, + napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = -10}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_RADIUS, &border_radius_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderRadius_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childBorderRadius_item = {childBorderRadius_value, + sizeof(childBorderRadius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderRadius_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBorder_radius_value[] = {{.f32 = -10}}; + ArkUI_AttributeItem childBorder_radius_item = {childBorder_radius_value, + sizeof(childBorder_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_RADIUS, &childBorder_radius_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value ListBorderRadiusTest::CreateNativeNodeRespectivelySettingsLowerBoundAbnormal(napi_env env, + napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = -10}, {.f32 = -10}, {.f32 = -20}, {.f32 = -20}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_RADIUS, &border_radius_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderRadius_value[] = {{.f32 = 370}}; + ArkUI_AttributeItem childBorderRadius_item = {childBorderRadius_value, + sizeof(childBorderRadius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderRadius_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBorder_radius_value[] = {{.f32 = -10}, {.f32 = -10}, {.f32 = -20}, {.f32 = -20}}; + ArkUI_AttributeItem childBorder_radius_item = {childBorder_radius_value, + sizeof(childBorder_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_RADIUS, &childBorder_radius_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderradius_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderradius_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0dd2a8f71691713d6c1a9f3a55d7852d7d2afb00 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderradius_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_BORDERRADIUS_TEST_H +#define ARKUI_CAPI_DEMO_LIST_BORDERRADIUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListBorderRadiusTest { +public: + ~ListBorderRadiusTest(); + static napi_value CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUnifiedSettingsLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelySettingsLowerBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_BORDERRADIUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderwidth_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderwidth_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b2e04b95aafc6d345d2f3a0db0856fca7dbf3c27 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderwidth_test.cpp @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_borderwidth_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListBorderWidthTest::CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childBorderWidth_item = {childBorderWidth_value, + sizeof(childBorderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListBorderWidthTest::CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}, {.f32 = 20}, {.f32 = 30}, {.f32 = 40}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childBorderWidth_item = {childBorderWidth_value, + sizeof(childBorderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}, {.f32 = 20}, {.f32 = 30}, {.f32 = 40}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListBorderWidthTest::CreateNativeNodeUnifiedSettingsLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childBorderWidth_item = {childBorderWidth_value, + sizeof(childBorderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListBorderWidthTest::CreateNativeNodeRespectivelySettingsLowerBoundAbnormal(napi_env env, + napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = -50}, {.f32 = -50}, {.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childBorderWidth_item = {childBorderWidth_value, + sizeof(childBorderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = -50}, {.f32 = -50}, {.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderwidth_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderwidth_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ae7bf911b620e452fcfb4ce475e1220e542b26b1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_borderwidth_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_BORDERWIDTH_TEST_H +#define ARKUI_CAPI_DEMO_LIST_BORDERWIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListBorderWidthTest { +public: + ~ListBorderWidthTest(); + static napi_value CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUnifiedSettingsLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelySettingsLowerBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_BORDERWIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_brightness_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_brightness_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..184fb81bf4f3a39bc68c3a263ccca999cead17c9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_brightness_test.cpp @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_brightness_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListBrightnessTest::CreateNativeNodeMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBrightness_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem childBrightness_item = {childBrightness_value, + sizeof(childBrightness_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BRIGHTNESS, &childBrightness_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListBrightnessTest::CreateNativeNodeMax(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBrightness_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem childBrightness_item = {childBrightness_value, + sizeof(childBrightness_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BRIGHTNESS, &childBrightness_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListBrightnessTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBrightness_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem childBrightness_item = {childBrightness_value, + sizeof(childBrightness_value) / sizeof(ArkUI_NumberValue)}; + int32_t ret = nodeAPI->setAttribute(list, NODE_BRIGHTNESS, &childBrightness_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "setAttribute", "ret is %{public}d", ret); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListBrightnessTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBrightness_value[] = {{.f32 = 3}}; + ArkUI_AttributeItem childBrightness_item = {childBrightness_value, + sizeof(childBrightness_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BRIGHTNESS, &childBrightness_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_brightness_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_brightness_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8990e7da73eaaad0c90d22334dbaa1805d0f87b9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_brightness_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_BRIGHTNESS_TEST_H +#define ARKUI_CAPI_DEMO_LIST_BRIGHTNESS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListBrightnessTest { +public: + ~ListBrightnessTest(); + static napi_value CreateNativeNodeMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMax(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_BRIGHTNESS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_cachedcount_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_cachedcount_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cc900b1e7853460fde606dfcf98fc07635639a94 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_cachedcount_test.cpp @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "list_cachedcount_test.h" +#include + +static ArkUI_NodeHandle column; +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + return list; +} + +static void OnAdapterEventReceive(ArkUI_NodeAdapterEvent *event) +{ + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + int type = OH_ArkUI_NodeAdapterEvent_GetType(event); + if (type == NODE_ADAPTER_EVENT_ON_ADD_NODE_TO_ADAPTER) { + int32_t index = OH_ArkUI_NodeAdapterEvent_GetItemIndex(event); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_ADAPTER_EVENT_ON_ADD_NODE_TO_ADAPTER", + "index is %{public}d", index); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + uint32_t color = COLOR_YELLOW; + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + OH_ArkUI_NodeAdapterEvent_SetItem(event, listItem); + uint32_t parentColor = COLOR_GREEN; + if (index == PARAM_11) { + parentColor = COLOR_PURPLE; + } else if (index > PARAM_11) { + parentColor = COLOR_GRAY; + } + if (column != nullptr) { + ArkUI_NumberValue parentBackground_color_value[] = {{.u32 = parentColor}}; + ArkUI_AttributeItem parentBackground_color_item = { + parentBackground_color_value, sizeof(parentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &parentBackground_color_item); + } + } +} + +static void OnAdapterEventReceiveAbnormal(ArkUI_NodeAdapterEvent *event) +{ + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + int type = OH_ArkUI_NodeAdapterEvent_GetType(event); + if (type == NODE_ADAPTER_EVENT_ON_ADD_NODE_TO_ADAPTER) { + int32_t index = OH_ArkUI_NodeAdapterEvent_GetItemIndex(event); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_ADAPTER_EVENT_ON_ADD_NODE_TO_ADAPTER", + "index is %{public}d", index); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + uint32_t color = COLOR_YELLOW; + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + OH_ArkUI_NodeAdapterEvent_SetItem(event, listItem); + uint32_t parentColor = COLOR_GREEN; + if (index == PARAM_2) { + parentColor = COLOR_PURPLE; + } else if (index > PARAM_2) { + parentColor = COLOR_GRAY; + } + if (column != nullptr) { + ArkUI_NumberValue parentBackground_color_value[] = {{.u32 = parentColor}}; + ArkUI_AttributeItem parentBackground_color_item = { + parentBackground_color_value, sizeof(parentBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &parentBackground_color_item); + } + } +} + +napi_value ListCachedCountTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListCachedCountTest", "CreateNativeNode"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListCachedCountTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = createChildNode(nodeAPI); + column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 450}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NodeAdapterHandle adapterHandle = OH_ArkUI_NodeAdapter_Create(); + OH_ArkUI_NodeAdapter_RegisterEventReceiver(adapterHandle, nullptr, &OnAdapterEventReceive); + OH_ArkUI_NodeAdapter_SetTotalNodeCount(adapterHandle, SIZE_30); + + ArkUI_NumberValue cacheCount[] = {{.i32 = 10}}; + ArkUI_AttributeItem cacheCountItem = {cacheCount, sizeof(cacheCount) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_CACHED_COUNT, &cacheCountItem); + + ArkUI_AttributeItem adapter = {}; + adapter.object = adapterHandle; + nodeAPI->setAttribute(list, NODE_LIST_NODE_ADAPTER, &adapter); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListCachedCountTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListCachedCountTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListCachedCountTest", "CreateNativeNodeAbnormal"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListCachedCountTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = createChildNode(nodeAPI); + column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 450}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NodeAdapterHandle adapterHandle = OH_ArkUI_NodeAdapter_Create(); + OH_ArkUI_NodeAdapter_RegisterEventReceiver(adapterHandle, nullptr, &OnAdapterEventReceiveAbnormal); + OH_ArkUI_NodeAdapter_SetTotalNodeCount(adapterHandle, SIZE_30); + + ArkUI_NumberValue cacheCount[] = {{.i32 = -10}}; + ArkUI_AttributeItem cacheCountItem = {cacheCount, sizeof(cacheCount) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_CACHED_COUNT, &cacheCountItem); + + ArkUI_AttributeItem adapter = {}; + adapter.object = adapterHandle; + nodeAPI->setAttribute(list, NODE_LIST_NODE_ADAPTER, &adapter); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListCachedCountTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_cachedcount_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_cachedcount_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b57277471991212232a16f638a5cfb11057ccbe2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_cachedcount_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_CACHEDCOUNT_TEST_H +#define ARKUI_CAPI_DEMO_LIST_CACHEDCOUNT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListCachedCountTest { +public: + ~ListCachedCountTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_CACHEDCOUNT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..adc485d2673f4a1375d3aa81136777f339ab25fa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_clip_test.cpp @@ -0,0 +1,384 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_clip_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListClipTest::CreateNativeNodeCut(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "CreateNativeNodeCut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue clip_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem clip_item = {clip_value, sizeof(clip_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_CLIP, &clip_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_RADIUS, &border_radius_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListClipTest::CreateNativeNodeUncut(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue clip_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem clip_item = {clip_value, sizeof(clip_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_CLIP, &clip_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_RADIUS, &border_radius_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListClipTest::CreateNativeNodeRectangle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 400}, {.f32 = 300}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListClipTest::CreateNativeNodeCircle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 300}, {.f32 = 300}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListClipTest::CreateNativeNodeEllipse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 400}, {.f32 = 300}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListClipTest::CreateNativeNodePath(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 500}, {.f32 = 500}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + clipShape_item.string = "M300 0 L500 500 L0 500 Z"; + nodeAPI->setAttribute(list, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fc239004b547f3060ce58f08e8dd28f850bcfdf1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_clip_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_LIST_CLIP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListClipTest { +public: + ~ListClipTest(); + static napi_value CreateNativeNodeCut(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUncut(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRectangle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCircle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEllipse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodePath(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_edgeEffect_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_edgeEffect_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ce319c2f84884952532f8aa42600bb17b9719bb8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_edgeEffect_test.cpp @@ -0,0 +1,571 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "list_edgeEffect_test.h" +#include + +namespace ArkUICApiDemo { +napi_value ListEdgeEffectTest::CreateNativeNodeSpring(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", "CreateNativeNodeSpring"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", "GetContext env or info is null"); + return nullptr; + } + + auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEdgeEffect_value[] = {{.i32 = ARKUI_EDGE_EFFECT_SPRING}, {.i32 = 1}}; + ArkUI_AttributeItem childEdgeEffect_value_item = {childEdgeEffect_value, + sizeof(childEdgeEffect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_EDGE_EFFECT, &childEdgeEffect_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListEdgeEffectTest::CreateNativeNodeFade(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", "CreateNativeNodeFade"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", "GetContext env or info is null"); + return nullptr; + } + + auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEdgeEffect_value[] = {{.i32 = ARKUI_EDGE_EFFECT_FADE}, {.i32 = 1}}; + ArkUI_AttributeItem childEdgeEffect_value_item = {childEdgeEffect_value, + sizeof(childEdgeEffect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_EDGE_EFFECT, &childEdgeEffect_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListEdgeEffectTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", "CreateNativeNodeNone"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", "GetContext env or info is null"); + return nullptr; + } + + auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEdgeEffect_value[] = {{.i32 = ARKUI_EDGE_EFFECT_NONE}, {.i32 = 0}}; + ArkUI_AttributeItem childEdgeEffect_value_item = {childEdgeEffect_value, + sizeof(childEdgeEffect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_EDGE_EFFECT, &childEdgeEffect_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListEdgeEffectTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", "CreateNativeNodeLowerBoundAbnormal"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", "GetContext env or info is null"); + return nullptr; + } + + auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEdgeEffect_value[] = {{.i32 = -1}, {.i32 = 1}}; + ArkUI_AttributeItem childEdgeEffect_value_item = {childEdgeEffect_value, + sizeof(childEdgeEffect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_EDGE_EFFECT, &childEdgeEffect_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListEdgeEffectTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", "CreateNativeNodeUpperBoundAbnormal"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", "GetContext env or info is null"); + return nullptr; + } + + auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEdgeEffect_value[] = {{.i32 = 10}, {.i32 = 1}}; + ArkUI_AttributeItem childEdgeEffect_value_item = {childEdgeEffect_value, + sizeof(childEdgeEffect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_EDGE_EFFECT, &childEdgeEffect_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_edgeEffect_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_edgeEffect_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7089794fc4d8749102d87e7b000ae3fa984231d9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_edgeEffect_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_EDGEEFFECT_TEST_H +#define ARKUI_CAPI_DEMO_LIST_EDGEEFFECT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListEdgeEffectTest { + public: + ~ListEdgeEffectTest(); + static napi_value CreateNativeNodeSpring(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFade(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_EDGEEFFECT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_enablescrollinteraction_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_enablescrollinteraction_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0be594da0a4ec068166e9075903484aa126fe132 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_enablescrollinteraction_test.cpp @@ -0,0 +1,526 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_enablescrollinteraction_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListEnableScrollInteractionTest::CreateNativeNodeSupported(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", "CreateNativeNodeSupported"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemBrother = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEnableScrollInteraction_value[] = {{.i32 = true}}; + ArkUI_AttributeItem childEnableScrollInteraction_value_item = { + childEnableScrollInteraction_value, sizeof(childEnableScrollInteraction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &childEnableScrollInteraction_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + nodeAPI->addChild(list, listItemBrother); + ArkUI_NumberValue listItemBrotherWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherWidth_item = {listItemBrotherWidth_value, + sizeof(listItemBrotherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_WIDTH, &listItemBrotherWidth_item); + + ArkUI_NumberValue listItemBrotherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherHeight_item = {listItemBrotherHeight_value, + sizeof(listItemBrotherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_HEIGHT, &listItemBrotherHeight_item); + + ArkUI_NumberValue listItemBrotherBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem listItemBrotherBackground_color_item = {listItemBrotherBackground_color_value, + sizeof(listItemBrotherBackground_color_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_BACKGROUND_COLOR, &listItemBrotherBackground_color_item); + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListEnableScrollInteractionTest::CreateNativeNodeNotSupported(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "CreateNativeNodeNotSupported"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemBrother = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEnableScrollInteraction_value[] = {{.i32 = false}}; + ArkUI_AttributeItem childEnableScrollInteraction_value_item = { + childEnableScrollInteraction_value, sizeof(childEnableScrollInteraction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &childEnableScrollInteraction_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + nodeAPI->addChild(list, listItemBrother); + ArkUI_NumberValue listItemBrotherWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherWidth_item = {listItemBrotherWidth_value, + sizeof(listItemBrotherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_WIDTH, &listItemBrotherWidth_item); + + ArkUI_NumberValue listItemBrotherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherHeight_item = {listItemBrotherHeight_value, + sizeof(listItemBrotherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_HEIGHT, &listItemBrotherHeight_item); + + ArkUI_NumberValue listItemBrotherBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem listItemBrotherBackground_color_item = {listItemBrotherBackground_color_value, + sizeof(listItemBrotherBackground_color_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_BACKGROUND_COLOR, &listItemBrotherBackground_color_item); + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListEnableScrollInteractionTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "CreateNativeNodeLowerBoundAbnormal"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemBrother = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEnableScrollInteraction_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem childEnableScrollInteraction_value_item = { + childEnableScrollInteraction_value, sizeof(childEnableScrollInteraction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &childEnableScrollInteraction_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + nodeAPI->addChild(list, listItemBrother); + ArkUI_NumberValue listItemBrotherWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherWidth_item = {listItemBrotherWidth_value, + sizeof(listItemBrotherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_WIDTH, &listItemBrotherWidth_item); + + ArkUI_NumberValue listItemBrotherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherHeight_item = {listItemBrotherHeight_value, + sizeof(listItemBrotherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_HEIGHT, &listItemBrotherHeight_item); + + ArkUI_NumberValue listItemBrotherBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem listItemBrotherBackground_color_item = {listItemBrotherBackground_color_value, + sizeof(listItemBrotherBackground_color_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_BACKGROUND_COLOR, &listItemBrotherBackground_color_item); + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListEnableScrollInteractionTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "CreateNativeNodeUpperBoundAbnormal"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemBrother = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEnableScrollInteraction_value[] = {{.i32 = 2}}; + ArkUI_AttributeItem childEnableScrollInteraction_value_item = { + childEnableScrollInteraction_value, sizeof(childEnableScrollInteraction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &childEnableScrollInteraction_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + nodeAPI->addChild(list, listItemBrother); + ArkUI_NumberValue listItemBrotherWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherWidth_item = {listItemBrotherWidth_value, + sizeof(listItemBrotherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_WIDTH, &listItemBrotherWidth_item); + + ArkUI_NumberValue listItemBrotherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherHeight_item = {listItemBrotherHeight_value, + sizeof(listItemBrotherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_HEIGHT, &listItemBrotherHeight_item); + + ArkUI_NumberValue listItemBrotherBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem listItemBrotherBackground_color_item = {listItemBrotherBackground_color_value, + sizeof(listItemBrotherBackground_color_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_BACKGROUND_COLOR, &listItemBrotherBackground_color_item); + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEnableScrollInteractionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_enablescrollinteraction_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_enablescrollinteraction_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7bed7d03fdabe376f421877e804320a0bcbf4f04 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_enablescrollinteraction_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_ENABLESCROLLINTERACTION_TEST_H +#define ARKUI_CAPI_DEMO_LIST_ENABLESCROLLINTERACTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListEnableScrollInteractionTest { +public: + ~ListEnableScrollInteractionTest(); + static napi_value CreateNativeNodeSupported(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNotSupported(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_ENABLESCROLLINTERACTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_friction_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_friction_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4aba35ab8b765610d3c4a3e86861c67affc4d441 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_friction_test.cpp @@ -0,0 +1,394 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_friction_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListFrictionTest::CreateNativeNodeDefault(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListFrictionTest", "CreateNativeNodeDefault"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListFrictionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemBrother = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childFriction_value[] = {{.f32 = 0.6}}; + ArkUI_AttributeItem childFriction_value_item = {childFriction_value, + sizeof(childFriction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_FRICTION, &childFriction_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + nodeAPI->addChild(list, listItemBrother); + ArkUI_NumberValue listItemBrotherWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherWidth_item = {listItemBrotherWidth_value, + sizeof(listItemBrotherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_WIDTH, &listItemBrotherWidth_item); + + ArkUI_NumberValue listItemBrotherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherHeight_item = {listItemBrotherHeight_value, + sizeof(listItemBrotherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_HEIGHT, &listItemBrotherHeight_item); + + ArkUI_NumberValue listItemBrotherBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem listItemBrotherBackground_color_item = {listItemBrotherBackground_color_value, + sizeof(listItemBrotherBackground_color_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_BACKGROUND_COLOR, &listItemBrotherBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListFrictionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListFrictionTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListFrictionTest", "CreateNativeNodeNormal"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListFrictionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemBrother = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childFriction_value[] = {{.f32 = 20.6}}; + ArkUI_AttributeItem childFriction_value_item = {childFriction_value, + sizeof(childFriction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_FRICTION, &childFriction_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + nodeAPI->addChild(list, listItemBrother); + ArkUI_NumberValue listItemBrotherWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherWidth_item = {listItemBrotherWidth_value, + sizeof(listItemBrotherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_WIDTH, &listItemBrotherWidth_item); + + ArkUI_NumberValue listItemBrotherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherHeight_item = {listItemBrotherHeight_value, + sizeof(listItemBrotherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_HEIGHT, &listItemBrotherHeight_item); + + ArkUI_NumberValue listItemBrotherBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem listItemBrotherBackground_color_item = {listItemBrotherBackground_color_value, + sizeof(listItemBrotherBackground_color_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_BACKGROUND_COLOR, &listItemBrotherBackground_color_item); + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListFrictionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListFrictionTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListFrictionTest", "CreateNativeNodeNormal"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListFrictionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemBrother = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childFriction_value[] = {{.f32 = -0.1}}; + ArkUI_AttributeItem childFriction_value_item = {childFriction_value, + sizeof(childFriction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_FRICTION, &childFriction_value_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + nodeAPI->addChild(list, listItemBrother); + ArkUI_NumberValue listItemBrotherWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherWidth_item = {listItemBrotherWidth_value, + sizeof(listItemBrotherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_WIDTH, &listItemBrotherWidth_item); + + ArkUI_NumberValue listItemBrotherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemBrotherHeight_item = {listItemBrotherHeight_value, + sizeof(listItemBrotherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_HEIGHT, &listItemBrotherHeight_item); + + ArkUI_NumberValue listItemBrotherBackground_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem listItemBrotherBackground_color_item = {listItemBrotherBackground_color_value, + sizeof(listItemBrotherBackground_color_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemBrother, NODE_BACKGROUND_COLOR, &listItemBrotherBackground_color_item); + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListFrictionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_friction_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_friction_test.h new file mode 100644 index 0000000000000000000000000000000000000000..da359efbbd4acb00d9e20ba61948b99a9d461b73 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_friction_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_FRICTION_TEST_H +#define ARKUI_CAPI_DEMO_LIST_FRICTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListFrictionTest { +public: + ~ListFrictionTest(); + static napi_value CreateNativeNodeDefault(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_FRICTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..24d9af8451500d754b4cdcedb840e26701ee977e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_height_test.cpp @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHeightTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListHeightTest::CreateNativeNodeBeyondParentComponent(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHeightTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 450}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListHeightTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHeightTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListHeightTest::CreateNativeNodeLowerBoundAbnormalContainsSubComponent(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d7a404cecf5a76e99ff05ea023abeb2446a08f35 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_height_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_LIST_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListHeightTest { +public: + ~ListHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBeyondParentComponent(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormalContainsSubComponent(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_hittestbehavior_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_hittestbehavior_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8770dec8b15fc07ea5404bc0a0689a59dde73cd7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_hittestbehavior_test.cpp @@ -0,0 +1,380 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_hittestbehavior_test.h" +#include "../manager/plugin_manager.h" +#include + +#define LIST_ON_TOUCH_EVENT_ID 7001 +#define LIST_BROTHER_ON_TOUCH_EVENT_ID 7002 +#define LISTITEM_ON_TOUCH_EVENT_ID 7003 +using namespace std; + +namespace ArkUICApiDemo { + +void ListHitTestBehaviorTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + // 蓝色 + uint32_t background_color = 0xFF0000FF; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ListEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListEventOnClickTest", "OnEventReceive: event is null"); + return; + } + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsEnabledTest", "OnEventReceive eventId: %{public}d", + eventId); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == LIST_ON_TOUCH_EVENT_ID) { + // 蓝色 + background_color = 0xFF0000FF; + } else if (eventId == LISTITEM_ON_TOUCH_EVENT_ID) { + // 白色 + background_color = 0xFFFFFFFF; + } else if (eventId == LIST_BROTHER_ON_TOUCH_EVENT_ID) { + // 青色 + background_color = 0xFF00FFFF; + } + + // 如果是触摸事件 + if ((eventId == LIST_ON_TOUCH_EVENT_ID) || (eventId == LIST_BROTHER_ON_TOUCH_EVENT_ID) || + (eventId == LISTITEM_ON_TOUCH_EVENT_ID)) { + // 修改组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +ArkUI_NodeHandle ListHitTestBehaviorTest::CreateSubListNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t hittestbehavior, + const char *ontouchteststack) +{ + float stack_width = 400; + float stack_height = 400; + float list_width = 400; + float list_height = 300; + float listItem_width = 400; + float listItem_height = 250; + float list_brother_width = 400; + float list_brother_height = 350; + // 黄色 + uint32_t stack_background_color = 0xFFFFFF00; + // 红色 + uint32_t list_background_color = 0xFFFF0000; + // 绿色 + uint32_t list_brother_background_color = 0xFF00FF00; + // 紫色 + uint32_t listItem_background_color = 0xFFFF11FF; + // 创建容器组件 + auto stack = node_api->createNode(ARKUI_NODE_STACK); + auto list = node_api->createNode(ARKUI_NODE_LIST); + auto listItem = node_api->createNode(ARKUI_NODE_LIST_ITEM); + auto list_brother = node_api->createNode(ARKUI_NODE_LIST); + + // 设置容器ID + ArkUI_AttributeItem id_item = {}; + id_item.string = ontouchteststack; + node_api->setAttribute(stack, NODE_ID, &id_item); + + // 设置容器大小 + ArkUI_NumberValue stack_width_value[] = {{.f32 = stack_width}}; + ArkUI_AttributeItem stack_width_item = {stack_width_value, sizeof(stack_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &stack_width_item); + + ArkUI_NumberValue stack_height_value[] = {{.f32 = stack_height}}; + ArkUI_AttributeItem stack_height_item = {stack_height_value, + sizeof(stack_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &stack_height_item); + + // 设置容器组件背景色 + ArkUI_NumberValue stack_background_color_value[] = {{.u32 = stack_background_color}}; + ArkUI_AttributeItem stack_background_color_item = { + stack_background_color_value, sizeof(stack_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &stack_background_color_item); + // 设置listBrother组件大小 + ArkUI_NumberValue list_brother_width_value[] = {{.f32 = list_brother_width}}; + ArkUI_AttributeItem list_brother_width_item = {list_brother_width_value, + sizeof(list_brother_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(list_brother, NODE_WIDTH, &list_brother_width_item); + + ArkUI_NumberValue list_brother_height_value[] = {{.f32 = list_brother_height}}; + ArkUI_AttributeItem list_brother_height_item = {list_brother_height_value, + sizeof(list_brother_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(list_brother, NODE_HEIGHT, &list_brother_height_item); + + // 设置listBrother组件背景色 + ArkUI_NumberValue list_brother_background_color_value[] = {{.u32 = list_brother_background_color}}; + ArkUI_AttributeItem list_brother_background_color_item = { + list_brother_background_color_value, sizeof(list_brother_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(list_brother, NODE_BACKGROUND_COLOR, &list_brother_background_color_item); + + node_api->registerNodeEvent(list_brother, NODE_TOUCH_EVENT, LIST_BROTHER_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "IMAGE_BROTHER_ON_TOUCH_EVENT_ID", + "IMAGE_BROTHER_ON_TOUCH_EVENT_ID"); + + // 添加组件到容器 + node_api->addChild(stack, list_brother); + // 设置list组件大小 + ArkUI_NumberValue list_width_value[] = {{.f32 = list_width}}; + ArkUI_AttributeItem list_width_item = {list_width_value, sizeof(list_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(list, NODE_WIDTH, &list_width_item); + + ArkUI_NumberValue list_height_value[] = {{.f32 = list_height}}; + ArkUI_AttributeItem list_height_item = {list_height_value, sizeof(list_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(list, NODE_HEIGHT, &list_height_item); + + // 设置list组件背景色 + ArkUI_NumberValue list_background_color_value[] = {{.u32 = list_background_color}}; + ArkUI_AttributeItem list_background_color_item = {list_background_color_value, + sizeof(list_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(list, NODE_BACKGROUND_COLOR, &list_background_color_item); + + // 设置list组件触摸测试类型值 + ArkUI_NumberValue list_hittestbehavior_value[] = {{.i32 = hittestbehavior}}; + ArkUI_AttributeItem list_hittestbehavior_item = {list_hittestbehavior_value, + sizeof(list_hittestbehavior_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(list, NODE_HIT_TEST_BEHAVIOR, &list_hittestbehavior_item); + // 绑定list触摸事件 + node_api->registerNodeEvent(list, NODE_TOUCH_EVENT, LIST_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "IMAGE_ON_TOUCH_EVENT_ID", "IMAGE_ON_TOUCH_EVENT_ID"); + + // 添加组件到容器 + node_api->addChild(stack, list); + + // 设置listItem组件大小 + ArkUI_NumberValue listItem_width_value[] = {{.f32 = listItem_width}}; + ArkUI_AttributeItem listItem_width_item = {listItem_width_value, + sizeof(listItem_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(listItem, NODE_WIDTH, &listItem_width_item); + + ArkUI_NumberValue listItem_height_value[] = {{.f32 = listItem_height}}; + ArkUI_AttributeItem listItem_height_item = {listItem_height_value, + sizeof(listItem_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(listItem, NODE_HEIGHT, &listItem_height_item); + + ArkUI_NumberValue listItemHittestbehaviorValue[] = {{.i32 = ARKUI_HIT_TEST_MODE_TRANSPARENT}}; + ArkUI_AttributeItem listItemHittestbehaviorItem = {listItemHittestbehaviorValue, + sizeof(listItemHittestbehaviorValue) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(listItem, NODE_HIT_TEST_BEHAVIOR, &listItemHittestbehaviorItem); + // 设置listItem组件背景色 + ArkUI_NumberValue listItem_background_color_value[] = {{.u32 = listItem_background_color}}; + ArkUI_AttributeItem listItem_background_color_item = { + listItem_background_color_value, sizeof(listItem_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItem_background_color_item); + + node_api->registerNodeEvent(listItem, NODE_TOUCH_EVENT, LISTITEM_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "LISTITEM_ON_TOUCH_EVENT_ID", "IMAGE_BROTHER_ON_TOUCH_EVENT_ID"); + + // 添加组件到容器 + node_api->addChild(list, listItem); + return stack; +} + +napi_value ListHitTestBehaviorTest::CreateNativeNodeDefault(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hittestbehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_DEFAULT; + string ontouchtestStack = "OnTouchTestStackDefault"; + auto stack = CreateSubListNode(nodeAPI, hittestbehavior, ontouchtestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListHitTestBehaviorTest::CreateNativeNodeBlock(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hittestbehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_BLOCK; + string ontouchtestStack = "OnTouchTestStackBlock"; + auto stack = CreateSubListNode(nodeAPI, hittestbehavior, ontouchtestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListHitTestBehaviorTest::CreateNativeNodeTransparent(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hittestbehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_TRANSPARENT; + string ontouchtestStack = "OnTouchTestStackTransparent"; + auto stack = CreateSubListNode(nodeAPI, hittestbehavior, ontouchtestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListHitTestBehaviorTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hittestbehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_NONE; + string ontouchtestStack = "OnTouchTestStackNone"; + auto stack = CreateSubListNode(nodeAPI, hittestbehavior, ontouchtestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_hittestbehavior_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_hittestbehavior_test.h new file mode 100644 index 0000000000000000000000000000000000000000..134348c7b9c00f28b9748c241eaaa57b75841a27 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_hittestbehavior_test.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_HITTESTBEHAVIOR_TEST_H +#define ARKUI_CAPI_DEMO_LIST_HITTESTBEHAVIOR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +using namespace std; + +namespace ArkUICApiDemo { + +class ListHitTestBehaviorTest { +public: + ~ListHitTestBehaviorTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubListNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t hittestbehavior, + const char *ontouchteststack); + static napi_value CreateNativeNodeDefault(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlock(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTransparent(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_HITTESTBEHAVIOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_lineargradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_lineargradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..19f23b8728e1303aaf221fcc9fee6a27af2765b3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_lineargradient_test.cpp @@ -0,0 +1,920 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_lineargradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include +namespace ArkUICApiDemo { +napi_value ListLinearGradientTest::CreateNativeNodeLeft(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_TOP}, {.i32 = true}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeRight(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeLeftTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeLeftBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeRightTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeRightBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_NONE}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeCustom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonAttrsLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = {{.f32 = 180}, {.i32 = -1}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListLinearGradientTest::CreateNativeNodeIllegalColorAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {123, 1234}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(list, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_lineargradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_lineargradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7c05489cd7777218695fe3fecf420b8d1547710b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_lineargradient_test.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_LINEARGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_LIST_LINEARGRADIENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListLinearGradientTest { +public: + ~ListLinearGradientTest(); + static napi_value CreateNativeNodeLeft(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRight(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLeftTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLeftBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRightTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRightBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCustom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeIllegalColorAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_LINEARGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_listdirection_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_listdirection_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8364a58deeb8f7e9449f7957d7fc4f04f6c34345 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_listdirection_test.cpp @@ -0,0 +1,443 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_listdirection_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListListDirectionTest::CreateNativeNodeVertical(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItem1 = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue listDirection_value[] = {{.i32 = ARKUI_AXIS_VERTICAL}}; + ArkUI_AttributeItem listDirection_item = {listDirection_value, + sizeof(listDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_DIRECTION, &listDirection_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childListDirection_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childListDirection_item = {childListDirection_value, + sizeof(childListDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childListDirection_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + nodeAPI->addChild(list, listItem1); + + ArkUI_NumberValue child1ListDirection_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem child1ListDirection_item = {child1ListDirection_value, + sizeof(child1ListDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_WIDTH, &child1ListDirection_item); + + ArkUI_NumberValue child1Height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem child1Height_item = {child1Height_value, + sizeof(child1Height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_HEIGHT, &child1Height_item); + + ArkUI_NumberValue child1Background_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem child1Background_color_item = { + child1Background_color_value, sizeof(child1Background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_BACKGROUND_COLOR, &child1Background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListListDirectionTest::CreateNativeNodeHorizontal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItem1 = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue listDirection_value[] = {{.i32 = ARKUI_AXIS_HORIZONTAL}}; + ArkUI_AttributeItem listDirection_item = {listDirection_value, + sizeof(listDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_DIRECTION, &listDirection_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childListDirection_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childListDirection_item = {childListDirection_value, + sizeof(childListDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childListDirection_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + nodeAPI->addChild(list, listItem1); + + ArkUI_NumberValue child1ListDirection_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem child1ListDirection_item = {child1ListDirection_value, + sizeof(child1ListDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_WIDTH, &child1ListDirection_item); + + ArkUI_NumberValue child1Height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem child1Height_item = {child1Height_value, + sizeof(child1Height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_HEIGHT, &child1Height_item); + + ArkUI_NumberValue child1Background_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem child1Background_color_item = { + child1Background_color_value, sizeof(child1Background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_BACKGROUND_COLOR, &child1Background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListListDirectionTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItem1 = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue listDirection_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem listDirection_item = {listDirection_value, + sizeof(listDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_DIRECTION, &listDirection_item); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childListDirection_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childListDirection_item = {childListDirection_value, + sizeof(childListDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childListDirection_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + nodeAPI->addChild(list, listItem1); + + ArkUI_NumberValue child1ListDirection_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem child1ListDirection_item = {child1ListDirection_value, + sizeof(child1ListDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_WIDTH, &child1ListDirection_item); + + ArkUI_NumberValue child1Height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem child1Height_item = {child1Height_value, + sizeof(child1Height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_HEIGHT, &child1Height_item); + + ArkUI_NumberValue child1Background_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem child1Background_color_item = { + child1Background_color_value, sizeof(child1Background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_BACKGROUND_COLOR, &child1Background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListListDirectionTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItem1 = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue listDirection_value[] = {{.i32 = 2}}; + ArkUI_AttributeItem listDirection_item = {listDirection_value, + sizeof(listDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_DIRECTION, &listDirection_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childListDirection_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childListDirection_item = {childListDirection_value, + sizeof(childListDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childListDirection_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + nodeAPI->addChild(list, listItem1); + + ArkUI_NumberValue child1ListDirection_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem child1ListDirection_item = {child1ListDirection_value, + sizeof(child1ListDirection_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_WIDTH, &child1ListDirection_item); + + ArkUI_NumberValue child1Height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem child1Height_item = {child1Height_value, + sizeof(child1Height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_HEIGHT, &child1Height_item); + + ArkUI_NumberValue child1Background_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem child1Background_color_item = { + child1Background_color_value, sizeof(child1Background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem1, NODE_BACKGROUND_COLOR, &child1Background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListListDirectionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_listdirection_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_listdirection_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e1ace88de4955cc10fc7d2c778f914a8d726c8f9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_listdirection_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_LISTDIRECTION_TEST_H +#define ARKUI_CAPI_DEMO_LIST_LISTDIRECTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListListDirectionTest { +public: + ~ListListDirectionTest(); + static napi_value CreateNativeNodeVertical(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeHorizontal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_LISTDIRECTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_opacity_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_opacity_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7f15fe4433774003875a07ddb504b4ac527848c5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_opacity_test.cpp @@ -0,0 +1,375 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_opacity_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListOpacityTest::CreateNativeNodeMax(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childOpacity_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem childOpacity_item = {childOpacity_value, + sizeof(childOpacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_OPACITY, &childOpacity_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListOpacityTest::CreateNativeNodeMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childOpacity_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem childOpacity_item = {childOpacity_value, + sizeof(childOpacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_OPACITY, &childOpacity_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListOpacityTest::CreateNativeNodeMiddle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childOpacity_value[] = {{.f32 = 0.5}}; + ArkUI_AttributeItem childOpacity_item = {childOpacity_value, + sizeof(childOpacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_OPACITY, &childOpacity_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListOpacityTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childOpacity_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem childOpacity_item = {childOpacity_value, + sizeof(childOpacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_OPACITY, &childOpacity_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListOpacityTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childOpacity_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem childOpacity_item = {childOpacity_value, + sizeof(childOpacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_OPACITY, &childOpacity_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_opacity_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_opacity_test.h new file mode 100644 index 0000000000000000000000000000000000000000..687b591f077b669ee51d8b5aef1c2878aac3f795 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_opacity_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_OPACITY_TEST_H +#define ARKUI_CAPI_DEMO_LIST_OPACITY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListOpacityTest { +public: + ~ListOpacityTest(); + static napi_value CreateNativeNodeMax(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMiddle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_OPACITY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_rotate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_rotate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..856ca0b17a1566995715662985625bf5c192f228 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_rotate_test.cpp @@ -0,0 +1,434 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_rotate_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListRotateTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = 100}, {.f32 = 100}, {.f32 = 100}, {.f32 = 90}, {.f32 = 100}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListRotateTest::CreateNativeNodeSetNegativeNumbers(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = -100}, {.f32 = -100}, {.f32 = -100}, {.f32 = -90}, {.f32 = -100}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListRotateTest::CreateNativeNodeDefaultValue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListRotateTest::CreateNativeNodeSetXYZ(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = 100}, {.f32 = 100}, {.f32 = 100}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListRotateTest::CreateNativeNodeSetRotationAngle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 90}, {.f32 = 0}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListRotateTest::CreateNativeNodeSetSightDistance(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 100}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_rotate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_rotate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fafa42a4282770a1ad122e1019f35c6032c3854a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_rotate_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_ROTATE_TEST_H +#define ARKUI_CAPI_DEMO_LIST_ROTATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListRotateTest { +public: + ~ListRotateTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetNegativeNumbers(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDefaultValue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetXYZ(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetRotationAngle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetSightDistance(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_ROTATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_saturate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_saturate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4f3022992a5b39c5df8b73ff2a87ef72b0f468eb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_saturate_test.cpp @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_saturate_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { +napi_value ListSaturateTest::CreateNativeNodeMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childdWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childdWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childSaturate_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem childSaturate_item = {childSaturate_value, + sizeof(childSaturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SATURATION, &childSaturate_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListSaturateTest::CreateNativeNodeMax(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childdWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childdWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childSaturate_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem childSaturate_item = {childSaturate_value, + sizeof(childSaturate_value) / sizeof(ArkUI_NumberValue)}; + int32_t ret = nodeAPI->setAttribute(list, NODE_SATURATION, &childSaturate_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "setAttribute", "ret is %{public}d", ret); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListSaturateTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childdWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childdWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childSaturate_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem childSaturate_item = {childSaturate_value, + sizeof(childSaturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SATURATION, &childSaturate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListSaturateTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childdWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childdWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childSaturate_value[] = {{.f32 = (50 + 1)}}; + ArkUI_AttributeItem childSaturate_item = {childSaturate_value, + sizeof(childSaturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SATURATION, &childSaturate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_saturate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_saturate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5b144358829142dbabf062b76c68657cfd2ca1d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_saturate_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_SATURATE_TEST_H +#define ARKUI_CAPI_DEMO_LIST_SATURATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListSaturateTest { +public: + ~ListSaturateTest(); + static napi_value CreateNativeNodeMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMax(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_SATURATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scale_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scale_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..084200bd141d6e5ec64acb77a5ac7b55bde4fa8d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scale_test.cpp @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_scale_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListScaleTest::CreateNativeNodeReduceXY(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 0.5}, {.f32 = 0.5}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListScaleTest::CreateNativeNodeReduceX(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 0.5}, {.f32 = 1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListScaleTest::CreateNativeNodeEnlargeXY(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 2}, {.f32 = 2}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListScaleTest::CreateNativeNodeEnlargeX(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 2}, {.f32 = 1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListScaleTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = -1}, {.f32 = -1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scale_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scale_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1970bb5e1975e3287b4ba38f6be66961e46dfc5c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scale_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_SCALE_TEST_H +#define ARKUI_CAPI_DEMO_LIST_SCALE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListScaleTest { +public: + ~ListScaleTest(); + static napi_value CreateNativeNodeReduceXY(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeReduceX(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnlargeXY(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnlargeX(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_SCALE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scrollbar_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scrollbar_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b3a3f119af33b6f365a78a58aa85ecd1523dfdd8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scrollbar_test.cpp @@ -0,0 +1,519 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_scrollbar_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListScrollBarTest::CreateNativeNodeOff(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", "CreateNativeNode"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_OFF}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListScrollBarTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", "CreateNativeNode"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListScrollBarTest::CreateNativeNodeOn(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListScrollBarTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListScrollBarTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = 100}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemWidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &listItemWidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scrollbar_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scrollbar_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bbe108a29a72f7ff7d72e8dfb043dbd653daac06 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_scrollbar_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_SCROLLBAR_TEST_H +#define ARKUI_CAPI_DEMO_LIST_SCROLLBAR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListScrollBarTest { +public: + ~ListScrollBarTest(); + static napi_value CreateNativeNodeOff(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeOn(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_SCROLLBAR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_shadow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_shadow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..794fe86fda1ee6ee50cab2cbbb79c661a5aac794 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_shadow_test.cpp @@ -0,0 +1,587 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_shadow_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListShadowTest::CreateNativeNodeUltraSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListShadowTest::CreateNativeNodeSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SHADOW, &childShadow_item); + + ArkUI_NumberValue childCustomShadow_value[] = { + {.f32 = 50}, {.i32 = 1}, {.f32 = 50}, {.f32 = 50}, {.i32 = ARKUI_SHADOW_TYPE_COLOR}, + {.u32 = 0xFFFFFF00}, {.u32 = 1}}; + ArkUI_AttributeItem childCustomShadow_item = {childCustomShadow_value, + sizeof(childCustomShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_CUSTOM_SHADOW, &childCustomShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListShadowTest::CreateNativeNodeMiddleShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListShadowTest::CreateNativeNodeLargeShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListShadowTest::CreateNativeNodeFloatingShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListShadowTest::CreateNativeNodeFloatingSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListShadowTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListShadowTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = 7}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_shadow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_shadow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..615d0d98e3ae99c2a01acf6fb4ddd2bf4a6130e3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_shadow_test.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_SHADOW_TEST_H +#define ARKUI_CAPI_DEMO_LIST_SHADOW_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListShadowTest { +public: + ~ListShadowTest(); + static napi_value CreateNativeNodeUltraSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMiddleShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLargeShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFloatingShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFloatingSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_SHADOW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_sticky_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_sticky_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7eded4b3236efb3ad17249e49e99b1a92632c7ff --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_sticky_test.cpp @@ -0,0 +1,907 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_sticky_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListStickyTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "CreateNativeNode"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItemGroup = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM_GROUP); + auto listItemChild = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemGroupHeader = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto listItemGroupFooter = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // column + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + // list + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue sticky_value[] = {{.i32 = ARKUI_STICKY_STYLE_NONE}}; + ArkUI_AttributeItem sticky_item = {sticky_value, sizeof(sticky_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_STICKY, &sticky_item); + + ArkUI_NumberValue childFriction_value[] = {{.f32 = 20.6}}; + ArkUI_AttributeItem childFriction_value_item = {childFriction_value, + sizeof(childFriction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_FRICTION, &childFriction_value_item); + nodeAPI->addChild(list, listItemGroup); + // listItemGroup + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_BACKGROUND_COLOR, &childBackground_color_item); + // Header + ArkUI_AttributeItem header = {}; + header.object = listItemGroupHeader; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_HEADER, &header); + + ArkUI_NumberValue headerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem headerWidth_item = {headerWidth_value, sizeof(headerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_WIDTH, &headerWidth_item); + + ArkUI_NumberValue headerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem headerHeight_item = {headerHeight_value, + sizeof(headerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_HEIGHT, &headerHeight_item); + + ArkUI_NumberValue headerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem headerBackground_color_item = { + headerBackground_color_value, sizeof(headerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_BACKGROUND_COLOR, &headerBackground_color_item); + + // footer + ArkUI_AttributeItem footer = {}; + footer.object = listItemGroupFooter; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_FOOTER, &footer); + + ArkUI_NumberValue footerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem footerWidth_item = {footerWidth_value, sizeof(footerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_WIDTH, &footerWidth_item); + + ArkUI_NumberValue footerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem footerHeight_item = {footerHeight_value, + sizeof(footerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_HEIGHT, &footerHeight_item); + + ArkUI_NumberValue footerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem footerBackground_color_item = { + footerBackground_color_value, sizeof(footerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_BACKGROUND_COLOR, &footerBackground_color_item); + + // listItem + nodeAPI->addChild(listItemGroup, listItemChild); + ArkUI_NumberValue grandsonWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonWidth_item = {grandsonWidth_value, + sizeof(grandsonWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_WIDTH, &grandsonWidth_item); + + ArkUI_NumberValue grandsonHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonHeight_item = {grandsonHeight_value, + sizeof(grandsonHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_HEIGHT, &grandsonHeight_item); + + ArkUI_NumberValue grandsonBackground_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem grandsonBackground_color_item = { + grandsonBackground_color_value, sizeof(grandsonBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_BACKGROUND_COLOR, &grandsonBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListStickyTest::CreateNativeNodeHeader(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "CreateNativeNode"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItemGroup = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM_GROUP); + auto listItemChild = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemGroupHeader = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto listItemGroupFooter = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // column + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + // list + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue sticky_value[] = {{.i32 = ARKUI_STICKY_STYLE_HEADER}}; + ArkUI_AttributeItem sticky_item = {sticky_value, sizeof(sticky_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_STICKY, &sticky_item); + + ArkUI_NumberValue childFriction_value[] = {{.f32 = 20.6}}; + ArkUI_AttributeItem childFriction_value_item = {childFriction_value, + sizeof(childFriction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_FRICTION, &childFriction_value_item); + nodeAPI->addChild(list, listItemGroup); + // listItemGroup + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_BACKGROUND_COLOR, &childBackground_color_item); + // Header + ArkUI_AttributeItem header = {}; + header.object = listItemGroupHeader; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_HEADER, &header); + + ArkUI_NumberValue headerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem headerWidth_item = {headerWidth_value, sizeof(headerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_WIDTH, &headerWidth_item); + + ArkUI_NumberValue headerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem headerHeight_item = {headerHeight_value, + sizeof(headerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_HEIGHT, &headerHeight_item); + + ArkUI_NumberValue headerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem headerBackground_color_item = { + headerBackground_color_value, sizeof(headerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_BACKGROUND_COLOR, &headerBackground_color_item); + + // footer + ArkUI_AttributeItem footer = {}; + footer.object = listItemGroupFooter; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_FOOTER, &footer); + + ArkUI_NumberValue footerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem footerWidth_item = {footerWidth_value, sizeof(footerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_WIDTH, &footerWidth_item); + + ArkUI_NumberValue footerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem footerHeight_item = {footerHeight_value, + sizeof(footerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_HEIGHT, &footerHeight_item); + + ArkUI_NumberValue footerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem footerBackground_color_item = { + footerBackground_color_value, sizeof(footerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_BACKGROUND_COLOR, &footerBackground_color_item); + + // listItem + nodeAPI->addChild(listItemGroup, listItemChild); + ArkUI_NumberValue grandsonWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonWidth_item = {grandsonWidth_value, + sizeof(grandsonWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_WIDTH, &grandsonWidth_item); + + ArkUI_NumberValue grandsonHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonHeight_item = {grandsonHeight_value, + sizeof(grandsonHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_HEIGHT, &grandsonHeight_item); + + ArkUI_NumberValue grandsonBackground_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem grandsonBackground_color_item = { + grandsonBackground_color_value, sizeof(grandsonBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_BACKGROUND_COLOR, &grandsonBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListStickyTest::CreateNativeNodeFooter(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "CreateNativeNode"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItemGroup = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM_GROUP); + auto listItemChild = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemGroupHeader = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto listItemGroupFooter = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // column + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + // list + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue sticky_value[] = {{.i32 = ARKUI_STICKY_STYLE_FOOTER}}; + ArkUI_AttributeItem sticky_item = {sticky_value, sizeof(sticky_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_STICKY, &sticky_item); + ArkUI_NumberValue childFriction_value[] = {{.f32 = 20.6}}; + ArkUI_AttributeItem childFriction_value_item = {childFriction_value, + sizeof(childFriction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_FRICTION, &childFriction_value_item); + nodeAPI->addChild(list, listItemGroup); + // listItemGroup + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_BACKGROUND_COLOR, &childBackground_color_item); + // Header + ArkUI_AttributeItem header = {}; + header.object = listItemGroupHeader; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_HEADER, &header); + + ArkUI_NumberValue headerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem headerWidth_item = {headerWidth_value, sizeof(headerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_WIDTH, &headerWidth_item); + + ArkUI_NumberValue headerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem headerHeight_item = {headerHeight_value, + sizeof(headerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_HEIGHT, &headerHeight_item); + + ArkUI_NumberValue headerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem headerBackground_color_item = { + headerBackground_color_value, sizeof(headerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_BACKGROUND_COLOR, &headerBackground_color_item); + + // footer + ArkUI_AttributeItem footer = {}; + footer.object = listItemGroupFooter; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_FOOTER, &footer); + + ArkUI_NumberValue footerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem footerWidth_item = {footerWidth_value, sizeof(footerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_WIDTH, &footerWidth_item); + + ArkUI_NumberValue footerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem footerHeight_item = {footerHeight_value, + sizeof(footerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_HEIGHT, &footerHeight_item); + + ArkUI_NumberValue footerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem footerBackground_color_item = { + footerBackground_color_value, sizeof(footerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_BACKGROUND_COLOR, &footerBackground_color_item); + + // listItem + nodeAPI->addChild(listItemGroup, listItemChild); + ArkUI_NumberValue grandsonWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonWidth_item = {grandsonWidth_value, + sizeof(grandsonWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_WIDTH, &grandsonWidth_item); + + ArkUI_NumberValue grandsonHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonHeight_item = {grandsonHeight_value, + sizeof(grandsonHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_HEIGHT, &grandsonHeight_item); + + ArkUI_NumberValue grandsonBackground_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem grandsonBackground_color_item = { + grandsonBackground_color_value, sizeof(grandsonBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_BACKGROUND_COLOR, &grandsonBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListStickyTest::CreateNativeNodeBoth(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "CreateNativeNode"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItemGroup = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM_GROUP); + auto listItemChild = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemGroupHeader = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto listItemGroupFooter = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // column + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + // list + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue sticky_value[] = {{.i32 = ARKUI_STICKY_STYLE_BOTH}}; + ArkUI_AttributeItem sticky_item = {sticky_value, sizeof(sticky_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_STICKY, &sticky_item); + ArkUI_NumberValue childFriction_value[] = {{.f32 = 20.6}}; + ArkUI_AttributeItem childFriction_value_item = {childFriction_value, + sizeof(childFriction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_FRICTION, &childFriction_value_item); + nodeAPI->addChild(list, listItemGroup); + // listItemGroup + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_BACKGROUND_COLOR, &childBackground_color_item); + // Header + ArkUI_AttributeItem header = {}; + header.object = listItemGroupHeader; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_HEADER, &header); + + ArkUI_NumberValue headerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem headerWidth_item = {headerWidth_value, sizeof(headerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_WIDTH, &headerWidth_item); + + ArkUI_NumberValue headerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem headerHeight_item = {headerHeight_value, + sizeof(headerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_HEIGHT, &headerHeight_item); + + ArkUI_NumberValue headerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem headerBackground_color_item = { + headerBackground_color_value, sizeof(headerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_BACKGROUND_COLOR, &headerBackground_color_item); + + // footer + ArkUI_AttributeItem footer = {}; + footer.object = listItemGroupFooter; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_FOOTER, &footer); + + ArkUI_NumberValue footerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem footerWidth_item = {footerWidth_value, sizeof(footerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_WIDTH, &footerWidth_item); + + ArkUI_NumberValue footerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem footerHeight_item = {footerHeight_value, + sizeof(footerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_HEIGHT, &footerHeight_item); + + ArkUI_NumberValue footerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem footerBackground_color_item = { + footerBackground_color_value, sizeof(footerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_BACKGROUND_COLOR, &footerBackground_color_item); + + // listItem + nodeAPI->addChild(listItemGroup, listItemChild); + ArkUI_NumberValue grandsonWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonWidth_item = {grandsonWidth_value, + sizeof(grandsonWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_WIDTH, &grandsonWidth_item); + + ArkUI_NumberValue grandsonHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonHeight_item = {grandsonHeight_value, + sizeof(grandsonHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_HEIGHT, &grandsonHeight_item); + + ArkUI_NumberValue grandsonBackground_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem grandsonBackground_color_item = { + grandsonBackground_color_value, sizeof(grandsonBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_BACKGROUND_COLOR, &grandsonBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListStickyTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "CreateNativeNode"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItemGroup = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM_GROUP); + auto listItemChild = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemGroupHeader = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto listItemGroupFooter = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // column + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + // list + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue sticky_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem sticky_item = {sticky_value, sizeof(sticky_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_STICKY, &sticky_item); + ArkUI_NumberValue childFriction_value[] = {{.f32 = 20.6}}; + ArkUI_AttributeItem childFriction_value_item = {childFriction_value, + sizeof(childFriction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_FRICTION, &childFriction_value_item); + nodeAPI->addChild(list, listItemGroup); + // listItemGroup + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_BACKGROUND_COLOR, &childBackground_color_item); + // Header + ArkUI_AttributeItem header = {}; + header.object = listItemGroupHeader; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_HEADER, &header); + + ArkUI_NumberValue headerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem headerWidth_item = {headerWidth_value, sizeof(headerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_WIDTH, &headerWidth_item); + + ArkUI_NumberValue headerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem headerHeight_item = {headerHeight_value, + sizeof(headerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_HEIGHT, &headerHeight_item); + + ArkUI_NumberValue headerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem headerBackground_color_item = { + headerBackground_color_value, sizeof(headerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_BACKGROUND_COLOR, &headerBackground_color_item); + + // footer + ArkUI_AttributeItem footer = {}; + footer.object = listItemGroupFooter; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_FOOTER, &footer); + + ArkUI_NumberValue footerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem footerWidth_item = {footerWidth_value, sizeof(footerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_WIDTH, &footerWidth_item); + + ArkUI_NumberValue footerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem footerHeight_item = {footerHeight_value, + sizeof(footerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_HEIGHT, &footerHeight_item); + + ArkUI_NumberValue footerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem footerBackground_color_item = { + footerBackground_color_value, sizeof(footerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_BACKGROUND_COLOR, &footerBackground_color_item); + + // listItem + nodeAPI->addChild(listItemGroup, listItemChild); + ArkUI_NumberValue grandsonWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonWidth_item = {grandsonWidth_value, + sizeof(grandsonWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_WIDTH, &grandsonWidth_item); + + ArkUI_NumberValue grandsonHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonHeight_item = {grandsonHeight_value, + sizeof(grandsonHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_HEIGHT, &grandsonHeight_item); + + ArkUI_NumberValue grandsonBackground_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem grandsonBackground_color_item = { + grandsonBackground_color_value, sizeof(grandsonBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_BACKGROUND_COLOR, &grandsonBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListStickyTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "CreateNativeNode"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItemGroup = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM_GROUP); + auto listItemChild = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto listItemGroupHeader = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto listItemGroupFooter = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // column + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + // list + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0XFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue sticky_value[] = {{.i32 = 10}}; + ArkUI_AttributeItem sticky_item = {sticky_value, sizeof(sticky_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_LIST_STICKY, &sticky_item); + + ArkUI_NumberValue childFriction_value[] = {{.f32 = 20.6}}; + ArkUI_AttributeItem childFriction_value_item = {childFriction_value, + sizeof(childFriction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_SCROLL_FRICTION, &childFriction_value_item); + + nodeAPI->addChild(list, listItemGroup); + // listItemGroup + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroup, NODE_BACKGROUND_COLOR, &childBackground_color_item); + // Header + ArkUI_AttributeItem header = {}; + header.object = listItemGroupHeader; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_HEADER, &header); + + ArkUI_NumberValue headerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem headerWidth_item = {headerWidth_value, sizeof(headerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_WIDTH, &headerWidth_item); + + ArkUI_NumberValue headerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem headerHeight_item = {headerHeight_value, + sizeof(headerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_HEIGHT, &headerHeight_item); + + ArkUI_NumberValue headerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem headerBackground_color_item = { + headerBackground_color_value, sizeof(headerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupHeader, NODE_BACKGROUND_COLOR, &headerBackground_color_item); + + // footer + ArkUI_AttributeItem footer = {}; + footer.object = listItemGroupFooter; + nodeAPI->setAttribute(listItemGroup, NODE_LIST_ITEM_GROUP_SET_FOOTER, &footer); + + ArkUI_NumberValue footerWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem footerWidth_item = {footerWidth_value, sizeof(footerWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_WIDTH, &footerWidth_item); + + ArkUI_NumberValue footerHeight_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem footerHeight_item = {footerHeight_value, + sizeof(footerHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_HEIGHT, &footerHeight_item); + + ArkUI_NumberValue footerBackground_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem footerBackground_color_item = { + footerBackground_color_value, sizeof(footerBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemGroupFooter, NODE_BACKGROUND_COLOR, &footerBackground_color_item); + + // listItem + nodeAPI->addChild(listItemGroup, listItemChild); + ArkUI_NumberValue grandsonWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonWidth_item = {grandsonWidth_value, + sizeof(grandsonWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_WIDTH, &grandsonWidth_item); + + ArkUI_NumberValue grandsonHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem grandsonHeight_item = {grandsonHeight_value, + sizeof(grandsonHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_HEIGHT, &grandsonHeight_item); + + ArkUI_NumberValue grandsonBackground_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem grandsonBackground_color_item = { + grandsonBackground_color_value, sizeof(grandsonBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItemChild, NODE_BACKGROUND_COLOR, &grandsonBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(list, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListStickyTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_sticky_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_sticky_test.h new file mode 100644 index 0000000000000000000000000000000000000000..20089322c963a739253ca5dadb5bbda9f46400cd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_sticky_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_STICKY_TEST_H +#define ARKUI_CAPI_DEMO_LIST_STICKY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListStickyTest { +public: + ~ListStickyTest(); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeHeader(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFooter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBoth(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_STICKY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_translate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_translate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..98ffd7a2eb6b618ee199490e0fa8a16d7f1aced9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_translate_test.cpp @@ -0,0 +1,443 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_translate_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListTranslateTest::CreateNativeNodeSetXYZ(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_TRANSLATE, &childTranslate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListTranslateTest::CreateNativeNodeSetX(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = 50}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_TRANSLATE, &childTranslate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListTranslateTest::CreateNativeNodeSetXMinus(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = -50}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + int32_t ret = nodeAPI->setAttribute(list, NODE_TRANSLATE, &childTranslate_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "setAttribute", "ret is %{public}d", ret); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListTranslateTest::CreateNativeNodeSetXYZMinus(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = -50}, {.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_TRANSLATE, &childTranslate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListTranslateTest::CreateNativeNodeUnifiedAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_TRANSLATE, &childTranslate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListTranslateTest::CreateNativeNodeUnifiedMinusAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_TRANSLATE, &childTranslate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_translate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_translate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..413eed429d2bb9a7ceb917240ca1afa8daf4e664 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_translate_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_TRANSLATE_TEST_H +#define ARKUI_CAPI_DEMO_LIST_TRANSLATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListTranslateTest { +public: + ~ListTranslateTest(); + static napi_value CreateNativeNodeSetXYZ(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetX(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetXMinus(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetXYZMinus(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUnifiedAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUnifiedMinusAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_TRANSLATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a4efffb59e0a8dc2a3d2febfe651144d56939c2f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_width_test.cpp @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "list_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListWidthTest::CreateNativeNodeBeyondParentComponent(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 450}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListWidthTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(column, list); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListWidthTest::CreateNativeNodeLowerBoundAbnormalContainsSubComponent(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(column, list); + ArkUI_NumberValue width_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bc94eac535038951f3c6ed3ad5e82a305c2658ab --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/list/list_width_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LIST_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_LIST_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListWidthTest { +public: + ~ListWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBeyondParentComponent(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormalContainsSubComponent(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LIST_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..af77fc08d54f3b12d33e387fc493f9c74f2fd125 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_backgroundcolor_test.cpp @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "listitem_backgroundcolor_test.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t backgroundColor) +{ + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + // 设置组件宽度 + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childBackgroundColor_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childBackgroundColor_item = {childBackgroundColor_value, + sizeof(childBackgroundColor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childBackgroundColor_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + return listItem; +} + +napi_value ListItemBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = createChildNode(nodeAPI, 0xFFFF0000); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemBackgroundColorTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = createChildNode(nodeAPI, napi_null); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemBackgroundColorTest::CreateNativeNodeUndefined(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = createChildNode(nodeAPI, napi_undefined); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1d26fd6aee3a91d575024ddea5e1623769c37c33 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_backgroundcolor_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemBackgroundColorTest { +public: + ~ListItemBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUndefined(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_blur_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_blur_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7d3b5070590ace21c7894c10dacbe8b72b624884 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_blur_test.cpp @@ -0,0 +1,273 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_blur_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListItemBlurTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBlurTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBlurTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue blur_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem blur_item = {blur_value, sizeof(blur_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BLUR, &blur_item); + nodeAPI->addChild(listItem, column); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemBlurTest::CreateNativeNodeDefaultValue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBlurTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBlurTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue blur_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem blur_item = {blur_value, sizeof(blur_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BLUR, &blur_item); + nodeAPI->addChild(listItem, column); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemBlurTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBlurTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBlurTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue blur_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem blur_item = {blur_value, sizeof(blur_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BLUR, &blur_item); + nodeAPI->addChild(listItem, column); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_blur_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_blur_test.h new file mode 100644 index 0000000000000000000000000000000000000000..aa17ec72c36591cd0743437c99ef28217c6d4279 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_blur_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_BLUR_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_BLUR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemBlurTest { +public: + ~ListItemBlurTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDefaultValue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_BLUR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_bordercolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_bordercolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f2f0d46ce33e99f6451b11f098af4ea5a7d6dae4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_bordercolor_test.cpp @@ -0,0 +1,326 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "listitem_bordercolor_test.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t borderColor) +{ + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue childBorderColor_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childBorderColor_item = {childBorderColor_value, + sizeof(childBorderColor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderColor_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = borderColor}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + return listItem; +} + +napi_value ListItemBorderColorTest::CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = createChildNode(nodeAPI, 0xFF000000); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + nodeAPI->addChild(list, listItem); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value ListItemBorderColorTest::CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = { + {.u32 = 0xFFFF11FF}, {.u32 = 0xFF00FFFF}, {.u32 = 0xFFFFFF00}, {.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = { + {.u32 = 0xFFFF11FF}, {.u32 = 0xFF00FFFF}, {.u32 = 0xFFFFFF00}, {.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemBorderColorTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = createChildNode(nodeAPI, napi_null); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + nodeAPI->addChild(list, listItem); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value ListItemBorderColorTest::CreateNativeNodeUndefined(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = createChildNode(nodeAPI, napi_undefined); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + nodeAPI->addChild(list, listItem); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_bordercolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_bordercolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0014d6a528f9a640a586ef9ef660e7917cf18fd3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_bordercolor_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_BORDERCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_BORDERCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemBorderColorTest { +public: + ~ListItemBorderColorTest(); + static napi_value CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUndefined(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_BORDERCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderradius_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderradius_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..78c7dacc4fb9b967c0b9023939641a3ea6b7fc28 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderradius_test.cpp @@ -0,0 +1,410 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_borderradius_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListItemBorderRadiusTest::CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_RADIUS, &border_radius_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderRadius_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childBorderRadius_item = {childBorderRadius_value, + sizeof(childBorderRadius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderRadius_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBorder_radius_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_radius_item = {childBorder_radius_value, + sizeof(childBorder_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_RADIUS, &childBorder_radius_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} +napi_value ListItemBorderRadiusTest::CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_RADIUS, &border_radius_item); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderRadius_value[] = {{.f32 = 370}}; + ArkUI_AttributeItem childBorderRadius_item = {childBorderRadius_value, + sizeof(childBorderRadius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderRadius_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBorder_radius_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem childBorder_radius_item = {childBorder_radius_value, + sizeof(childBorder_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_RADIUS, &childBorder_radius_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListItemBorderRadiusTest::CreateNativeNodeUnifiedSettingsLowerBoundAbnormal(napi_env env, + napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = -10}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_RADIUS, &border_radius_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderRadius_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childBorderRadius_item = {childBorderRadius_value, + sizeof(childBorderRadius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderRadius_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBorder_radius_value[] = {{.f32 = -10}}; + ArkUI_AttributeItem childBorder_radius_item = {childBorder_radius_value, + sizeof(childBorder_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_RADIUS, &childBorder_radius_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + return exports; +} + +napi_value ListItemBorderRadiusTest::CreateNativeNodeRespectivelySettingsLowerBoundAbnormal(napi_env env, + napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_color_value[] = {{.u32 = 0xFFFF11FF}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_COLOR, &border_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = -10}, {.f32 = -10}, {.f32 = -20}, {.f32 = -20}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_RADIUS, &border_radius_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderRadius_value[] = {{.f32 = 370}}; + ArkUI_AttributeItem childBorderRadius_item = {childBorderRadius_value, + sizeof(childBorderRadius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderRadius_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem childBorder_color_item = {childBorder_color_value, + sizeof(childBorder_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_COLOR, &childBorder_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + ArkUI_NumberValue childBorder_radius_value[] = {{.f32 = -10}, {.f32 = -10}, {.f32 = -20}, {.f32 = -20}}; + ArkUI_AttributeItem childBorder_radius_item = {childBorder_radius_value, + sizeof(childBorder_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_RADIUS, &childBorder_radius_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderradius_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderradius_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2320b11ac704631f55b0e783170a574a091a979b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderradius_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_BORDERRADIUS_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_BORDERRADIUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemBorderRadiusTest { +public: + ~ListItemBorderRadiusTest(); + static napi_value CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUnifiedSettingsLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelySettingsLowerBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_BORDERRADIUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderwidth_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderwidth_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..847b5b76f0a19acdd39650c90ccb9d6ed11b0b53 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderwidth_test.cpp @@ -0,0 +1,329 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_borderwidth_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListItemBorderWidthTest::CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childBorderWidth_item = {childBorderWidth_value, + sizeof(childBorderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListItemBorderWidthTest::CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 10}, {.f32 = 20}, {.f32 = 30}, {.f32 = 40}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childBorderWidth_item = {childBorderWidth_value, + sizeof(childBorderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = 10}, {.f32 = 20}, {.f32 = 30}, {.f32 = 40}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListItemBorderWidthTest::CreateNativeNodeUnifiedSettingsLowerBoundAbnormal(napi_env env, + napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childBorderWidth_item = {childBorderWidth_value, + sizeof(childBorderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemBorderWidthTest::CreateNativeNodeRespectivelySettingsLowerBoundAbnormal(napi_env env, + napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = -50}, {.f32 = -50}, {.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childBorderWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childBorderWidth_item = {childBorderWidth_value, + sizeof(childBorderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childBorderWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBorder_width_value[] = {{.f32 = -50}, {.f32 = -50}, {.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem childBorder_width_item = {childBorder_width_value, + sizeof(childBorder_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_WIDTH, &childBorder_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderwidth_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderwidth_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b3f82649c1d7da206a242142c639980b9814672d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_borderwidth_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_BORDERWIDTH_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_BORDERWIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemBorderWidthTest { +public: + ~ListItemBorderWidthTest(); + static napi_value CreateNativeNodeUnifiedSettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelySettings(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUnifiedSettingsLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRespectivelySettingsLowerBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_BORDERWIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_brightness_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_brightness_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2bf44259807df1224d2c6727646225d1f44d60c9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_brightness_test.cpp @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_brightness_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListItemBrightnessTest::CreateNativeNodeMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBrightness_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem childBrightness_item = {childBrightness_value, + sizeof(childBrightness_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BRIGHTNESS, &childBrightness_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemBrightnessTest::CreateNativeNodeMax(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBrightness_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem childBrightness_item = {childBrightness_value, + sizeof(childBrightness_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BRIGHTNESS, &childBrightness_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemBrightnessTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBrightness_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem childBrightness_item = {childBrightness_value, + sizeof(childBrightness_value) / sizeof(ArkUI_NumberValue)}; + int32_t ret = nodeAPI->setAttribute(listItem, NODE_BRIGHTNESS, &childBrightness_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "setAttribute", "ret is %{public}d", ret); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemBrightnessTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childBrightness_value[] = {{.f32 = 3}}; + ArkUI_AttributeItem childBrightness_item = {childBrightness_value, + sizeof(childBrightness_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BRIGHTNESS, &childBrightness_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_brightness_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_brightness_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c5d5672375ef807238b8f86b697c02a8916374ba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_brightness_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_BRIGHTNESS_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_BRIGHTNESS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemBrightnessTest { +public: + ~ListItemBrightnessTest(); + static napi_value CreateNativeNodeMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMax(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_BRIGHTNESS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ad45efdd4419363e8794a39fbfa575c5a7e9c983 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_clip_test.cpp @@ -0,0 +1,441 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_clip_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListItemClipTest::CreateNativeNodeCut(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "CreateNativeNodeCut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue clip_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem clip_item = {clip_value, sizeof(clip_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_CLIP, &clip_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_RADIUS, &border_radius_item); + + nodeAPI->addChild(listItem, column); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), listItem) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemClipTest::CreateNativeNodeUncut(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue clip_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem clip_item = {clip_value, sizeof(clip_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_CLIP, &clip_item); + + ArkUI_NumberValue border_radius_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BORDER_RADIUS, &border_radius_item); + + nodeAPI->addChild(listItem, column); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), listItem) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemClipTest::CreateNativeNodeRectangle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 400}, {.f32 = 300}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), listItem) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemClipTest::CreateNativeNodeCircle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 300}, {.f32 = 300}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), listItem) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemClipTest::CreateNativeNodeEllipse(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 400}, {.f32 = 300}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), listItem) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemClipTest::CreateNativeNodePath(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "CreateNativeNodeUncut"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clipShape_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 500}, {.f32 = 500}}; + ArkUI_AttributeItem clipShape_item = {clipShape_value, sizeof(clipShape_value) / sizeof(ArkUI_NumberValue)}; + clipShape_item.string = "M300 0 L500 500 L0 500 Z"; + nodeAPI->setAttribute(listItem, NODE_CLIP_SHAPE, &clipShape_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), listItem) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f692afdcc64b4d0d9cd06127f6a3afd69fc90fce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_clip_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_CLIP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemClipTest { +public: + ~ListItemClipTest(); + static napi_value CreateNativeNodeCut(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUncut(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRectangle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCircle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEllipse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodePath(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_edgeEffect_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_edgeEffect_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f2dace2572de2a4683d2b9881533fa51a786c8fe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_edgeEffect_test.cpp @@ -0,0 +1,566 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "listitem_edgeEffect_test.h" +#include + +namespace ArkUICApiDemo { +napi_value ListItemEdgeEffectTest::CreateNativeNodeSpring(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", "CreateNativeNodeSpring"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", "GetContext env or info is null"); + return nullptr; + } + + auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEdgeEffect_value[] = {{.i32 = ARKUI_EDGE_EFFECT_SPRING}, {.i32 = 1}}; + ArkUI_AttributeItem childEdgeEffect_value_item = {childEdgeEffect_value, + sizeof(childEdgeEffect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_EDGE_EFFECT, &childEdgeEffect_value_item); + + nodeAPI->addChild(listItem, column); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &listItemidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(listItem, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemEdgeEffectTest::CreateNativeNodeFade(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", "CreateNativeNodeFade"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", "GetContext env or info is null"); + return nullptr; + } + + auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEdgeEffect_value[] = {{.i32 = ARKUI_EDGE_EFFECT_FADE}, {.i32 = 1}}; + ArkUI_AttributeItem childEdgeEffect_value_item = {childEdgeEffect_value, + sizeof(childEdgeEffect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_EDGE_EFFECT, &childEdgeEffect_value_item); + + nodeAPI->addChild(listItem, column); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &listItemidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(listItem, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemEdgeEffectTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", "CreateNativeNodeNone"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", "GetContext env or info is null"); + return nullptr; + } + + auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEdgeEffect_value[] = {{.i32 = ARKUI_EDGE_EFFECT_NONE}, {.i32 = 0}}; + ArkUI_AttributeItem childEdgeEffect_value_item = {childEdgeEffect_value, + sizeof(childEdgeEffect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_EDGE_EFFECT, &childEdgeEffect_value_item); + + nodeAPI->addChild(listItem, column); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &listItemidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(listItem, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemEdgeEffectTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", "CreateNativeNodeLowerBoundAbnormal"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", "GetContext env or info is null"); + return nullptr; + } + + auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEdgeEffect_value[] = {{.i32 = -1}, {.i32 = 1}}; + ArkUI_AttributeItem childEdgeEffect_value_item = {childEdgeEffect_value, + sizeof(childEdgeEffect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_EDGE_EFFECT, &childEdgeEffect_value_item); + + nodeAPI->addChild(listItem, column); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &listItemidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(listItem, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemEdgeEffectTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", "CreateNativeNodeUpperBoundAbnormal"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + char listID[64] = {0}; + napi_get_value_string_utf8(env, args[1], listID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", "GetContext env or info is null"); + return nullptr; + } + + auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childScrollBar_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_AttributeItem childScrollBar_item = {childScrollBar_value, + sizeof(childScrollBar_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_DISPLAY_MODE, &childScrollBar_item); + + ArkUI_NumberValue childScrollBar_color_value[] = {{.u32 = 0XFF000000}}; + ArkUI_AttributeItem childScrollBar_color_item = {childScrollBar_color_value, + sizeof(childScrollBar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_COLOR, &childScrollBar_color_item); + + ArkUI_NumberValue childScrollBar_Width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem childScrollBar_Width_item = {childScrollBar_Width_value, + sizeof(childScrollBar_Width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_BAR_WIDTH, &childScrollBar_Width_item); + + ArkUI_NumberValue childEdgeEffect_value[] = {{.i32 = 10}, {.i32 = 1}}; + ArkUI_AttributeItem childEdgeEffect_value_item = {childEdgeEffect_value, + sizeof(childEdgeEffect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCROLL_EDGE_EFFECT, &childEdgeEffect_value_item); + + nodeAPI->addChild(listItem, column); + + ArkUI_NumberValue listItemWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemidth_item = {listItemWidth_value, + sizeof(listItemWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &listItemidth_item); + + ArkUI_NumberValue listItemHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem listItemHeight_item = {listItemHeight_value, + sizeof(listItemHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &listItemHeight_item); + + ArkUI_NumberValue listItemBackground_color_value[] = {{.u32 = 0XFF00FFFF}}; + ArkUI_AttributeItem listItemBackground_color_item = { + listItemBackground_color_value, sizeof(listItemBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &listItemBackground_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = listID; + nodeAPI->setAttribute(listItem, NODE_ID, &id_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_edgeEffect_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_edgeEffect_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bf156951784b8cc8d4c794db8f8a8e83e8aed43c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_edgeEffect_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_EDGEEFFECT_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_EDGEEFFECT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemEdgeEffectTest { + public: + ~ListItemEdgeEffectTest(); + static napi_value CreateNativeNodeSpring(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFade(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_EDGEEFFECT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0af2bc874dfe5e5627eb5689ffa3a23a1dabf00e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_height_test.cpp @@ -0,0 +1,292 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ListItemHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHeightTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListItemHeightTest::CreateNativeNodeBeyondParentComponent(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHeightTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 380}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 450}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListItemHeightTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHeightTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemHeightTest::CreateNativeNodeLowerBoundAbnormalContainsSubComponent(napi_env env, + napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(list, listItem); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(listItem, column); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9b746a28b44fe6dce8536c9357bf1e4ce21888f0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_height_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemHeightTest { +public: + ~ListItemHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBeyondParentComponent(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormalContainsSubComponent(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_hittestbehavior_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_hittestbehavior_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6ce679b78196d2282d8c036c97edd40d606f1945 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_hittestbehavior_test.cpp @@ -0,0 +1,374 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_hittestbehavior_test.h" +#include "../manager/plugin_manager.h" +#include + +#define LIST_ON_TOUCH_EVENT_ID 7001 +#define COLUMN_ON_TOUCH_EVENT_ID 7002 +#define LISTITEM_ON_TOUCH_EVENT_ID 7003 +using namespace std; + +namespace ArkUICApiDemo { + +void ListItemHitTestBehaviorTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + // 蓝色 + uint32_t background_color = 0xFF0000FF; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ListItemEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemEventOnClickTest", "OnEventReceive: event is null"); + return; + } + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsEnabledTest", "OnEventReceive eventId: %{public}d", + eventId); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == LISTITEM_ON_TOUCH_EVENT_ID) { + // 白色 + background_color = 0xFFFFFFFF; + } else if (eventId == COLUMN_ON_TOUCH_EVENT_ID) { + // 青色 + background_color = 0xFF00FFFF; + } + + // 如果是触摸事件 + if ((eventId == COLUMN_ON_TOUCH_EVENT_ID) || (eventId == LISTITEM_ON_TOUCH_EVENT_ID)) { + // 修改组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +ArkUI_NodeHandle ListItemHitTestBehaviorTest::CreateSubListItemNode(ArkUI_NativeNodeAPI_1 *node_api, + int32_t hittestbehavior, + const char *ontouchteststack) +{ + float stack_width = 400; + float stack_height = 400; + float list_width = 400; + float list_height = 300; + float listItem_width = 400; + float listItem_height = 250; + float column_width = 400; + float column_height = 200; + // 黄色 + uint32_t stack_background_color = 0xFFFFFF00; + // 红色 + uint32_t list_background_color = 0xFFFF0000; + // 绿色 + uint32_t column_background_color = 0xFF00FF00; + // 紫色 + uint32_t listItem_background_color = 0xFFFF11FF; + // 创建容器组件 + auto stack = node_api->createNode(ARKUI_NODE_STACK); + auto list = node_api->createNode(ARKUI_NODE_LIST); + auto listItem = node_api->createNode(ARKUI_NODE_LIST_ITEM); + auto column = node_api->createNode(ARKUI_NODE_COLUMN); + + // 设置容器ID + ArkUI_AttributeItem id_item = {}; + id_item.string = ontouchteststack; + node_api->setAttribute(stack, NODE_ID, &id_item); + + // 设置容器大小 + ArkUI_NumberValue stack_width_value[] = {{.f32 = stack_width}}; + ArkUI_AttributeItem stack_width_item = {stack_width_value, sizeof(stack_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &stack_width_item); + + ArkUI_NumberValue stack_height_value[] = {{.f32 = stack_height}}; + ArkUI_AttributeItem stack_height_item = {stack_height_value, + sizeof(stack_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &stack_height_item); + + // 设置容器组件背景色 + ArkUI_NumberValue stack_background_color_value[] = {{.u32 = stack_background_color}}; + ArkUI_AttributeItem stack_background_color_item = { + stack_background_color_value, sizeof(stack_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &stack_background_color_item); + // 设置column组件大小 + ArkUI_NumberValue column_width_value[] = {{.f32 = column_width}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(column, NODE_WIDTH, &column_width_item); + + ArkUI_NumberValue column_height_value[] = {{.f32 = column_height}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 设置column组件背景色 + ArkUI_NumberValue column_background_color_value[] = {{.u32 = column_background_color}}; + ArkUI_AttributeItem column_background_color_item = { + column_background_color_value, sizeof(column_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(column, NODE_BACKGROUND_COLOR, &column_background_color_item); + + node_api->registerNodeEvent(column, NODE_TOUCH_EVENT, COLUMN_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "IMAGE_BROTHER_ON_TOUCH_EVENT_ID", + "IMAGE_BROTHER_ON_TOUCH_EVENT_ID"); + + // 添加组件到容器 + node_api->addChild(listItem, column); + // 设置list组件大小 + ArkUI_NumberValue list_width_value[] = {{.f32 = list_width}}; + ArkUI_AttributeItem list_width_item = {list_width_value, sizeof(list_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(list, NODE_WIDTH, &list_width_item); + + ArkUI_NumberValue list_height_value[] = {{.f32 = list_height}}; + ArkUI_AttributeItem list_height_item = {list_height_value, sizeof(list_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(list, NODE_HEIGHT, &list_height_item); + + // 设置list组件背景色 + ArkUI_NumberValue list_background_color_value[] = {{.u32 = list_background_color}}; + ArkUI_AttributeItem list_background_color_item = {list_background_color_value, + sizeof(list_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(list, NODE_BACKGROUND_COLOR, &list_background_color_item); + + // 添加组件到容器 + node_api->addChild(stack, list); + + // 设置listItem组件大小 + ArkUI_NumberValue listItem_width_value[] = {{.f32 = listItem_width}}; + ArkUI_AttributeItem listItem_width_item = {listItem_width_value, + sizeof(listItem_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(listItem, NODE_WIDTH, &listItem_width_item); + + ArkUI_NumberValue listItem_height_value[] = {{.f32 = listItem_height}}; + ArkUI_AttributeItem listItem_height_item = {listItem_height_value, + sizeof(listItem_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(listItem, NODE_HEIGHT, &listItem_height_item); + + // 设置listItem组件背景色 + ArkUI_NumberValue listItem_background_color_value[] = {{.u32 = listItem_background_color}}; + ArkUI_AttributeItem listItem_background_color_item = { + listItem_background_color_value, sizeof(listItem_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(listItem, NODE_BACKGROUND_COLOR, &listItem_background_color_item); + + // 设置list组件触摸测试类型值 + ArkUI_NumberValue list_hittestbehavior_value[] = {{.i32 = hittestbehavior}}; + ArkUI_AttributeItem list_hittestbehavior_item = {list_hittestbehavior_value, + sizeof(list_hittestbehavior_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(listItem, NODE_HIT_TEST_BEHAVIOR, &list_hittestbehavior_item); + + node_api->registerNodeEvent(listItem, NODE_TOUCH_EVENT, LISTITEM_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "LISTITEM_ON_TOUCH_EVENT_ID", "IMAGE_BROTHER_ON_TOUCH_EVENT_ID"); + + // 添加组件到容器 + node_api->addChild(list, listItem); + return stack; +} + +napi_value ListItemHitTestBehaviorTest::CreateNativeNodeDefault(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hittestbehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_DEFAULT; + string ontouchtestStack = "OnTouchTestStackDefault"; + auto stack = CreateSubListItemNode(nodeAPI, hittestbehavior, ontouchtestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemHitTestBehaviorTest::CreateNativeNodeBlock(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hittestbehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_BLOCK; + string ontouchtestStack = "OnTouchTestStackBlock"; + auto stack = CreateSubListItemNode(nodeAPI, hittestbehavior, ontouchtestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +napi_value ListItemHitTestBehaviorTest::CreateNativeNodeTransparent(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hittestbehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_TRANSPARENT; + string ontouchtestStack = "OnTouchTestStackTransparent"; + auto stack = CreateSubListItemNode(nodeAPI, hittestbehavior, ontouchtestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemHitTestBehaviorTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hittestbehavior = ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_NONE; + string ontouchtestStack = "OnTouchTestStackNone"; + auto stack = CreateSubListItemNode(nodeAPI, hittestbehavior, ontouchtestStack.c_str()); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_hittestbehavior_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_hittestbehavior_test.h new file mode 100644 index 0000000000000000000000000000000000000000..203947d4107898ab4f409bce01d63ce92d89d1e2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_hittestbehavior_test.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_HITTESTBEHAVIOR_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_HITTESTBEHAVIOR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +using namespace std; + +namespace ArkUICApiDemo { + +class ListItemHitTestBehaviorTest { +public: + ~ListItemHitTestBehaviorTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubListItemNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t hittestbehavior, + const char *ontouchteststack); + static napi_value CreateNativeNodeDefault(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlock(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTransparent(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_HITTESTBEHAVIOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_lineargradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_lineargradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b70309df2cbc3564b8a0e7ca4c6945ac3cb60318 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_lineargradient_test.cpp @@ -0,0 +1,944 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_lineargradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include +namespace ArkUICApiDemo { +napi_value ListItemLinearGradientTest::CreateNativeNodeLeft(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_TOP}, {.i32 = true}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeRight(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeLeftTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeLeftBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeRightTop(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeRightBottom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_NONE}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeCustom(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = {{.f32 = 180}, {.i32 = -1}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemLinearGradientTest::CreateNativeNodeIllegalColorAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + unsigned int colors[] = {123, 1234}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue childLinearGradient_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT}, {.i32 = false}}; + ArkUI_AttributeItem childLinearGradient_item = {childLinearGradient_value, + sizeof(childLinearGradient_value) / sizeof(ArkUI_NumberValue)}; + childLinearGradient_item.object = &colorStop; + nodeAPI->setAttribute(listItem, NODE_LINEAR_GRADIENT, &childLinearGradient_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_lineargradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_lineargradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b892cbcfc16b8e40e954e517d70fe1f6e0f8df73 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_lineargradient_test.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_LINEARGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_LINEARGRADIENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemLinearGradientTest { +public: + ~ListItemLinearGradientTest(); + static napi_value CreateNativeNodeLeft(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRight(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLeftTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLeftBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRightTop(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRightBottom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCustom(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeIllegalColorAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_LINEARGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_opacity_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_opacity_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..10329abe6d40a09e51b0ad6fbdff6962823f4c5d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_opacity_test.cpp @@ -0,0 +1,375 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_opacity_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListItemOpacityTest::CreateNativeNodeMax(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childOpacity_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem childOpacity_item = {childOpacity_value, + sizeof(childOpacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_OPACITY, &childOpacity_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemOpacityTest::CreateNativeNodeMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childOpacity_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem childOpacity_item = {childOpacity_value, + sizeof(childOpacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_OPACITY, &childOpacity_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemOpacityTest::CreateNativeNodeMiddle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childOpacity_value[] = {{.f32 = 0.5}}; + ArkUI_AttributeItem childOpacity_item = {childOpacity_value, + sizeof(childOpacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_OPACITY, &childOpacity_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemOpacityTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childOpacity_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem childOpacity_item = {childOpacity_value, + sizeof(childOpacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_OPACITY, &childOpacity_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemOpacityTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childOpacity_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem childOpacity_item = {childOpacity_value, + sizeof(childOpacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_OPACITY, &childOpacity_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_opacity_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_opacity_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5065bb087b40863f1ad39fb0784028c9d1eb19a8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_opacity_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_OPACITY_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_OPACITY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemOpacityTest { +public: + ~ListItemOpacityTest(); + static napi_value CreateNativeNodeMax(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMiddle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_OPACITY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_rotate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_rotate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5a61d1f59c99d68ab644d5e44cb6a7ef0eb07cfd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_rotate_test.cpp @@ -0,0 +1,440 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_rotate_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListItemRotateTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = 100}, {.f32 = 100}, {.f32 = 100}, {.f32 = 90}, {.f32 = 100}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemRotateTest::CreateNativeNodeSetNegativeNumbers(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = -100}, {.f32 = -100}, {.f32 = -100}, {.f32 = -90}, {.f32 = -100}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemRotateTest::CreateNativeNodeDefaultValue(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemRotateTest::CreateNativeNodeSetXYZ(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = 100}, {.f32 = 100}, {.f32 = 100}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemRotateTest::CreateNativeNodeSetRotationAngle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 90}, {.f32 = 0}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemRotateTest::CreateNativeNodeSetSightDistance(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rotate_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &rotate_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childRotate_value[] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 100}}; + ArkUI_AttributeItem childRotate_item = {childRotate_value, sizeof(childRotate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_ROTATE, &childRotate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_rotate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_rotate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e15b5cac2c4da9c215a73b7b220e807ad6f206e2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_rotate_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_ROTATE_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_ROTATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemRotateTest { +public: + ~ListItemRotateTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetNegativeNumbers(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDefaultValue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetXYZ(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetRotationAngle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetSightDistance(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_ROTATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_saturate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_saturate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..75e17c346783627497d9dea8f740361e753b0a26 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_saturate_test.cpp @@ -0,0 +1,307 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_saturate_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { +napi_value ListItemSaturateTest::CreateNativeNodeMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childdWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childdWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childSaturate_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem childSaturate_item = {childSaturate_value, + sizeof(childSaturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SATURATION, &childSaturate_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemSaturateTest::CreateNativeNodeMax(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childdWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childdWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childSaturate_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem childSaturate_item = {childSaturate_value, + sizeof(childSaturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SATURATION, &childSaturate_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemSaturateTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childdWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childdWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childSaturate_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem childSaturate_item = {childSaturate_value, + sizeof(childSaturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SATURATION, &childSaturate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemSaturateTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childdWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childdWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childSaturate_value[] = {{.f32 = (50 + 1)}}; + ArkUI_AttributeItem childSaturate_item = {childSaturate_value, + sizeof(childSaturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SATURATION, &childSaturate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_saturate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_saturate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..89458eb5d101dac4123b6da03029f7fc707f032b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_saturate_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_SATURATE_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_SATURATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemSaturateTest { +public: + ~ListItemSaturateTest(); + static napi_value CreateNativeNodeMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMax(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_SATURATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_scale_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_scale_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..af3889be8c0c1a0dc667615038deb7aa2096e3ec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_scale_test.cpp @@ -0,0 +1,370 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_scale_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListItemScaleTest::CreateNativeNodeReduceXY(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 0.5}, {.f32 = 0.5}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemScaleTest::CreateNativeNodeReduceX(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 0.5}, {.f32 = 1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemScaleTest::CreateNativeNodeEnlargeXY(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 2}, {.f32 = 2}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemScaleTest::CreateNativeNodeEnlargeX(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = 2}, {.f32 = 1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemScaleTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childScale_value[] = {{.f32 = -1}, {.f32 = -1}}; + ArkUI_AttributeItem childScale_item = {childScale_value, sizeof(childScale_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SCALE, &childScale_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_scale_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_scale_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c873675b00e7ac004385772cd0d67a3dd639a930 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_scale_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_SCALE_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_SCALE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemScaleTest { +public: + ~ListItemScaleTest(); + static napi_value CreateNativeNodeReduceXY(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeReduceX(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnlargeXY(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnlargeX(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_SCALE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_shadow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_shadow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f2267880a4cf544be77a02f19cd52e34e61340c0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_shadow_test.cpp @@ -0,0 +1,595 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_shadow_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListItemShadowTest::CreateNativeNodeUltraSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemShadowTest::CreateNativeNodeSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SHADOW, &childShadow_item); + + ArkUI_NumberValue childCustomShadow_value[] = { + {.f32 = 50}, {.i32 = 1}, {.f32 = 50}, {.f32 = 50}, {.i32 = ARKUI_SHADOW_TYPE_COLOR}, + {.u32 = 0xFFFFFF00}, {.u32 = 1}}; + ArkUI_AttributeItem childCustomShadow_item = {childCustomShadow_value, + sizeof(childCustomShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_CUSTOM_SHADOW, &childCustomShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemShadowTest::CreateNativeNodeMiddleShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemShadowTest::CreateNativeNodeLargeShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemShadowTest::CreateNativeNodeFloatingShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemShadowTest::CreateNativeNodeFloatingSmallShadow(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemShadowTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemShadowTest::CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childShadow_value[] = {{.i32 = 7}}; + ArkUI_AttributeItem childShadow_item = {childShadow_value, sizeof(childShadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_SHADOW, &childShadow_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_shadow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_shadow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cb18b09d4d1f6acbc30fe88ddba59d994a0cff27 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_shadow_test.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_SHADOW_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_SHADOW_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemShadowTest { +public: + ~ListItemShadowTest(); + static napi_value CreateNativeNodeUltraSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMiddleShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLargeShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFloatingShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFloatingSmallShadow(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperBoundAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_SHADOW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_translate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_translate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c2b2df76e2efe510d03c0657da12f33918ae249c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_translate_test.cpp @@ -0,0 +1,449 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_translate_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListItemTranslateTest::CreateNativeNodeSetXYZ(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_TRANSLATE, &childTranslate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemTranslateTest::CreateNativeNodeSetX(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = 50}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_TRANSLATE, &childTranslate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemTranslateTest::CreateNativeNodeSetXMinus(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = -50}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + int32_t ret = nodeAPI->setAttribute(listItem, NODE_TRANSLATE, &childTranslate_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "setAttribute", "ret is %{public}d", ret); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemTranslateTest::CreateNativeNodeSetXYZMinus(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = -50}, {.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_TRANSLATE, &childTranslate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemTranslateTest::CreateNativeNodeUnifiedAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_TRANSLATE, &childTranslate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemTranslateTest::CreateNativeNodeUnifiedMinusAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + + ArkUI_NumberValue childTranslate_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem childTranslate_item = {childTranslate_value, + sizeof(childTranslate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_TRANSLATE, &childTranslate_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_translate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_translate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7e8802c90048711a1159d1e0287e1496d4943803 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_translate_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_TRANSLATE_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_TRANSLATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemTranslateTest { +public: + ~ListItemTranslateTest(); + static napi_value CreateNativeNodeSetXYZ(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetX(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetXMinus(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSetXYZMinus(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUnifiedAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUnifiedMinusAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_TRANSLATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..987bf265101e33fec50cdae1371d59a6793086ad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_width_test.cpp @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "listitem_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +napi_value ListItemWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemWidthTest::CreateNativeNodeBeyondParentComponent(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = 450}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemWidthTest::CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(list, listItem); + + ArkUI_NumberValue childWidth_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ListItemWidthTest::CreateNativeNodeLowerBoundAbnormalContainsSubComponent(napi_env env, + napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto list = nodeAPI->createNode(ARKUI_NODE_LIST); + auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM); + + ArkUI_NumberValue fatherWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem fatherWidth_item = {fatherWidth_value, sizeof(fatherWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_WIDTH, &fatherWidth_item); + + ArkUI_NumberValue fatherHeight_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem fatherHeight_item = {fatherHeight_value, + sizeof(fatherHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_HEIGHT, &fatherHeight_item); + + ArkUI_NumberValue fatherBackground_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem fatherBackground_color_item = { + fatherBackground_color_value, sizeof(fatherBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(list, NODE_BACKGROUND_COLOR, &fatherBackground_color_item); + + nodeAPI->addChild(list, listItem); + ArkUI_NumberValue width_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(listItem, column); + ArkUI_NumberValue childWidth_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem childWidth_item = {childWidth_value, sizeof(childWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &childWidth_item); + + ArkUI_NumberValue childHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem childHeight_item = {childHeight_value, sizeof(childHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &childHeight_item); + + ArkUI_NumberValue childBackground_color_value[] = {{.u32 = 0xFF00FFFF}}; + ArkUI_AttributeItem childBackground_color_item = {childBackground_color_value, + sizeof(childBackground_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &childBackground_color_item); + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), list) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ListItemWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..61b7ad3b6d267edde3b3bfc05df3cad049b7c3d6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/listitem/listitem_width_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LISTITEM_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_LISTITEM_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ListItemWidthTest { +public: + ~ListItemWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBeyondParentComponent(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerBoundAbnormalContainsSubComponent(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LISTITEM_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_color_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_color_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e0d29423a2ef8ec6b90e486e83a4601615d4cd39 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_color_test.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "loadingprogress_color_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle loadingProgress; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + loadingProgress = nodeAPI->createNode(ARKUI_NODE_LOADING_PROGRESS); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(loadingProgress, NODE_HEIGHT, &height_item); +} + +napi_value LoadingProgressColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_LOADING_PROGRESS_COLOR, &color_item); + + // 挂载组件 + std::string idLoadingProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idLoadingProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value LoadingProgressColorTest::CreateNativeNodeBlack(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_LOADING_PROGRESS_COLOR, &color_item); + + // 挂载组件 + std::string idLoadingProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idLoadingProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value LoadingProgressColorTest::CreateNativeNodeWhite(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_LOADING_PROGRESS_COLOR, &color_item); + + // 挂载组件 + std::string idLoadingProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idLoadingProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_color_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_color_test.h new file mode 100644 index 0000000000000000000000000000000000000000..dac0405c815039e4cdc1e2a0bfb169f4f66f8b15 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_color_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LOADINGPROGRESS_COLOR_TEST_H +#define ARKUI_CAPI_DEMO_LOADINGPROGRESS_COLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class LoadingProgressColorTest { +public: + ~LoadingProgressColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlack(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeWhite(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LOADINGPROGRESS_COLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_enableloading_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_enableloading_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c3ba47b4581e6e87f217954dd0f7d38e3d3472db --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_enableloading_test.cpp @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "loadingprogress_enableloading_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle loadingProgress; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + loadingProgress = nodeAPI->createNode(ARKUI_NODE_LOADING_PROGRESS); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(loadingProgress, NODE_HEIGHT, &height_item); +} + +napi_value LoadingProgressEnableLoadingTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_LOADING_PROGRESS_COLOR, &color_item); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue value[] = {{.i32 = true}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_LOADING_PROGRESS_ENABLE_LOADING, &item); + + // 挂载组件 + std::string idLoadingProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idLoadingProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value LoadingProgressEnableLoadingTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_LOADING_PROGRESS_COLOR, &color_item); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue value[] = {{.i32 = false}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_LOADING_PROGRESS_ENABLE_LOADING, &item); + + // 挂载组件 + std::string idLoadingProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idLoadingProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_enableloading_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_enableloading_test.h new file mode 100644 index 0000000000000000000000000000000000000000..72411c5b9ce3086899bbc4039efed6e28032c72d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/loadingprogress/loadingprogress_enableloading_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_LOADINGPROGRESS_ENABLELOADING_TEST_H +#define ARKUI_CAPI_DEMO_LOADINGPROGRESS_ENABLELOADING_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class LoadingProgressEnableLoadingTest { +public: + ~LoadingProgressEnableLoadingTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_LOADINGPROGRESS_ENABLELOADING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/manager/plugin_manager.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/manager/plugin_manager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..10571a39609faa09c46f5fe5210122a521147592 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/manager/plugin_manager.cpp @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "plugin_manager.h" +#include "./common/common.h" + +#include +#include + +#include + +namespace ArkUICApiDemo { +PluginManager PluginManager::pluginManager_; + +PluginManager::~PluginManager() +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Callback", "~PluginManager"); + for (auto iter = nativeXComponentMap_.begin(); iter != nativeXComponentMap_.end(); ++iter) { + if (iter->second != nullptr) { + delete iter->second; + iter->second = nullptr; + } + } + nativeXComponentMap_.clear(); +} + +napi_value PluginManager::GetContext(napi_env env, napi_callback_info info) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "PluginManager", "GetContext env or info is null"); + return nullptr; + } + + size_t argCnt = 1; + napi_value args[1] = {nullptr}; + if (napi_get_cb_info(env, info, &argCnt, args, nullptr, nullptr) != napi_ok) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "PluginManager", "GetContext napi_get_cb_info failed"); + } + + if (argCnt != 1) { + napi_throw_type_error(env, NULL, "Wrong number of arguments"); + return nullptr; + } + + napi_valuetype valuetype; + if (napi_typeof(env, args[0], &valuetype) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_typeof failed"); + return nullptr; + } + + if (valuetype != napi_number) { + napi_throw_type_error(env, NULL, "Wrong type of arguments"); + return nullptr; + } + + int64_t value; + if (napi_get_value_int64(env, args[0], &value) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_get_value_int64 failed"); + return nullptr; + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +void PluginManager::Export(napi_env env, napi_value exports) +{ + if ((env == nullptr) || (exports == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "PluginManager", "Export: env or exports is null"); + return; + } + + napi_value exportInstance = nullptr; + if (napi_get_named_property(env, exports, OH_NATIVE_XCOMPONENT_OBJ, &exportInstance) != napi_ok) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "PluginManager", "Export: napi_get_named_property fail"); + return; + } + + OH_NativeXComponent *nativeXComponent = nullptr; + if (napi_unwrap(env, exportInstance, reinterpret_cast(&nativeXComponent)) != napi_ok) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "PluginManager", "Export: napi_unwrap fail"); + return; + } + + char idStr[OH_XCOMPONENT_ID_LEN_MAX + 1] = {'\0'}; + uint64_t idSize = OH_XCOMPONENT_ID_LEN_MAX + 1; + if (OH_NativeXComponent_GetXComponentId(nativeXComponent, idStr, &idSize) != OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "PluginManager", + "Export: OH_NativeXComponent_GetXComponentId fail"); + return; + } + + std::string id(idStr); + auto context = PluginManager::GetInstance(); + if ((context != nullptr) && (nativeXComponent != nullptr)) { + context->SetNativeXComponent(id, nativeXComponent); + } +} + +void PluginManager::SetNativeXComponent(std::string &id, OH_NativeXComponent *nativeXComponent) +{ + if (nativeXComponent == nullptr) { + return; + } + + if (nativeXComponentMap_.find(id) == nativeXComponentMap_.end()) { + nativeXComponentMap_[id] = nativeXComponent; + return; + } + + if (nativeXComponentMap_[id] != nativeXComponent) { + OH_NativeXComponent *tmp = nativeXComponentMap_[id]; + delete tmp; + tmp = nullptr; + nativeXComponentMap_[id] = nativeXComponent; + } +} + +OH_NativeXComponent *PluginManager::GetNativeXComponent(std::string &id) +{ + if (nativeXComponentMap_.find(id) == nativeXComponentMap_.end()) { + return nullptr; + } + return nativeXComponentMap_[id]; +} +} // namespace ArkUICApiDemo diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/manager/plugin_manager.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/manager/plugin_manager.h new file mode 100644 index 0000000000000000000000000000000000000000..6fba54a3a8a1b87dec94dbaf621e8ae79b0f0767 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/manager/plugin_manager.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ +#ifndef NATIVE_XCOMPONENT_PLUGIN_MANAGER_H +#define NATIVE_XCOMPONENT_PLUGIN_MANAGER_H + +#include +#include +#include +#include +#include + +namespace ArkUICApiDemo { +class PluginManager { +public: + ~PluginManager(); + + static PluginManager *GetInstance() { return &PluginManager::pluginManager_; } + + static napi_value GetContext(napi_env env, napi_callback_info info); + + void SetNativeXComponent(std::string &id, OH_NativeXComponent *nativeXComponent); + OH_NativeXComponent *GetNativeXComponent(std::string &id); + void Export(napi_env env, napi_value exports); + +private: + static PluginManager pluginManager_; + + std::unordered_map nativeXComponentMap_; +}; +} // namespace ArkUICApiDemo +#endif // NATIVE_XCOMPONENT_PLUGIN_MANAGER_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/napi_init.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/napi_init.cpp new file mode 100644 index 0000000000000000000000000000000000000000..87a715590c33fe7993ced62329981fc373820ee3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/napi_init.cpp @@ -0,0 +1,2967 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "accessibility/button_accessibilitydescription_test.h" +#include "accessibility/button_accessibilitygroup_test.h" +#include "accessibility/button_accessibilitylevel_test.h" +#include "accessibility/button_accessibilitytext_test.h" +#include "accessibility/checkbox_accessibilitydescription_test.h" +#include "accessibility/checkbox_accessibilitygroup_test.h" +#include "accessibility/checkbox_accessibilitylevel_test.h" +#include "accessibility/checkbox_accessibilitytext_test.h" +#include "accessibility/datepicker_accessibilitydescription_test.h" +#include "accessibility/datepicker_accessibilitygroup_test.h" +#include "accessibility/datepicker_accessibilitylevel_test.h" +#include "accessibility/datepicker_accessibilitytext_test.h" +#include "accessibility/list_accessibilitydescription_test.h" +#include "accessibility/list_accessibilitygroup_test.h" +#include "accessibility/list_accessibilitylevel_test.h" +#include "accessibility/list_accessibilitytext_test.h" +#include "accessibility/progress_accessibilitydescription_test.h" +#include "accessibility/progress_accessibilitygroup_test.h" +#include "accessibility/progress_accessibilitylevel_test.h" +#include "accessibility/progress_accessibilitytext_test.h" +#include "accessibility/refresh_accessibilitydescription_test.h" +#include "accessibility/refresh_accessibilitygroup_test.h" +#include "accessibility/refresh_accessibilitylevel_test.h" +#include "accessibility/refresh_accessibilitytext_test.h" +#include "accessibility/scroll_accessibilitydescription_test.h" +#include "accessibility/scroll_accessibilitygroup_test.h" +#include "accessibility/scroll_accessibilitylevel_test.h" +#include "accessibility/scroll_accessibilitytext_test.h" +#include "accessibility/slider_accessibilitydescription_test.h" +#include "accessibility/slider_accessibilitygroup_test.h" +#include "accessibility/slider_accessibilitylevel_test.h" +#include "accessibility/slider_accessibilitytext_test.h" +#include "accessibility/swiper_accessibilitydescription_test.h" +#include "accessibility/swiper_accessibilitygroup_test.h" +#include "accessibility/swiper_accessibilitylevel_test.h" +#include "accessibility/swiper_accessibilitytext_test.h" +#include "accessibility/text_accessibilitydescription_test.h" +#include "accessibility/text_accessibilitygroup_test.h" +#include "accessibility/text_accessibilitylevel_test.h" +#include "accessibility/text_accessibilitytext_test.h" +#include "accessibility/textarea_accessibilitydescription_test.h" +#include "accessibility/textarea_accessibilitygroup_test.h" +#include "accessibility/textarea_accessibilitylevel_test.h" +#include "accessibility/textarea_accessibilitytext_test.h" +#include "accessibility/textinput_accessibilitydescription_test.h" +#include "accessibility/textinput_accessibilitygroup_test.h" +#include "accessibility/textinput_accessibilitylevel_test.h" +#include "accessibility/textinput_accessibilitytext_test.h" +#include "accessibility/textpicker_accessibilitydescription_test.h" +#include "accessibility/textpicker_accessibilitygroup_test.h" +#include "accessibility/textpicker_accessibilitylevel_test.h" +#include "accessibility/textpicker_accessibilitytext_test.h" +#include "accessibility/timepicker_accessibilitydescription_test.h" +#include "accessibility/timepicker_accessibilitygroup_test.h" +#include "accessibility/timepicker_accessibilitylevel_test.h" +#include "accessibility/timepicker_accessibilitytext_test.h" +#include "accessibility/toggle_accessibilitydescription_test.h" +#include "accessibility/toggle_accessibilitygroup_test.h" +#include "accessibility/toggle_accessibilitylevel_test.h" +#include "accessibility/toggle_accessibilitytext_test.h" +#include "button/button_backgroundcolor_test.h" +#include "button/button_fontcolor_test.h" +#include "button/button_fontsize_test.h" +#include "button/button_fontweight_test.h" +#include "button/button_onclick_test.h" +#include "calendarpicker/calendarpicker_edgealign_test.h" +#include "calendarpicker/calendarpicker_enabled_test.h" +#include "calendarpicker/calendarpicker_onchange_test.h" +#include "calendarpicker/calendarpicker_textstyle_test.h" +#include "calendarpicker/calendarpicker_width_test.h" +#include "checkbox/checkbox_enabled_test.h" +#include "checkbox/checkbox_height_test.h" +#include "checkbox/checkbox_mark_test.h" +#include "checkbox/checkbox_onchange_test.h" +#include "checkbox/checkbox_select_test.h" +#include "checkbox/checkbox_selectedcolor_test.h" +#include "checkbox/checkbox_shape_test.h" +#include "checkbox/checkbox_unselectedcolor_test.h" +#include "checkbox/checkbox_width_test.h" +#include "column/column_foregroundblurstyle_test.h" +#include "column/column_height_test.h" +#include "column/column_padding_test.h" +#include "column/column_width_test.h" +#include "common/common.h" +#include "commonattrs/commonattrs_align_test.h" +#include "commonattrs/commonattrs_aligncontent_test.h" +#include "commonattrs/commonattrs_alignitems_test.h" +#include "commonattrs/commonattrs_alignself_test.h" +#include "commonattrs/commonattrs_backgroundcolor_test.h" +#include "commonattrs/commonattrs_blendmode_test.h" +#include "commonattrs/commonattrs_bordercolor_test.h" +#include "commonattrs/commonattrs_borderradius_test.h" +#include "commonattrs/commonattrs_borderstyle_test.h" +#include "commonattrs/commonattrs_borderwidth_test.h" +#include "commonattrs/commonattrs_clip_test.h" +#include "commonattrs/commonattrs_constraintsize_test.h" +#include "commonattrs/commonattrs_contrast_test.h" +#include "commonattrs/commonattrs_direction_test.h" +#include "commonattrs/commonattrs_enabled_test.h" +#include "commonattrs/commonattrs_flexbasis_test.h" +#include "commonattrs/commonattrs_flexgrow_test.h" +#include "commonattrs/commonattrs_flexshrink_test.h" +#include "commonattrs/commonattrs_focusable_test.h" +#include "commonattrs/commonattrs_foregroundblurstyle_test.h" +#include "commonattrs/commonattrs_grayscale_test.h" +#include "commonattrs/commonattrs_height_test.h" +#include "commonattrs/commonattrs_hittestbehavior_test.h" +#include "commonattrs/commonattrs_id_test.h" +#include "commonattrs/commonattrs_invert_test.h" +#include "commonattrs/commonattrs_justifycontent_test.h" +#include "commonattrs/commonattrs_lineargradient_test.h" +#include "commonattrs/commonattrs_margin_test.h" +#include "commonattrs/commonattrs_mask_test.h" +#include "commonattrs/commonattrs_opacity_test.h" +#include "commonattrs/commonattrs_position_test.h" +#include "commonattrs/commonattrs_radialgradient_test.h" +#include "commonattrs/commonattrs_scale_test.h" +#include "commonattrs/commonattrs_sepia_test.h" +#include "commonattrs/commonattrs_shadow_test.h" +#include "commonattrs/commonattrs_sweepgradient_test.h" +#include "commonattrs/commonattrs_transform_test.h" +#include "commonattrs/commonattrs_width_test.h" +#include "commonevent/commonevent_onappear_test.h" +#include "commonevent/commonevent_onareachange_test.h" +#include "commonevent/commonevent_onblur_test.h" +#include "commonevent/commonevent_onclick_test.h" +#include "commonevent/commonevent_onfocus_test.h" +#include "commonevent/commonevent_ontouch_test.h" +#include "customcomponent/customcomponent_accessibilitydescription_test.h" +#include "customcomponent/customcomponent_accessibilitygroup_test.h" +#include "customcomponent/customcomponent_accessibilitylevel_test.h" +#include "customcomponent/customcomponent_accessibilitytext_test.h" +#include "customcomponent/customcomponent_align_test.h" +#include "customcomponent/customcomponent_alignself_test.h" +#include "customcomponent/customcomponent_backgroundcolor_test.h" +#include "customcomponent/customcomponent_blendmode_test.h" +#include "customcomponent/customcomponent_bordercolor_test.h" +#include "customcomponent/customcomponent_borderradius_test.h" +#include "customcomponent/customcomponent_borderstyle_test.h" +#include "customcomponent/customcomponent_borderwidth_test.h" +#include "customcomponent/customcomponent_clip_test.h" +#include "customcomponent/customcomponent_constraintsize_test.h" +#include "customcomponent/customcomponent_contrast_test.h" +#include "customcomponent/customcomponent_direction_test.h" +#include "customcomponent/customcomponent_enabled_test.h" +#include "customcomponent/customcomponent_flexbasis_test.h" +#include "customcomponent/customcomponent_flexgrow_test.h" +#include "customcomponent/customcomponent_flexshrink_test.h" +#include "customcomponent/customcomponent_focusable_test.h" +#include "customcomponent/customcomponent_foregroundblurstyle_test.h" +#include "customcomponent/customcomponent_grayscale_test.h" +#include "customcomponent/customcomponent_height_test.h" +#include "customcomponent/customcomponent_hittestbehavior_test.h" +#include "customcomponent/customcomponent_id_test.h" +#include "customcomponent/customcomponent_invert_test.h" +#include "customcomponent/customcomponent_lineargradient_test.h" +#include "customcomponent/customcomponent_margin_test.h" +#include "customcomponent/customcomponent_mask_test.h" +#include "customcomponent/customcomponent_onappear_test.h" +#include "customcomponent/customcomponent_onareachange_test.h" +#include "customcomponent/customcomponent_onblur_test.h" +#include "customcomponent/customcomponent_onclick_test.h" +#include "customcomponent/customcomponent_ondraw_test.h" +#include "customcomponent/customcomponent_onfocus_test.h" +#include "customcomponent/customcomponent_onlayout_test.h" +#include "customcomponent/customcomponent_onmeasure_test.h" +#include "customcomponent/customcomponent_ontouch_test.h" +#include "customcomponent/customcomponent_opacity_test.h" +#include "customcomponent/customcomponent_position_test.h" +#include "customcomponent/customcomponent_radialgradient_test.h" +#include "customcomponent/customcomponent_scale_test.h" +#include "customcomponent/customcomponent_sepia_test.h" +#include "customcomponent/customcomponent_shadow_test.h" +#include "customcomponent/customcomponent_sweepgradient_test.h" +#include "customcomponent/customcomponent_transform_test.h" +#include "customcomponent/customcomponent_width_test.h" +#include "customdialog/customdialog_alignment_test.h" +#include "customdialog/customdialog_close_test.h" +#include "customdialog/customdialog_customstyle_test.h" +#include "customdialog/customdialog_maskColor_test.h" +#include "customdialog/customdialog_open_test.h" +#include "datepicker/datepicker_disappeartextstyle_test.h" +#include "datepicker/datepicker_enabled_test.h" +#include "datepicker/datepicker_end_test.h" +#include "datepicker/datepicker_lunar_test.h" +#include "datepicker/datepicker_ondatechange_test.h" +#include "datepicker/datepicker_selected_test.h" +#include "datepicker/datepicker_selectedtextstyle_test.h" +#include "datepicker/datepicker_start_test.h" +#include "datepicker/datepicker_textstyle_test.h" +#include "datepicker/datepicker_width_test.h" +#include "flex/flex_height_test.h" +#include "flex/flex_width_test.h" +#include "image/image_alt_test.h" +#include "image/image_autoresize_test.h" +#include "image/image_backgroundcolor_test.h" +#include "image/image_blur_test.h" +#include "image/image_bordercolor_test.h" +#include "image/image_borderradius_test.h" +#include "image/image_borderstyle_test.h" +#include "image/image_borderwidth_test.h" +#include "image/image_brightness_test.h" +#include "image/image_clip_test.h" +#include "image/image_colorfilter_test.h" +#include "image/image_height_test.h" +#include "image/image_hittestbehavior_test.h" +#include "image/image_id_test.h" +#include "image/image_interpolation_test.h" +#include "image/image_lineargradient_test.h" +#include "image/image_objectfit_test.h" +#include "image/image_objectrepeat_test.h" +#include "image/image_oncomplete_test.h" +#include "image/image_onerror_test.h" +#include "image/image_opacity_test.h" +#include "image/image_position_test.h" +#include "image/image_radialgradient_test.h" +#include "image/image_rotate_test.h" +#include "image/image_saturate_test.h" +#include "image/image_scale_test.h" +#include "image/image_shadow_test.h" +#include "image/image_src_test.h" +#include "image/image_sweepgradient_test.h" +#include "image/image_transform_test.h" +#include "image/image_translate_test.h" +#include "image/image_width_test.h" +#include "imagespan/imagespan_height_test.h" +#include "imagespan/imagespan_objectfit_test.h" +#include "imagespan/imagespan_padding_test.h" +#include "imagespan/imagespan_verticalalign_test.h" +#include "imagespan/imagespan_width_test.h" +#include "list/list_backgroundcolor_test.h" +#include "list/list_blur_test.h" +#include "list/list_bordercolor_test.h" +#include "list/list_borderradius_test.h" +#include "list/list_borderwidth_test.h" +#include "list/list_brightness_test.h" +#include "list/list_cachedcount_test.h" +#include "list/list_clip_test.h" +#include "list/list_edgeEffect_test.h" +#include "list/list_enablescrollinteraction_test.h" +#include "list/list_friction_test.h" +#include "list/list_height_test.h" +#include "list/list_hittestbehavior_test.h" +#include "list/list_lineargradient_test.h" +#include "list/list_listdirection_test.h" +#include "list/list_opacity_test.h" +#include "list/list_rotate_test.h" +#include "list/list_saturate_test.h" +#include "list/list_scale_test.h" +#include "list/list_scrollbar_test.h" +#include "list/list_shadow_test.h" +#include "list/list_sticky_test.h" +#include "list/list_translate_test.h" +#include "list/list_width_test.h" +#include "listitem/listitem_backgroundcolor_test.h" +#include "listitem/listitem_blur_test.h" +#include "listitem/listitem_bordercolor_test.h" +#include "listitem/listitem_borderradius_test.h" +#include "listitem/listitem_borderwidth_test.h" +#include "listitem/listitem_brightness_test.h" +#include "listitem/listitem_clip_test.h" +#include "listitem/listitem_edgeEffect_test.h" +#include "listitem/listitem_height_test.h" +#include "listitem/listitem_hittestbehavior_test.h" +#include "listitem/listitem_lineargradient_test.h" +#include "listitem/listitem_opacity_test.h" +#include "listitem/listitem_rotate_test.h" +#include "listitem/listitem_saturate_test.h" +#include "listitem/listitem_scale_test.h" +#include "listitem/listitem_shadow_test.h" +#include "listitem/listitem_translate_test.h" +#include "listitem/listitem_width_test.h" +#include "loadingprogress/loadingprogress_color_test.h" +#include "loadingprogress/loadingprogress_enableloading_test.h" +#include "manager/plugin_manager.h" +#include "progress/progress_backgroundcolor_test.h" +#include "progress/progress_color_test.h" +#include "progress/progress_style_test.h" +#include "refresh/refresh_onrefreshing_test.h" +#include "refresh/refresh_onstatechange_test.h" +#include "row/row_height_test.h" +#include "scroll/scroll_backgroundcolor_test.h" +#include "scroll/scroll_blur_test.h" +#include "scroll/scroll_bordercolor_test.h" +#include "scroll/scroll_borderradius_test.h" +#include "scroll/scroll_borderwidth_test.h" +#include "scroll/scroll_brightness_test.h" +#include "scroll/scroll_clip_test.h" +#include "scroll/scroll_currentoffset_test.h" +#include "scroll/scroll_edgeeffect_test.h" +#include "scroll/scroll_enablescrollinteraction_test.h" +#include "scroll/scroll_friction_test.h" +#include "scroll/scroll_height_test.h" +#include "scroll/scroll_hittestbehavior_test.h" +#include "scroll/scroll_lineargradient_test.h" +#include "scroll/scroll_nestedscroll_test.h" +#include "scroll/scroll_onappear_test.h" +#include "scroll/scroll_onscroll_test.h" +#include "scroll/scroll_onscrolledge_test.h" +#include "scroll/scroll_onscrollframebegin_test.h" +#include "scroll/scroll_onscrollstart_test.h" +#include "scroll/scroll_onscrollstop_test.h" +#include "scroll/scroll_opacity_test.h" +#include "scroll/scroll_overlay_test.h" +#include "scroll/scroll_pageenable_test.h" +#include "scroll/scroll_position_test.h" +#include "scroll/scroll_rotate_test.h" +#include "scroll/scroll_saturate_test.h" +#include "scroll/scroll_scale_test.h" +#include "scroll/scroll_scrollable_test.h" +#include "scroll/scroll_scrollbar_test.h" +#include "scroll/scroll_scrollbarcolor_test.h" +#include "scroll/scroll_scrolledge_test.h" +#include "scroll/scroll_scrollsnap_test.h" +#include "scroll/scroll_scrollto_test.h" +#include "scroll/scroll_shadow_test.h" +#include "scroll/scroll_translate_test.h" +#include "scroll/scroll_width_test.h" +#include "slider/slider_blockcolor_test.h" +#include "slider/slider_blockstyle_test.h" +#include "slider/slider_direction_test.h" +#include "slider/slider_enabled_test.h" +#include "slider/slider_height_test.h" +#include "slider/slider_max_test.h" +#include "slider/slider_min_test.h" +#include "slider/slider_onchange_test.h" +#include "slider/slider_reverse_test.h" +#include "slider/slider_selectedcolor_test.h" +#include "slider/slider_showsteps_test.h" +#include "slider/slider_step_test.h" +#include "slider/slider_style_test.h" +#include "slider/slider_trackcolor_test.h" +#include "slider/slider_value_test.h" +#include "slider/slider_width_test.h" +#include "span/span_decoration_test.h" +#include "span/span_fontcolor_test.h" +#include "span/span_fontsize_test.h" +#include "span/span_fontstyle_test.h" +#include "span/span_fontweight_test.h" +#include "span/span_letterspacing_test.h" +#include "span/span_lineheight_test.h" +#include "span/span_textcase_test.h" +#include "stack/stack_align_test.h" +#include "stack/stack_backgroundblurstyle_test.h" +#include "stack/stack_backgroundcolor_test.h" +#include "stack/stack_backgroundimage_test.h" +#include "stack/stack_backgroundimageposition_test.h" +#include "stack/stack_backgroundimagesize_test.h" +#include "stack/stack_bordercolor_test.h" +#include "stack/stack_borderradius_test.h" +#include "stack/stack_borderstyle_test.h" +#include "stack/stack_borderwidth_test.h" +#include "stack/stack_brightness_test.h" +#include "stack/stack_clip_test.h" +#include "stack/stack_height_test.h" +#include "stack/stack_hittestbehavior_test.h" +#include "stack/stack_id_test.h" +#include "stack/stack_lineargradient_test.h" +#include "stack/stack_margin_test.h" +#include "stack/stack_onareachange_test.h" +#include "stack/stack_ontouch_test.h" +#include "stack/stack_opacity_test.h" +#include "stack/stack_position_test.h" +#include "stack/stack_rotate_test.h" +#include "stack/stack_saturate_test.h" +#include "stack/stack_scale_test.h" +#include "stack/stack_shadow_test.h" +#include "stack/stack_transform_test.h" +#include "stack/stack_transition_test.h" +#include "stack/stack_translate_test.h" +#include "stack/stack_width_test.h" +#include "swiper/swiper_autoplay_test.h" +#include "swiper/swiper_backgroundcolor_test.h" +#include "swiper/swiper_backgroundimage_test.h" +#include "swiper/swiper_cachedcount_test.h" +#include "swiper/swiper_clip_test.h" +#include "swiper/swiper_curve_test.h" +#include "swiper/swiper_disableswipe_test.h" +#include "swiper/swiper_displayarrow_test.h" +#include "swiper/swiper_displaycount_test.h" +#include "swiper/swiper_duration_test.h" +#include "swiper/swiper_height_test.h" +#include "swiper/swiper_index_test.h" +#include "swiper/swiper_indicator_test.h" +#include "swiper/swiper_interval_test.h" +#include "swiper/swiper_itemspace_test.h" +#include "swiper/swiper_loop_test.h" +#include "swiper/swiper_position_test.h" +#include "swiper/swiper_vertical_test.h" +#include "swiper/swiper_width_test.h" +#include "text/text_align_test.h" +#include "text/text_alignrules_test.h" +#include "text/text_backgroundcolor_test.h" +#include "text/text_backgroundimage_test.h" +#include "text/text_baselineoffset_test.h" +#include "text/text_bordercolor_test.h" +#include "text/text_borderradius_test.h" +#include "text/text_borderwidth_test.h" +#include "text/text_clip_test.h" +#include "text/text_copyoption_test.h" +#include "text/text_decoration_test.h" +#include "text/text_enabled_test.h" +#include "text/text_font_test.h" +#include "text/text_fontcolor_test.h" +#include "text/text_fontfamily_test.h" +#include "text/text_fontsize_test.h" +#include "text/text_fontstyle_test.h" +#include "text/text_fontweight_test.h" +#include "text/text_height_test.h" +#include "text/text_heightadaptivepolicy_test.h" +#include "text/text_letterspacing_test.h" +#include "text/text_lineargradient_test.h" +#include "text/text_linebreakstrategy_test.h" +#include "text/text_lineheight_test.h" +#include "text/text_mask_test.h" +#include "text/text_maxfontsize_test.h" +#include "text/text_maxlines_test.h" +#include "text/text_minfontsize_test.h" +#include "text/text_offset_test.h" +#include "text/text_opacity_test.h" +#include "text/text_overlay_test.h" +#include "text/text_padding_test.h" +#include "text/text_position_test.h" +#include "text/text_radialgradient_test.h" +#include "text/text_scale_test.h" +#include "text/text_shadow_test.h" +#include "text/text_sweepgradient_test.h" +#include "text/text_textalign_test.h" +#include "text/text_textcase_test.h" +#include "text/text_textindent_test.h" +#include "text/text_textoverflow_test.h" +#include "text/text_textshadow_test.h" +#include "text/text_transform_test.h" +#include "text/text_visibility_test.h" +#include "text/text_width_test.h" +#include "textarea/textarea_backgroundcolor_test.h" +#include "textarea/textarea_borderradius_test.h" +#include "textarea/textarea_caretcolor_test.h" +#include "textarea/textarea_defaultfocus_test.h" +#include "textarea/textarea_enabled_test.h" +#include "textarea/textarea_fontcolor_test.h" +#include "textarea/textarea_fontfamily_test.h" +#include "textarea/textarea_fontsize_test.h" +#include "textarea/textarea_fontstyle_test.h" +#include "textarea/textarea_fontweight_test.h" +#include "textarea/textarea_height_test.h" +#include "textarea/textarea_key_test.h" +#include "textarea/textarea_lineheight_test.h" +#include "textarea/textarea_maxlength_test.h" +#include "textarea/textarea_onblur_test.h" +#include "textarea/textarea_onchange_test.h" +#include "textarea/textarea_onfocus_test.h" +#include "textarea/textarea_padding_test.h" +#include "textarea/textarea_placeholdercolor_test.h" +#include "textarea/textarea_placeholderfont_test.h" +#include "textarea/textarea_position_test.h" +#include "textarea/textarea_responseregion_test.h" +#include "textarea/textarea_stopediting_test.h" +#include "textarea/textarea_textalign_test.h" +#include "textarea/textarea_width_test.h" +#include "textinput/textinput_backgroundcolor_test.h" +#include "textinput/textinput_backgroundimage_test.h" +#include "textinput/textinput_caretcolor_test.h" +#include "textinput/textinput_caretstyle_test.h" +#include "textinput/textinput_clearbuttonmode_test.h" +#include "textinput/textinput_clip_test.h" +#include "textinput/textinput_defaultfocus_test.h" +#include "textinput/textinput_enabled_test.h" +#include "textinput/textinput_enablekeyboardonfocus_test.h" +#include "textinput/textinput_enterkeytype_test.h" +#include "textinput/textinput_fontcolor_test.h" +#include "textinput/textinput_fontfamily_test.h" +#include "textinput/textinput_fontsize_test.h" +#include "textinput/textinput_fontstyle_test.h" +#include "textinput/textinput_fontweight_test.h" +#include "textinput/textinput_height_test.h" +#include "textinput/textinput_key_test.h" +#include "textinput/textinput_lineheight_test.h" +#include "textinput/textinput_maxlength_test.h" +#include "textinput/textinput_onblur_test.h" +#include "textinput/textinput_onchange_test.h" +#include "textinput/textinput_oncut_test.h" +#include "textinput/textinput_onfocus_test.h" +#include "textinput/textinput_onpaste_test.h" +#include "textinput/textinput_onsubmit_test.h" +#include "textinput/textinput_padding_test.h" +#include "textinput/textinput_placeholdercolor_test.h" +#include "textinput/textinput_placeholderfont_test.h" +#include "textinput/textinput_position_test.h" +#include "textinput/textinput_responseregion_test.h" +#include "textinput/textinput_selectedbackgroundcolor_test.h" +#include "textinput/textinput_showpasswordicon_test.h" +#include "textinput/textinput_showunderline_test.h" +#include "textinput/textinput_stopediting_test.h" +#include "textinput/textinput_textalign_test.h" +#include "textinput/textinput_type_test.h" +#include "textinput/textinput_width_test.h" +#include "textpicker/textpicker_canloop_test.h" +#include "textpicker/textpicker_defaultpickeritemheight_test.h" +#include "textpicker/textpicker_disappeartextstyle_test.h" +#include "textpicker/textpicker_height_test.h" +#include "textpicker/textpicker_onchange_test.h" +#include "textpicker/textpicker_range_test.h" +#include "textpicker/textpicker_selected_test.h" +#include "textpicker/textpicker_selectedindex_test.h" +#include "textpicker/textpicker_selectedtextstyle_test.h" +#include "textpicker/textpicker_textstyle_test.h" +#include "textpicker/textpicker_value_test.h" +#include "textpicker/textpicker_width_test.h" +#include "timepicker/timepicker_disappeartextstyle_test.h" +#include "timepicker/timepicker_height_test.h" +#include "timepicker/timepicker_onchange_test.h" +#include "timepicker/timepicker_selected_test.h" +#include "timepicker/timepicker_selectedtextstyle_test.h" +#include "timepicker/timepicker_textstyle_test.h" +#include "timepicker/timepicker_usemilitarytime_test.h" +#include "toggle/toggle_backgroundcolor_test.h" +#include "toggle/toggle_clip_test.h" +#include "toggle/toggle_enabled_test.h" +#include "toggle/toggle_focusable_test.h" +#include "toggle/toggle_height_test.h" +#include "toggle/toggle_margin_test.h" +#include "toggle/toggle_onchange_test.h" +#include "toggle/toggle_position_test.h" +#include "toggle/toggle_selectedcolor_test.h" +#include "toggle/toggle_switch_test.h" +#include "toggle/toggle_switchpointcolor_test.h" +#include "toggle/toggle_width_test.h" +#include "xcomponent/xcomponent_height_test.h" +#include "xcomponent/xcomponent_sourceid_test.h" +#include "xcomponent/xcomponent_type_test.h" +#include "xcomponent/xcomponent_width_test.h" + +namespace ArkUICApiDemo { +EXTERN_C_START +static napi_value Init(napi_env env, napi_value exports) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "Init", "Init begins"); + if ((env == nullptr) || (exports == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Init", "env or exports is null"); + return nullptr; + } + + napi_property_descriptor desc[] = { + {"getContext", nullptr, PluginManager::GetContext, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"buttonOnClickTest", nullptr, ButtonOnClickTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"buttonFontSizeTest", nullptr, ButtonFontSizeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"buttonFontColorTest", nullptr, ButtonFontColorTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"buttonFontWeightTest", nullptr, ButtonFontWeightTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"buttonBackgroundColorTest", nullptr, ButtonBackgroundColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"checkboxSelectTest", nullptr, CheckboxSelectTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"checkboxSelectedColorTest", nullptr, CheckboxSelectedColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"checkboxUnselectedColorTest", nullptr, CheckboxUnselectedColorTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"checkboxMarkTest", nullptr, CheckboxMarkTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"checkboxShapeTest", nullptr, CheckboxShapeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"checkboxOnChangeTest", nullptr, CheckboxOnChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsWidthTest", nullptr, CommonAttrsWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsHeightTest", nullptr, CommonAttrsHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsBackgroundColorTest", nullptr, CommonAttrsBackgroundColorTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsPositionTest", nullptr, CommonAttrsPositionTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsBorderWidthTest", nullptr, CommonAttrsBorderWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsBorderColorTest", nullptr, CommonAttrsBorderColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsBorderRadiusTest", nullptr, CommonAttrsBorderRadiusTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsBorderStyleTest", nullptr, CommonAttrsBorderStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsAlignTest", nullptr, CommonAttrsAlignTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsDirectionTest", nullptr, CommonAttrsDirectionTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsEnabledTest", nullptr, CommonAttrsEnabledTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsFocusableTest", nullptr, CommonAttrsFocusableTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonEventOnAppearTest", nullptr, CommonEventOnAppearTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonEventOnAreaChangeTest", nullptr, CommonEventOnAreaChangeTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonEventOnTouchTest", nullptr, CommonEventOnTouchTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonEventOnBlurTest", nullptr, CommonEventOnBlurTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonEventOnFocusTest", nullptr, CommonEventOnFocusTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonEventOnClickTest", nullptr, CommonEventOnClickTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsRadialGradientTest", nullptr, CommonAttrsRadialGradientTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsSweepGradientTest", nullptr, CommonAttrsSweepGradientTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsGrayscaleTest", nullptr, CommonAttrsGrayscaleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsForegroundBlurStyleTest", nullptr, CommonAttrsForegroundBlurStyleTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsHitTestBehaviorTest", nullptr, CommonAttrsHitTestBehaviorTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsIdTest", nullptr, CommonAttrsIdTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"commonAttrsOpacityTest", nullptr, CommonAttrsOpacityTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsInvertTest", nullptr, CommonAttrsInvertTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsContrastTest", nullptr, CommonAttrsContrastTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsSepiaTest", nullptr, CommonAttrsSepiaTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsClipCircleTest", nullptr, CommonAttrsClipTest::CreateNativeNodeCircle, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsClipEllipseTest", nullptr, CommonAttrsClipTest::CreateNativeNodeEllipse, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsClipPathTest", nullptr, CommonAttrsClipTest::CreateNativeNodePath, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsClipRectangleTest", nullptr, CommonAttrsClipTest::CreateNativeNodeRectangle, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientLeftTest", nullptr, CommonAttrsLinearGradientTest::CreateNativeNodeLeft, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientTopTest", nullptr, CommonAttrsLinearGradientTest::CreateNativeNodeTop, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientRightTest", nullptr, CommonAttrsLinearGradientTest::CreateNativeNodeRight, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientBottomTest", nullptr, CommonAttrsLinearGradientTest::CreateNativeNodeBottom, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientLeftTopTest", nullptr, CommonAttrsLinearGradientTest::CreateNativeNodeLeftTop, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientLeftBottomTest", nullptr, CommonAttrsLinearGradientTest::CreateNativeNodeLeftBottom, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientRightTopTest", nullptr, CommonAttrsLinearGradientTest::CreateNativeNodeRightTop, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientRightBottomTest", nullptr, + CommonAttrsLinearGradientTest::CreateNativeNodeRightBottom, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientNoneTest", nullptr, CommonAttrsLinearGradientTest::CreateNativeNodeNone, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientCustomTest", nullptr, CommonAttrsLinearGradientTest::CreateNativeNodeCustom, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsLinearGradientLowerBoundAbnormalTest", nullptr, + CommonAttrsLinearGradientTest::CreateNativeNodeLowerBoundAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"commonAttrsLinearGradientIllegalColorAbnormalTest", nullptr, + CommonAttrsLinearGradientTest::CreateNativeNodeIllegalColorAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"commonAttrsScaleReduceXYTest", nullptr, CommonAttrsScaleTest::CreateNativeNodeReduceXY, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsScaleReduceXTest", nullptr, CommonAttrsScaleTest::CreateNativeNodeReduceX, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsScaleEnlargeXYTest", nullptr, CommonAttrsScaleTest::CreateNativeNodeEnlargeXY, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsScaleEnlargeXTest", nullptr, CommonAttrsScaleTest::CreateNativeNodeEnlargeX, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsScaleAbnormalTest", nullptr, CommonAttrsScaleTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsShadowUltraSmallShadowTest", nullptr, CommonAttrsShadowTest::CreateNativeNodeUltraSmallShadow, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsShadowSmallShadowTest", nullptr, CommonAttrsShadowTest::CreateNativeNodeSmallShadow, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsShadowMiddleShadowTest", nullptr, CommonAttrsShadowTest::CreateNativeNodeMiddleShadow, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsShadowLargeShadowTest", nullptr, CommonAttrsShadowTest::CreateNativeNodeLargeShadow, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsShadowFloatingShadowTest", nullptr, CommonAttrsShadowTest::CreateNativeNodeFloatingShadow, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsShadowFloatingSmallShadowTest", nullptr, + CommonAttrsShadowTest::CreateNativeNodeFloatingSmallShadow, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsShadowLowerBoundAbnormalTest", nullptr, CommonAttrsShadowTest::CreateNativeNodeLowerBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsShadowUpperBoundAbnormalTest", nullptr, CommonAttrsShadowTest::CreateNativeNodeUpperBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsMarginUnifiedTest", nullptr, CommonAttrsMarginTest::CreateNativeNodeUnified, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsMarginRespectivelyTest", nullptr, CommonAttrsMarginTest::CreateNativeNodeRespectively, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsMarginUnifiedNegativeTest", nullptr, CommonAttrsMarginTest::CreateNativeNodeUnifiedNegative, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsMarginRespectivelyNegativeTest", nullptr, + CommonAttrsMarginTest::CreateNativeNodeRespectivelyNegative, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsConstraintSizeMaxSetMinTest", nullptr, CommonAttrsConstraintSizeTest::CreateNativeNodeMaxSetMin, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsConstraintSizeMaxMinSetTest", nullptr, CommonAttrsConstraintSizeTest::CreateNativeNodeMaxMinSet, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsConstraintSizeSetMaxMinTest", nullptr, CommonAttrsConstraintSizeTest::CreateNativeNodeSetMaxMin, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsConstraintSizeMinSetMaxTest", nullptr, CommonAttrsConstraintSizeTest::CreateNativeNodeMinSetMax, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsConstraintSizeMinMaxSetTest", nullptr, CommonAttrsConstraintSizeTest::CreateNativeNodeMinMaxSet, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsConstraintSizeSetMinMaxTest", nullptr, CommonAttrsConstraintSizeTest::CreateNativeNodeSetMinMax, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsTransformTest", nullptr, CommonAttrsTransformTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsTransformAbnormalTest", nullptr, CommonAttrsTransformTest::CreateNativeNodeAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsMaskTest", nullptr, CommonAttrsMaskTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"commonAttrsMaskAbnormalTest", nullptr, CommonAttrsMaskTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsBlendModeTest", nullptr, CommonAttrsBlendModeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsFlexBasisFlexRowTest", nullptr, CommonAttrsFlexBasisTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsFlexBasisFlexRowReverseTest", nullptr, CommonAttrsFlexBasisTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsFlexBasisFlexColumnTest", nullptr, CommonAttrsFlexBasisTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsFlexBasisFlexColumnReverseTest", nullptr, CommonAttrsFlexBasisTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsFlexBasisColumnTest", nullptr, CommonAttrsFlexBasisTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsFlexBasisRowTest", nullptr, CommonAttrsFlexBasisTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsFlexGrowFlexRowTest", nullptr, CommonAttrsFlexGrowTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsFlexGrowFlexRowReverseTest", nullptr, CommonAttrsFlexGrowTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsFlexGrowFlexColumnTest", nullptr, CommonAttrsFlexGrowTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsFlexGrowFlexColumnReverseTest", nullptr, CommonAttrsFlexGrowTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsFlexGrowColumnTest", nullptr, CommonAttrsFlexGrowTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsFlexGrowRowTest", nullptr, CommonAttrsFlexGrowTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsFlexShrinkFlexRowTest", nullptr, CommonAttrsFlexShrinkTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsFlexShrinkFlexRowReverseTest", nullptr, CommonAttrsFlexShrinkTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsFlexShrinkFlexColumnTest", nullptr, CommonAttrsFlexShrinkTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsFlexShrinkFlexColumnReverseTest", nullptr, CommonAttrsFlexShrinkTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsFlexShrinkColumnTest", nullptr, CommonAttrsFlexShrinkTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsFlexShrinkRowTest", nullptr, CommonAttrsFlexShrinkTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsAlignSelfTest", nullptr, CommonAttrsAlignSelfTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsAlignSelfChangeTypeTest", nullptr, CommonAttrsAlignSelfTest::ChangeType, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsAlignContentChangeTypeTest", nullptr, CommonAttrsAlignContentTest::ChangeType, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsAlignContentTest", nullptr, CommonAttrsAlignContentTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsJustifyContentTest", nullptr, CommonAttrsJustifyContentTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"commonAttrsJustifyContentChangeTypeTest", nullptr, CommonAttrsJustifyContentTest::ChangeType, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"commonAttrsAlignItemsTest", nullptr, CommonAttrsAlignItemsTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"commonAttrsAlignItemsChangeTypeTest", nullptr, CommonAttrsAlignItemsTest::ChangeType, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentOnMeasureTest", nullptr, CustomComponentOnMeasureTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentOnLayoutTest", nullptr, CustomComponentOnLayoutTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentOnDrawTest", nullptr, CustomComponentOnDrawTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollSaturateMaxTest", nullptr, ScrollSaturateTest::CreateNativeNodeMax, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollSaturateMinTest", nullptr, ScrollSaturateTest::CreateNativeNodeMin, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollSaturateDefaultTest", nullptr, ScrollSaturateTest::CreateNativeNodeDefault, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollSaturateNormalTest", nullptr, ScrollSaturateTest::CreateNativeNodeNormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listCachedCountTest", nullptr, ListCachedCountTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listWidthTest", nullptr, ListWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listWidthBeyondParentComponentTest", nullptr, ListWidthTest::CreateNativeNodeBeyondParentComponent, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listWidthLowerBoundAbnormalTest", nullptr, ListWidthTest::CreateNativeNodeLowerBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listWidthLowerBoundAbnormalContainsSubComponentTest", nullptr, + ListWidthTest::CreateNativeNodeLowerBoundAbnormalContainsSubComponent, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listHeightTest", nullptr, ListHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listHeightBeyondParentComponentTest", nullptr, ListHeightTest::CreateNativeNodeBeyondParentComponent, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listHeightLowerBoundAbnormalTest", nullptr, ListHeightTest::CreateNativeNodeLowerBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listHeightLowerBoundAbnormalContainsSubComponentTest", nullptr, + ListHeightTest::CreateNativeNodeLowerBoundAbnormalContainsSubComponent, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listBackgroundColorTest", nullptr, ListBackgroundColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listBorderWidthUnifiedSettingsTest", nullptr, ListBorderWidthTest::CreateNativeNodeUnifiedSettings, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listBorderWidthRespectivelySettingsTest", nullptr, ListBorderWidthTest::CreateNativeNodeRespectivelySettings, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listBorderWidthUnifiedSettingsLowerBoundAbnormalTest", nullptr, + ListBorderWidthTest::CreateNativeNodeUnifiedSettingsLowerBoundAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listBorderWidthRespectivelySettingsLowerBoundAbnormalTest", nullptr, + ListBorderWidthTest::CreateNativeNodeRespectivelySettingsLowerBoundAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listBorderColorUnifiedSettingsTest", nullptr, ListBorderColorTest::CreateNativeNodeUnifiedSettings, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listBorderColorRespectivelySettingsTest", nullptr, ListBorderColorTest::CreateNativeNodeRespectivelySettings, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listBorderRadiusUnifiedSettingsTest", nullptr, ListBorderRadiusTest::CreateNativeNodeUnifiedSettings, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listBorderRadiusRespectivelySettingsTest", nullptr, + ListBorderRadiusTest::CreateNativeNodeRespectivelySettings, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listBorderRadiusUnifiedSettingsLowerBoundAbnormalTest", nullptr, + ListBorderRadiusTest::CreateNativeNodeUnifiedSettingsLowerBoundAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listBorderRadiusRespectivelySettingsLowerBoundAbnormalTest", nullptr, + ListBorderRadiusTest::CreateNativeNodeRespectivelySettingsLowerBoundAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listOpacityMaxTest", nullptr, ListOpacityTest::CreateNativeNodeMax, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listOpacityMinTest", nullptr, ListOpacityTest::CreateNativeNodeMin, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listOpacityMiddleTest", nullptr, ListOpacityTest::CreateNativeNodeMiddle, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listOpacityLowerBoundAbnormalTest", nullptr, ListOpacityTest::CreateNativeNodeLowerBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listOpacityUpperBoundAbnormalTest", nullptr, ListOpacityTest::CreateNativeNodeUpperBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listClipCutTest", nullptr, ListClipTest::CreateNativeNodeCut, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listClipUncutTest", nullptr, ListClipTest::CreateNativeNodeUncut, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listClipRectangleTest", nullptr, ListClipTest::CreateNativeNodeRectangle, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listClipCircleTest", nullptr, ListClipTest::CreateNativeNodeCircle, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listClipEllipseTest", nullptr, ListClipTest::CreateNativeNodeEllipse, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listClipPathTest", nullptr, ListClipTest::CreateNativeNodePath, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listHitTestBehaviorDefaultTest", nullptr, ListHitTestBehaviorTest::CreateNativeNodeDefault, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listHitTestBehaviorBlockTest", nullptr, ListHitTestBehaviorTest::CreateNativeNodeBlock, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listHitTestBehaviorTransparentTest", nullptr, ListHitTestBehaviorTest::CreateNativeNodeTransparent, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listHitTestBehaviorNoneTest", nullptr, ListHitTestBehaviorTest::CreateNativeNodeNone, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listTranslateSetXYZTest", nullptr, ListTranslateTest::CreateNativeNodeSetXYZ, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listTranslateSetXTest", nullptr, ListTranslateTest::CreateNativeNodeSetX, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listTranslateSetXMinusTest", nullptr, ListTranslateTest::CreateNativeNodeSetXMinus, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listTranslateSetXYZMinusTest", nullptr, ListTranslateTest::CreateNativeNodeSetXYZMinus, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listTranslateUnifiedAbnormalTest", nullptr, ListTranslateTest::CreateNativeNodeUnifiedAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listTranslateUnifiedMinusAbnormalTest", nullptr, ListTranslateTest::CreateNativeNodeUnifiedMinusAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listScaleReduceXYTest", nullptr, ListScaleTest::CreateNativeNodeReduceXY, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listScaleReduceXTest", nullptr, ListScaleTest::CreateNativeNodeReduceX, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listScaleEnlargeXYTest", nullptr, ListScaleTest::CreateNativeNodeEnlargeXY, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listScaleEnlargeXTest", nullptr, ListScaleTest::CreateNativeNodeEnlargeX, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listScaleAbnormalTest", nullptr, ListScaleTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listRotateTest", nullptr, ListRotateTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listRotateSetNegativeNumbersTest", nullptr, ListRotateTest::CreateNativeNodeSetNegativeNumbers, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listRotateDefaultValueTest", nullptr, ListRotateTest::CreateNativeNodeDefaultValue, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listRotateSetXYZTest", nullptr, ListRotateTest::CreateNativeNodeSetXYZ, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listRotateSetRotationAngleTest", nullptr, ListRotateTest::CreateNativeNodeSetRotationAngle, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listRotateSetSightDistanceTest", nullptr, ListRotateTest::CreateNativeNodeSetSightDistance, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listBrightnessMinTest", nullptr, ListBrightnessTest::CreateNativeNodeMin, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listBrightnessMaxTest", nullptr, ListBrightnessTest::CreateNativeNodeMax, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listBrightnessLowerBoundAbnormalTest", nullptr, ListBrightnessTest::CreateNativeNodeLowerBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listBrightnessUpperBoundAbnormalTest", nullptr, ListBrightnessTest::CreateNativeNodeUpperBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listSaturateMinTest", nullptr, ListSaturateTest::CreateNativeNodeMin, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listSaturateMaxTest", nullptr, ListSaturateTest::CreateNativeNodeMax, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listSaturateLowerBoundAbnormalTest", nullptr, ListSaturateTest::CreateNativeNodeLowerBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listSaturateUpperBoundAbnormalTest", nullptr, ListSaturateTest::CreateNativeNodeUpperBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listBlurTest", nullptr, ListBlurTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listBlurDefaultValueTest", nullptr, ListBlurTest::CreateNativeNodeDefaultValue, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listBlurAbnormalTest", nullptr, ListBlurTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listShadowUltraSmallShadowTest", nullptr, ListShadowTest::CreateNativeNodeUltraSmallShadow, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listShadowSmallShadowTest", nullptr, ListShadowTest::CreateNativeNodeSmallShadow, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listShadowMiddleShadowTest", nullptr, ListShadowTest::CreateNativeNodeMiddleShadow, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listShadowLargeShadowTest", nullptr, ListShadowTest::CreateNativeNodeLargeShadow, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listShadowFloatingShadowTest", nullptr, ListShadowTest::CreateNativeNodeFloatingShadow, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listShadowFloatingSmallShadowTest", nullptr, ListShadowTest::CreateNativeNodeFloatingSmallShadow, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listShadowLowerBoundAbnormalTest", nullptr, ListShadowTest::CreateNativeNodeLowerBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listShadowUpperBoundAbnormalTest", nullptr, ListShadowTest::CreateNativeNodeUpperBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listLinearGradientLeftTest", nullptr, ListLinearGradientTest::CreateNativeNodeLeft, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listLinearGradientTopTest", nullptr, ListLinearGradientTest::CreateNativeNodeTop, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listLinearGradientRightTest", nullptr, ListLinearGradientTest::CreateNativeNodeRight, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listLinearGradientBottomTest", nullptr, ListLinearGradientTest::CreateNativeNodeBottom, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listLinearGradientLeftTopTest", nullptr, ListLinearGradientTest::CreateNativeNodeLeftTop, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listLinearGradientLeftBottomTest", nullptr, ListLinearGradientTest::CreateNativeNodeLeftBottom, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listLinearGradientRightTopTest", nullptr, ListLinearGradientTest::CreateNativeNodeRightTop, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listLinearGradientRightBottomTest", nullptr, ListLinearGradientTest::CreateNativeNodeRightBottom, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listLinearGradientNoneTest", nullptr, ListLinearGradientTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listLinearGradientCustomTest", nullptr, ListLinearGradientTest::CreateNativeNodeCustom, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listLinearGradientLowerBoundAbnormalTest", nullptr, + ListLinearGradientTest::CreateNativeNodeLowerBoundAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listLinearGradientIllegalColorAbnormalTest", nullptr, + ListLinearGradientTest::CreateNativeNodeIllegalColorAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listScrollBarOffTest", nullptr, ListScrollBarTest::CreateNativeNodeOff, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listScrollBarAutoTest", nullptr, ListScrollBarTest::CreateNativeNodeAuto, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listScrollBarOnTest", nullptr, ListScrollBarTest::CreateNativeNodeOn, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listScrollBarLowerBoundAbnormalTest", nullptr, ListScrollBarTest::CreateNativeNodeLowerBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listScrollBarUpperBoundAbnormalTest", nullptr, ListScrollBarTest::CreateNativeNodeUpperBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listListDirectionVerticalTest", nullptr, ListListDirectionTest::CreateNativeNodeVertical, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listListDirectionHorizontalTest", nullptr, ListListDirectionTest::CreateNativeNodeHorizontal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listListDirectionLowerBoundAbnormalTest", nullptr, ListListDirectionTest::CreateNativeNodeLowerBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listListDirectionUpperBoundAbnormalTest", nullptr, ListListDirectionTest::CreateNativeNodeUpperBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listStickyNoneTest", nullptr, ListStickyTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listStickyHeaderTest", nullptr, ListStickyTest::CreateNativeNodeHeader, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listStickyFooterTest", nullptr, ListStickyTest::CreateNativeNodeFooter, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listStickyBothTest", nullptr, ListStickyTest::CreateNativeNodeBoth, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listStickyLowerBoundAbnormalTest", nullptr, ListStickyTest::CreateNativeNodeLowerBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listStickyUpperBoundAbnormalTest", nullptr, ListStickyTest::CreateNativeNodeUpperBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listFrictionDefaultTest", nullptr, ListFrictionTest::CreateNativeNodeDefault, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listFrictionNormalTest", nullptr, ListFrictionTest::CreateNativeNodeNormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listFrictionAbnormalTest", nullptr, ListFrictionTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listEnableScrollInteractionSupportedTest", nullptr, + ListEnableScrollInteractionTest::CreateNativeNodeSupported, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listEnableScrollInteractionNotSupportedTest", nullptr, + ListEnableScrollInteractionTest::CreateNativeNodeNotSupported, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listEnableScrollInteractionLowerBoundAbnormalTest", nullptr, + ListEnableScrollInteractionTest::CreateNativeNodeLowerBoundAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listEnableScrollInteractionUpperBoundAbnormalTest", nullptr, + ListEnableScrollInteractionTest::CreateNativeNodeUpperBoundAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listItemWidthTest", nullptr, ListItemWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listItemWidthBeyondParentComponentTest", nullptr, ListItemWidthTest::CreateNativeNodeBeyondParentComponent, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemWidthLowerBoundAbnormalTest", nullptr, ListItemWidthTest::CreateNativeNodeLowerBoundAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemWidthLowerBoundAbnormalContainsSubComponentTest", nullptr, + ListItemWidthTest::CreateNativeNodeLowerBoundAbnormalContainsSubComponent, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemHeightTest", nullptr, ListItemHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listItemHeightBeyondParentComponentTest", nullptr, ListItemHeightTest::CreateNativeNodeBeyondParentComponent, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemHeightLowerBoundAbnormalTest", nullptr, ListItemHeightTest::CreateNativeNodeLowerBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemHeightLowerBoundAbnormalContainsSubComponentTest", nullptr, + ListItemHeightTest::CreateNativeNodeLowerBoundAbnormalContainsSubComponent, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemBackgroundColorTest", nullptr, ListItemBackgroundColorTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemBorderWidthUnifiedSettingsTest", nullptr, ListItemBorderWidthTest::CreateNativeNodeUnifiedSettings, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemBorderWidthRespectivelySettingsTest", nullptr, + ListItemBorderWidthTest::CreateNativeNodeRespectivelySettings, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listItemBorderWidthUnifiedSettingsLowerBoundAbnormalTest", nullptr, + ListItemBorderWidthTest::CreateNativeNodeUnifiedSettingsLowerBoundAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemBorderWidthRespectivelySettingsLowerBoundAbnormalTest", nullptr, + ListItemBorderWidthTest::CreateNativeNodeRespectivelySettingsLowerBoundAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemBorderColorUnifiedSettingsTest", nullptr, ListItemBorderColorTest::CreateNativeNodeUnifiedSettings, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemBorderColorRespectivelySettingsTest", nullptr, + ListItemBorderColorTest::CreateNativeNodeRespectivelySettings, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listItemBorderRadiusUnifiedSettingsTest", nullptr, ListItemBorderRadiusTest::CreateNativeNodeUnifiedSettings, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemBorderRadiusRespectivelySettingsTest", nullptr, + ListItemBorderRadiusTest::CreateNativeNodeRespectivelySettings, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listItemBorderRadiusUnifiedSettingsLowerBoundAbnormalTest", nullptr, + ListItemBorderRadiusTest::CreateNativeNodeUnifiedSettingsLowerBoundAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemBorderRadiusRespectivelySettingsLowerBoundAbnormalTest", nullptr, + ListItemBorderRadiusTest::CreateNativeNodeRespectivelySettingsLowerBoundAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemOpacityMaxTest", nullptr, ListItemOpacityTest::CreateNativeNodeMax, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemOpacityMinTest", nullptr, ListItemOpacityTest::CreateNativeNodeMin, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemOpacityMiddleTest", nullptr, ListItemOpacityTest::CreateNativeNodeMiddle, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemOpacityLowerBoundAbnormalTest", nullptr, ListItemOpacityTest::CreateNativeNodeLowerBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemOpacityUpperBoundAbnormalTest", nullptr, ListItemOpacityTest::CreateNativeNodeUpperBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemClipCutTest", nullptr, ListItemClipTest::CreateNativeNodeCut, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listItemClipUncutTest", nullptr, ListItemClipTest::CreateNativeNodeUncut, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemClipRectangleTest", nullptr, ListItemClipTest::CreateNativeNodeRectangle, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemClipCircleTest", nullptr, ListItemClipTest::CreateNativeNodeCircle, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemClipEllipseTest", nullptr, ListItemClipTest::CreateNativeNodeEllipse, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemClipPathTest", nullptr, ListItemClipTest::CreateNativeNodePath, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemHitTestBehaviorDefaultTest", nullptr, ListItemHitTestBehaviorTest::CreateNativeNodeDefault, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemHitTestBehaviorBlockTest", nullptr, ListItemHitTestBehaviorTest::CreateNativeNodeBlock, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemHitTestBehaviorTransparentTest", nullptr, ListItemHitTestBehaviorTest::CreateNativeNodeTransparent, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemHitTestBehaviorNoneTest", nullptr, ListItemHitTestBehaviorTest::CreateNativeNodeNone, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemTranslateSetXYZTest", nullptr, ListItemTranslateTest::CreateNativeNodeSetXYZ, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemTranslateSetXTest", nullptr, ListItemTranslateTest::CreateNativeNodeSetX, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemTranslateSetXMinusTest", nullptr, ListItemTranslateTest::CreateNativeNodeSetXMinus, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemTranslateSetXYZMinusTest", nullptr, ListItemTranslateTest::CreateNativeNodeSetXYZMinus, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemTranslateUnifiedAbnormalTest", nullptr, ListItemTranslateTest::CreateNativeNodeUnifiedAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemTranslateUnifiedMinusAbnormalTest", nullptr, + ListItemTranslateTest::CreateNativeNodeUnifiedMinusAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemScaleReduceXYTest", nullptr, ListItemScaleTest::CreateNativeNodeReduceXY, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemScaleReduceXTest", nullptr, ListItemScaleTest::CreateNativeNodeReduceX, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemScaleEnlargeXYTest", nullptr, ListItemScaleTest::CreateNativeNodeEnlargeXY, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemScaleEnlargeXTest", nullptr, ListItemScaleTest::CreateNativeNodeEnlargeX, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemScaleAbnormalTest", nullptr, ListItemScaleTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemRotateTest", nullptr, ListItemRotateTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listItemRotateSetNegativeNumbersTest", nullptr, ListItemRotateTest::CreateNativeNodeSetNegativeNumbers, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemRotateDefaultValueTest", nullptr, ListItemRotateTest::CreateNativeNodeDefaultValue, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemRotateSetXYZTest", nullptr, ListItemRotateTest::CreateNativeNodeSetXYZ, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemRotateSetRotationAngleTest", nullptr, ListItemRotateTest::CreateNativeNodeSetRotationAngle, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemRotateSetSightDistanceTest", nullptr, ListItemRotateTest::CreateNativeNodeSetSightDistance, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemBrightnessMinTest", nullptr, ListItemBrightnessTest::CreateNativeNodeMin, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemBrightnessMaxTest", nullptr, ListItemBrightnessTest::CreateNativeNodeMax, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemBrightnessLowerBoundAbnormalTest", nullptr, + ListItemBrightnessTest::CreateNativeNodeLowerBoundAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemBrightnessUpperBoundAbnormalTest", nullptr, + ListItemBrightnessTest::CreateNativeNodeUpperBoundAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemSaturateMinTest", nullptr, ListItemSaturateTest::CreateNativeNodeMin, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemSaturateMaxTest", nullptr, ListItemSaturateTest::CreateNativeNodeMax, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemSaturateLowerBoundAbnormalTest", nullptr, ListItemSaturateTest::CreateNativeNodeLowerBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemSaturateUpperBoundAbnormalTest", nullptr, ListItemSaturateTest::CreateNativeNodeUpperBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemBlurTest", nullptr, ListItemBlurTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listItemBlurDefaultValueTest", nullptr, ListItemBlurTest::CreateNativeNodeDefaultValue, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemBlurAbnormalTest", nullptr, ListItemBlurTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemShadowUltraSmallShadowTest", nullptr, ListItemShadowTest::CreateNativeNodeUltraSmallShadow, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemShadowSmallShadowTest", nullptr, ListItemShadowTest::CreateNativeNodeSmallShadow, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemShadowMiddleShadowTest", nullptr, ListItemShadowTest::CreateNativeNodeMiddleShadow, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemShadowLargeShadowTest", nullptr, ListItemShadowTest::CreateNativeNodeLargeShadow, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemShadowFloatingShadowTest", nullptr, ListItemShadowTest::CreateNativeNodeFloatingShadow, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemShadowFloatingSmallShadowTest", nullptr, ListItemShadowTest::CreateNativeNodeFloatingSmallShadow, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemShadowLowerBoundAbnormalTest", nullptr, ListItemShadowTest::CreateNativeNodeLowerBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemShadowUpperBoundAbnormalTest", nullptr, ListItemShadowTest::CreateNativeNodeUpperBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemLinearGradientLeftTest", nullptr, ListItemLinearGradientTest::CreateNativeNodeLeft, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemLinearGradientTopTest", nullptr, ListItemLinearGradientTest::CreateNativeNodeTop, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemLinearGradientRightTest", nullptr, ListItemLinearGradientTest::CreateNativeNodeRight, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemLinearGradientBottomTest", nullptr, ListItemLinearGradientTest::CreateNativeNodeBottom, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemLinearGradientLeftTopTest", nullptr, ListItemLinearGradientTest::CreateNativeNodeLeftTop, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemLinearGradientLeftBottomTest", nullptr, ListItemLinearGradientTest::CreateNativeNodeLeftBottom, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemLinearGradientRightTopTest", nullptr, ListItemLinearGradientTest::CreateNativeNodeRightTop, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemLinearGradientRightBottomTest", nullptr, ListItemLinearGradientTest::CreateNativeNodeRightBottom, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemLinearGradientNoneTest", nullptr, ListItemLinearGradientTest::CreateNativeNodeNone, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemLinearGradientCustomTest", nullptr, ListItemLinearGradientTest::CreateNativeNodeCustom, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemLinearGradientLowerBoundAbnormalTest", nullptr, + ListItemLinearGradientTest::CreateNativeNodeLowerBoundAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listItemLinearGradientIllegalColorAbnormalTest", nullptr, + ListItemLinearGradientTest::CreateNativeNodeIllegalColorAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollHeightTest", nullptr, ScrollHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollHeightLargeTest", nullptr, ScrollHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollPositionTest", nullptr, ScrollPositionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollNestedScrollTest", nullptr, ScrollNestedScrollTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollNestedScrollChangeTestType", nullptr, ScrollNestedScrollTest::ChangeTestType, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollWidthTest", nullptr, ScrollWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollWidthLargeTest", nullptr, ScrollWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScrollBarAbnormalTest", nullptr, ScrollScrollBarTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollScrollBarAutoTest", nullptr, ScrollScrollBarTest::CreateNativeNodeAuto, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScrollBarOnTest", nullptr, ScrollScrollBarTest::CreateNativeNodeOn, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScrollBarOffTest", nullptr, ScrollScrollBarTest::CreateNativeNodeOff, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScrollBarColorTest", nullptr, ScrollScrollBarColorTest::CreateNativeNodeScrollBarColor, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollScrollBarColorBlackTest", nullptr, ScrollScrollBarColorTest::CreateNativeNodeBlack, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollScrollBarColorWhiteTest", nullptr, ScrollScrollBarColorTest::CreateNativeNodeWhite, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollScrollAbleTest", nullptr, ScrollScrollAbleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScrollAbleAbnormalTest", nullptr, ScrollScrollAbleTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollScrollAbleHorizontalTest", nullptr, ScrollScrollAbleTest::CreateNativeNodeHorizontal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollScrollAbleNoneTest", nullptr, ScrollScrollAbleTest::CreateNativeNodeAbnormalNone, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollBackgroundColorTest", nullptr, ScrollBackgroundColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollBackgroundColorBlackTest", nullptr, ScrollBackgroundColorTest::CreateNativeNodeBlack, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollBackgroundColorWhiteTest", nullptr, ScrollBackgroundColorTest::CreateNativeNodeWhite, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollBorderColorTest", nullptr, ScrollBorderColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollBorderColorAbnormalTest", nullptr, ScrollBorderColorTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollBorderRadiusSingleTest", nullptr, ScrollBorderRadiusTest::CreateNativeNodeSingle, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollBorderRadiusAbnormalTest", nullptr, ScrollBorderRadiusTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollBorderRadiusAllParamTest", nullptr, ScrollBorderRadiusTest::CreateNativeNodeAllParam, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollBorderWidthSingleTest", nullptr, ScrollBorderWidthTest::CreateNativeNodeSingle, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollBorderWidthAbnormalTest", nullptr, ScrollBorderWidthTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollBorderWidthAllParamTest", nullptr, ScrollBorderWidthTest::CreateNativeNodeAllParam, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollClipTrueTest", nullptr, ScrollClipTest::CreateNativeNodeTrue, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollClipAbnormalTest", nullptr, ScrollClipTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollClipFalseTest", nullptr, ScrollClipTest::CreateNativeNodeFalse, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollEnableScrollInteractionTrueTest", nullptr, ScrollEnableScrollInteractionTest::CreateNativeNodeTrue, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollEnableScrollInteractionAbnormalTest", nullptr, + ScrollEnableScrollInteractionTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollEnableScrollInteractionFalseTest", nullptr, ScrollEnableScrollInteractionTest::CreateNativeNodeFalse, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollOpacityMaxTest", nullptr, ScrollOpacityTest::CreateNativeNodeMax, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollOpacityMiddleTest", nullptr, ScrollOpacityTest::CreateNativeNodeMiddle, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollOpacityAbnormalTest", nullptr, ScrollOpacityTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollOpacityMinTest", nullptr, ScrollOpacityTest::CreateNativeNodeMin, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollTranslateTest", nullptr, ScrollTranslateTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollTranslateDefaultTest", nullptr, ScrollTranslateTest::CreateNativeNodeDefault, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScaleTest", nullptr, ScrollScaleTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollScaleNormalTest", nullptr, ScrollScaleTest::CreateNativeNodeNormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScaleAbNormalTest", nullptr, ScrollScaleTest::CreateNativeNodeAbNormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollRotateTest", nullptr, ScrollRotateTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollRotateNormalTest", nullptr, ScrollRotateTest::CreateNativeNodeNormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollRotateAbNormalTest", nullptr, ScrollRotateTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollBrightnessMinTest", nullptr, ScrollBrightnessTest::CreateNativeNodeMin, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollBrightnessMaxTest", nullptr, ScrollBrightnessTest::CreateNativeNodeMax, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollBrightnessTest", nullptr, ScrollBrightnessTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollBrightnessAbnormalTest", nullptr, ScrollBrightnessTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollBlurDefaultTest", nullptr, ScrollBlurTest::CreateNativeNodeDefault, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollBlurTest", nullptr, ScrollBlurTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollShadowMinTest", nullptr, ScrollShadowTest::CreateNativeNodeMin, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollShadowBigTest", nullptr, ScrollShadowTest::CreateNativeNodeBig, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollShadowMiddleTest", nullptr, ScrollShadowTest::CreateNativeNodeMiddle, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollShadowLittleTest", nullptr, ScrollShadowTest::CreateNativeNodeLittle, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollShadowFloatMiddleTest", nullptr, ScrollShadowTest::CreateNativeNodeFloatMiddle, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollShadowFloatLittleTest", nullptr, ScrollShadowTest::CreateNativeNodeFloatLittle, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollOnScrollFrameBeginTest", nullptr, ScrollOnScrollFrameBeginTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollOnScrollTest", nullptr, ScrollOnScrollTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollScrollEdgeTest", nullptr, ScrollScrollEdgeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollOnScrollStopTest", nullptr, ScrollOnScrollStopTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollOnAppearTest", nullptr, ScrollOnAppearTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollOnScrollEdgeTest", nullptr, ScrollOnScrollEdgeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollOnScrollStartTest", nullptr, ScrollOnScrollStartTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollEdgeEffectNoneTest", nullptr, ScrollEdgeEffectTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollEdgeEffectSpringTest", nullptr, ScrollEdgeEffectTest::CreateNativeNodeSpring, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollEdgeEffectFadeTest", nullptr, ScrollEdgeEffectTest::CreateNativeNodeFade, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScrollSnapNoneTest", nullptr, ScrollScrollSnapTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScrollSnapEndTest", nullptr, ScrollScrollSnapTest::CreateNativeNodeEnd, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScrollSnapStartTest", nullptr, ScrollScrollSnapTest::CreateNativeNodeStart, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScrollSnapCenterTest", nullptr, ScrollScrollSnapTest::CreateNativeNodeCenter, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollCurrentOffsetLinearTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollCurrentOffsetEaseTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeEase, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollCurrentOffsetEaseInOutTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeEaseInOut, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollCurrentOffsetEaseInTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeEaseIn, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollCurrentOffsetEaseOutTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeEaseOut, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollCurrentOffsetExtremeDecelerationTest", nullptr, + ScrollCurrentOffsetTest::CreateNativeNodeExtremeDeceleration, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollCurrentOffsetFastOutLinearInTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeFastOutLinearIn, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollCurrentOffsetFastOutSlowInTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeFastOutSlowIn, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollCurrentOffsetFrictionTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeFriction, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollCurrentOffsetLinearOutSlowInTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeLinearOutSlowIn, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollCurrentOffsetRhythmTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeRhythm, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollCurrentOffsetSharpTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeSharp, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollCurrentOffsetSmoothTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNodeSmooth, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollScrollToTest", nullptr, ScrollCurrentOffsetTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollOverlayTest", nullptr, ScrollOverlayTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"scrollHitTestBehaviorTest", nullptr, ScrollHitTestBehaviorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollLinearGradientTest", nullptr, ScrollLinearGradientTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollFrictionNormalTest", nullptr, ScrollFrictionTest::CreateNativeNodeDefault, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollFrictionAbNormalTest", nullptr, ScrollFrictionTest::CreateNativeNodeAbNormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollFrictionDefaultTest", nullptr, ScrollFrictionTest::CreateNativeNodeNormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollPageEnableTrueTest", nullptr, ScrollPageEnableTest::CreateNativeNodeTrue, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollPageEnableFalseTest", nullptr, ScrollPageEnableTest::CreateNativeNodeFalse, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"swiperVerticalTest", nullptr, SwiperVerticalTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperDisplayArrowTest", nullptr, SwiperDisplayArrowTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"swiperItemSpaceTest", nullptr, SwiperItemSpaceTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"toggleWidthTest", nullptr, ToggleWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"toggleWidthLargeTest", nullptr, ToggleWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"toggleHeightTest", nullptr, ToggleHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"toggleHeightLargeTest", nullptr, ToggleHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"togglePositionTest", nullptr, TogglePositionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"togglePositionLargeTest", nullptr, TogglePositionTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"toggleOnChangeTest", nullptr, ToggleOnChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"toggleFocusableTest", nullptr, ToggleFocusableTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperDisplayCountTest", nullptr, SwiperDisplayCountTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"swiperIndexTest", nullptr, SwiperIndexTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"toggleBackgroundColorTest", nullptr, ToggleBackgroundColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"toggleSwitchPointColorTest", nullptr, ToggleSwitchPointColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"toggleSelectedColorTest", nullptr, ToggleSelectedColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"swiperBackgroundColorTest", nullptr, SwiperBackgroundColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"swiperBackgroundImageTest", nullptr, SwiperBackgroundImageTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"swiperWidthTest", nullptr, SwiperWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperWidthLargeTest", nullptr, SwiperWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"toggleMarginTest", nullptr, ToggleMarginTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"toggleEnabledTest", nullptr, ToggleEnabledTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"toggleMarginLargeTest", nullptr, ToggleMarginTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"toggleMarginFourLargeTest", nullptr, ToggleMarginTest::CreateNativeNodeFourLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"toggleMarginMiddleTest", nullptr, ToggleMarginTest::CreateNativeNodeMiddle, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"toggleClipTest", nullptr, ToggleClipTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"toggleSwitchTest", nullptr, ToggleSwitchTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperAutoPlayTest", nullptr, SwiperAutoPlayTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperAutoPlayToEndTest", nullptr, SwiperAutoPlayTest::CreateNativeAutoPlayToEndNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"swiperHeightTest", nullptr, SwiperHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperHeightLargeTest", nullptr, SwiperHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"swiperPositionTest", nullptr, SwiperPositionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperClipTest", nullptr, SwiperClipTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"swiperIndicatorTest", nullptr, SwiperIndicatorTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperDisableSwipeTest", nullptr, SwiperDisableSwipeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"swiperCachedCountTest", nullptr, SwiperCachedCountTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textWidthTest", nullptr, TextWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textWidthLargeTest", nullptr, TextWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textHeightTest", nullptr, TextHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textHeightLargeTest", nullptr, TextHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textPositionTest", nullptr, TextPositionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textBackgroundColorTest", nullptr, TextBackgroundColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textBackgroundImageTest", nullptr, TextBackgroundImageTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textBorderWidthTest", nullptr, TextBorderWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textBorderColorTest", nullptr, TextBorderColorTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textBorderRadiusTest", nullptr, TextBorderRadiusTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textOpacityTest", nullptr, TextOpacityTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textFontColorTest", nullptr, TextFontColorTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textFontSizeTest", nullptr, TextFontSizeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textMaxLinesTest", nullptr, TextMaxLinesTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textLineHeightTest", nullptr, TextLineHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textTextOverflowTest", nullptr, TextTextOverflowTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textTextAlignTest", nullptr, TextTextAlignTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textDecorationTest", nullptr, TextDecorationTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textFontWeightTest", nullptr, TextFontWeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textFontStyleTest", nullptr, TextFontStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textPaddingTest", nullptr, TextPaddingTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textBaselineOffsetTest", nullptr, TextBaselineOffsetTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textTextShadowTest", nullptr, TextTextShadowTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textLetterSpacingTest", nullptr, TextLetterSpacingTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textTextCaseTest", nullptr, TextTextCaseTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textVisibilityTest", nullptr, TextVisibilityTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textOffsetTest", nullptr, TextOffsetTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textMaskTest", nullptr, TextMaskTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textShadowTest", nullptr, TextShadowTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textLinearGradientTest", nullptr, TextLinearGradientTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textScaleTest", nullptr, TextScaleTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textTransformTest", nullptr, TextTransformTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textTextIndentTest", nullptr, TextTextIndentTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textMinFontSizeTest", nullptr, TextMinFontSizeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textMaxFontSizeTest", nullptr, TextMaxFontSizeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textHeightAdaptivePolicyTest", nullptr, TextHeightAdaptivePolicyTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textOverlayTest", nullptr, TextOverlayTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textFontFamilyTest", nullptr, TextFontFamilyTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textClipTest", nullptr, TextClipTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textRadialGradientTest", nullptr, TextRadialGradientTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textSweepGradientTest", nullptr, TextSweepGradientTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textFontTest", nullptr, TextFontTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAlignTest", nullptr, TextAlignTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textLineBreakStrategyTest", nullptr, TextLineBreakStrategyTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAlignRulesTest", nullptr, TextAlignRulesTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textCopyOptionTest", nullptr, TextCopyOptionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackTransitionTest", nullptr, StackTransitionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textEnabledTest", nullptr, TextEnabledTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackBackgroundColorTest", nullptr, StackBackgroundColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"stackBorderColorTest", nullptr, StackBorderColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"stackOpacityTest", nullptr, StackOpacityTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackScaleTest", nullptr, StackScaleTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"stackClipTest", nullptr, StackClipTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"stackHitTestBehaviorTest", nullptr, StackHitTestBehaviorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"stackRotateTest", nullptr, StackRotateTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackTranslateTest", nullptr, StackTranslateTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackBorderRadiusTest", nullptr, StackBorderRadiusTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"stackBrightnessTest", nullptr, StackBrightnessTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackSaturateTest", nullptr, StackSaturateTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackBackgroundImageSizeTest", nullptr, StackBackgroundImageSizeTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"stackBackgroundImagePositionTest", nullptr, StackBackgroundImagePositionTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"stackBorderWidthTest", nullptr, StackBorderWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"stackBackgroundBlurStyleTest", nullptr, StackBackgroundBlurStyleTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"stackShadowTest", nullptr, StackShadowTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackLinearGradientTest", nullptr, StackLinearGradientTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"stackIdTest", nullptr, StackIdTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"stackBackgroundImageTest", nullptr, StackBackgroundImageTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"stackOnAreaChangeTest", nullptr, StackOnAreaChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"stackOnTouchTest", nullptr, StackOnTouchTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackMarginTest", nullptr, StackMarginTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackAlignTest", nullptr, StackAlignTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"stackWidthTest", nullptr, StackWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"stackWidthLargeTest", nullptr, StackWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackHeightTest", nullptr, StackHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackHeightLargeTest", nullptr, StackHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"stackPositionTest", nullptr, StackPositionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"stackBorderStyleTest", nullptr, StackBorderStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"stackTransformTest", nullptr, StackTransformTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageWidthTest", nullptr, ImageWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"imageWidthLargeTest", nullptr, ImageWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageHeightTest", nullptr, ImageHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageHeightLargeTest", nullptr, ImageHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imagePositionTest", nullptr, ImagePositionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageBackgroundColorTest", nullptr, ImageBackgroundColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageBorderColorTest", nullptr, ImageBorderColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageBorderWidthTest", nullptr, ImageBorderWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageBorderRadiusTest", nullptr, ImageBorderRadiusTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageOpacityTest", nullptr, ImageOpacityTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageHitTestBehaviorTest", nullptr, ImageHitTestBehaviorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageRotateTest", nullptr, ImageRotateTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageScaleTest", nullptr, ImageScaleTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"imageTranslateTest", nullptr, ImageTranslateTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageBlurTest", nullptr, ImageBlurTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"imageBrightnessTest", nullptr, ImageBrightnessTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageSaturateTest", nullptr, ImageSaturateTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageAutoResizeTest", nullptr, ImageAutoResizeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageLinearGradientTest", nullptr, ImageLinearGradientTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageShadowTest", nullptr, ImageShadowTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageInterpolationTest", nullptr, ImageInterpolationTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageObjectFitTest", nullptr, ImageObjectFitTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageObjectRepeatTest", nullptr, ImageObjectRepeatTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageSrcTest", nullptr, ImageSrcTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"imageBorderStyleTest", nullptr, ImageBorderStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageColorFilterTest", nullptr, ImageColorFilterTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageIdTest", nullptr, ImageIdTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"imageClipTest", nullptr, ImageClipTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"imageTransformTest", nullptr, ImageTransformTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageAltTest", nullptr, ImageAltTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"imageOnCompleteTest", nullptr, ImageOnCompleteTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageOnErrorTest", nullptr, ImageOnErrorTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageRadialGradientTest", nullptr, ImageRadialGradientTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageSweepGradientTest", nullptr, ImageSweepGradientTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"columnWidthTest", nullptr, ColumnWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"columnWidthLargeTest", nullptr, ColumnWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"columnHeightTest", nullptr, ColumnHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"columnHeightLargeTest", nullptr, ColumnHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"columnPaddingTest", nullptr, ColumnPaddingTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"columnForegroundBlurStyleTest", nullptr, ColumnForegroundBlurStyleTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"rowHeightTest", nullptr, RowHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"rowHeightLargeTest", nullptr, RowHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderWidthTest", nullptr, SliderWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderWidthLargeTest", nullptr, SliderWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderHeightTest", nullptr, SliderHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderHeightLargeTest", nullptr, SliderHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderEnabledTest", nullptr, SliderEnabledTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textAreaWidthTest", nullptr, TextAreaWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textAreaWidthLargeTest", nullptr, TextAreaWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaHeightTest", nullptr, TextAreaHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textAreaHeightLargeTest", nullptr, TextAreaHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaEnabledTest", nullptr, TextAreaEnabledTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textAreaPositionTest", nullptr, TextAreaPositionTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputWidthTest", nullptr, TextInputWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputWidthLargeTest", nullptr, TextInputWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputHeightTest", nullptr, TextInputHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputHeightLargeTest", nullptr, TextInputHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputPositionTest", nullptr, TextInputPositionTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputShowPasswordIconTest", nullptr, TextInputShowPasswordIconTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputSelectedBackgroundColorTest", nullptr, TextInputSelectedBackgroundColorTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textInputCaretStyleTest", nullptr, TextInputCaretStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputCaretStyleLargeTest", nullptr, TextInputCaretStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputCaretStyleAbnormalTest", nullptr, TextInputCaretStyleTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputEnabledTest", nullptr, TextInputEnabledTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputEnterKeyTypeTest", nullptr, TextInputEnterKeyTypeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputTypeTest", nullptr, TextInputTypeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputOnChangeTest", nullptr, TextInputOnChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputEnableKeyboardOnFocusTest", nullptr, TextInputEnableKeyboardOnFocusTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputEnableKeyboardOnFocusDisableTest", nullptr, + TextInputEnableKeyboardOnFocusTest::CreateNativeNodeDisableKeyBoard, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputEnableKeyboardOnFocusAbnormalTest", nullptr, + TextInputEnableKeyboardOnFocusTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"spanDecorationTest", nullptr, SpanDecorationTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"spanLetterSpacingTest", nullptr, SpanLetterSpacingTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"spanTextCaseTest", nullptr, SpanTextCaseTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"spanLineHeightTest", nullptr, SpanLineHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"calendarPickerWidthTest", nullptr, CalendarPickerWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"calendarPickerWidthLargeTest", nullptr, CalendarPickerWidthTest::CreateNativeNodeLarge, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"calendarPickerEnabledTest", nullptr, CalendarPickerEnabledTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"datePickerWidthTest", nullptr, DatePickerWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"datePickerWidthLargeTest", nullptr, DatePickerWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"datePickerEnabledTest", nullptr, DatePickerEnabledTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"checkboxWidthTest", nullptr, CheckboxWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"checkboxWidthLargeTest", nullptr, CheckboxWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"checkboxHeightTest", nullptr, CheckboxHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"checkboxHeightLargeTest", nullptr, CheckboxHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"checkboxEnabledTest", nullptr, CheckboxEnabledTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"xComponentWidthTest", nullptr, XComponentWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"xComponentWidthLargeTest", nullptr, XComponentWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"xComponentHeightTest", nullptr, XComponentHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"xComponentHeightLargeTest", nullptr, XComponentHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textPickerWidthTest", nullptr, TextPickerWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textPickerWidthLargeTest", nullptr, TextPickerWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textPickerHeightTest", nullptr, TextPickerHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textPickerHeightLargeTest", nullptr, TextPickerHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"flexWidthTest", nullptr, FlexWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"flexWidthLargeTest", nullptr, FlexWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"flexHeightTest", nullptr, FlexHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"flexHeightLargeTest", nullptr, FlexHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageSpanWidthTest", nullptr, ImageSpanWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageSpanWidthLargeTest", nullptr, ImageSpanWidthTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageSpanHeightTest", nullptr, ImageSpanHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"imageSpanHeightLargeTest", nullptr, ImageSpanHeightTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageSpanObjectFitTest", nullptr, ImageSpanObjectFitTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageSpanVerticalAlignTest", nullptr, ImageSpanVerticalAlignTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"imageSpanPaddingTest", nullptr, ImageSpanPaddingTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"spanFontStyleTest", nullptr, SpanFontStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"spanFontWeightTest", nullptr, SpanFontWeightTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"spanFontColorTest", nullptr, SpanFontColorTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"spanFontSizeTest", nullptr, SpanFontSizeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"calendarPickerEdgeAlignStartTest", nullptr, CalendarPickerEdgeAlignTest::CreateNativeNodeStart, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"calendarPickerEdgeAlignCenterTest", nullptr, CalendarPickerEdgeAlignTest::CreateNativeNodeCenter, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"calendarPickerEdgeAlignEndTest", nullptr, CalendarPickerEdgeAlignTest::CreateNativeNodeEnd, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"calendarPickerEdgeAlignDefaultTest", nullptr, CalendarPickerEdgeAlignTest::CreateNativeNodeDefault, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"calendarPickerTextStyleTest", nullptr, CalendarPickerTextStyleTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textCopyOptionTest", nullptr, TextCopyOptionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customDialogOpenTest", nullptr, CustomDialogOpenTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"calendarPickerOnChangeTest", nullptr, CalendarPickerOnChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"datePickerLunarTest", nullptr, DatePickerLunarTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textPickerRangeTest", nullptr, TextPickerRangeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textPickerSelectedTest", nullptr, TextPickerSelectedTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textPickerValueTest", nullptr, TextPickerValueTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textPickerDisappearTextStyleTest", nullptr, TextPickerDisappearTextStyleTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textPickerTextStyleTest", nullptr, TextPickerTextStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textPickerSelectedTextStyleTest", nullptr, TextPickerSelectedTextStyleTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textPickerSelectedIndexTest", nullptr, TextPickerSelectedIndexTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textPickerCanLoopTest", nullptr, TextPickerCanLoopTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textPickerDefaultPickerItemHeightTest", nullptr, TextPickerDefaultPickerItemHeightTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerOnChangeTest", nullptr, TextPickerOnChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"xComponentSourceIdTest", nullptr, XComponentSourceIdTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"xComponentTypeTest", nullptr, XComponentTypeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customDialogCloseTest", nullptr, CustomDialogCloseTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textLineBreakStrategyTest", nullptr, TextLineBreakStrategyTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAlignRulesTest", nullptr, TextAlignRulesTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"timePickerUseMilitaryTimeTest", nullptr, TimePickerUseMilitaryTimeTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customDialogAlignmentTopStartTest", nullptr, CustomDialogAlignmentTest::CreateNativeNodeTopStart, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customDialogAlignmentTopTest", nullptr, CustomDialogAlignmentTest::CreateNativeNodeTop, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customDialogAlignmentTopEndTest", nullptr, CustomDialogAlignmentTest::CreateNativeNodeTopEnd, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customDialogAlignmentStartTest", nullptr, CustomDialogAlignmentTest::CreateNativeNodeStart, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customDialogAlignmentCenterTest", nullptr, CustomDialogAlignmentTest::CreateNativeNodeCenter, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customDialogAlignmentEndTest", nullptr, CustomDialogAlignmentTest::CreateNativeNodeEnd, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customDialogAlignmentBottomStartTest", nullptr, CustomDialogAlignmentTest::CreateNativeNodeBottomStart, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customDialogAlignmentBottomTest", nullptr, CustomDialogAlignmentTest::CreateNativeNodeBottom, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customDialogAlignmentBottomEndTest", nullptr, CustomDialogAlignmentTest::CreateNativeNodeBottomEnd, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customDialogAlignmentAbnormalTest", nullptr, CustomDialogAlignmentTest::CreateNativeNodeAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customDialogCustomStyleTest", nullptr, CustomDialogCustomStyleTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customDialogMaskColorTest", nullptr, CustomDialogMaskColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"datePickerOnDateChangeTest", nullptr, DatePickerOnDateChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"datePickerStartTest", nullptr, DatePickerStartTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"datePickerEndTest", nullptr, DatePickerEndTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"datePickerSelectedTest", nullptr, DatePickerSelectedTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"datePickerSelectedTextStyleTest", nullptr, DatePickerSelectedTextStyleTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"datePickerDisappearTextStyleTest", nullptr, DatePickerDisappearTextStyleTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"datePickerTextStyleTest", nullptr, DatePickerTextStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"timePickerOnChangeTest", nullptr, TimePickerOnChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"timePickerHeightTest", nullptr, TimePickerHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"timePickerSelectedTest", nullptr, TimePickerSelectedTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"timePickerSelectedTextStyleTest", nullptr, TimePickerSelectedTextStyleTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"timePickerDisappearTextStyleTest", nullptr, TimePickerDisappearTextStyleTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"timePickerTextStyleTest", nullptr, TimePickerTextStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentWidthTest", nullptr, CustomComponentWidthTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentHeightTest", nullptr, CustomComponentHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentBackgroundColorTest", nullptr, CustomComponentBackgroundColorTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentPositionTest", nullptr, CustomComponentPositionTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentBorderWidthTest", nullptr, CustomComponentBorderWidthTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentBorderColorTest", nullptr, CustomComponentBorderColorTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentBorderRadiusTest", nullptr, CustomComponentBorderRadiusTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentBorderStyleTest", nullptr, CustomComponentBorderStyleTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentAlignTest", nullptr, CustomComponentAlignTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentDirectionTest", nullptr, CustomComponentDirectionTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentEnabledTest", nullptr, CustomComponentEnabledTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentFocusableTest", nullptr, CustomComponentFocusableTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentOnAppearTest", nullptr, CustomComponentOnAppearTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentOnAreaChangeTest", nullptr, CustomComponentOnAreaChangeTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentOnTouchTest", nullptr, CustomComponentOnTouchTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentOnBlurTest", nullptr, CustomComponentOnBlurTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentOnFocusTest", nullptr, CustomComponentOnFocusTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentOnClickTest", nullptr, CustomComponentOnClickTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentRadialGradientTest", nullptr, CustomComponentRadialGradientTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentSweepGradientTest", nullptr, CustomComponentSweepGradientTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentGrayscaleTest", nullptr, CustomComponentGrayscaleTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentHitTestBehaviorTest", nullptr, CustomComponentHitTestBehaviorTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentIdTest", nullptr, CustomComponentIdTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentOpacityTest", nullptr, CustomComponentOpacityTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentInvertTest", nullptr, CustomComponentInvertTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentContrastTest", nullptr, CustomComponentContrastTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentSepiaTest", nullptr, CustomComponentSepiaTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentClipCircleTest", nullptr, CustomComponentClipTest::CreateNativeNodeCircle, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentClipEllipseTest", nullptr, CustomComponentClipTest::CreateNativeNodeEllipse, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentClipPathTest", nullptr, CustomComponentClipTest::CreateNativeNodePath, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentClipRectangleTest", nullptr, CustomComponentClipTest::CreateNativeNodeRectangle, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentLinearGradientLeftTest", nullptr, CustomComponentLinearGradientTest::CreateNativeNodeLeft, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentLinearGradientTopTest", nullptr, CustomComponentLinearGradientTest::CreateNativeNodeTop, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentLinearGradientRightTest", nullptr, CustomComponentLinearGradientTest::CreateNativeNodeRight, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentLinearGradientBottomTest", nullptr, CustomComponentLinearGradientTest::CreateNativeNodeBottom, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentLinearGradientLeftTopTest", nullptr, + CustomComponentLinearGradientTest::CreateNativeNodeLeftTop, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentLinearGradientLeftBottomTest", nullptr, + CustomComponentLinearGradientTest::CreateNativeNodeLeftBottom, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentLinearGradientRightTopTest", nullptr, + CustomComponentLinearGradientTest::CreateNativeNodeRightTop, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentLinearGradientRightBottomTest", nullptr, + CustomComponentLinearGradientTest::CreateNativeNodeRightBottom, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentLinearGradientNoneTest", nullptr, CustomComponentLinearGradientTest::CreateNativeNodeNone, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentLinearGradientCustomTest", nullptr, CustomComponentLinearGradientTest::CreateNativeNodeCustom, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentLinearGradientLowerBoundAbnormalTest", nullptr, + CustomComponentLinearGradientTest::CreateNativeNodeLowerBoundAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentLinearGradientIllegalColorAbnormalTest", nullptr, + CustomComponentLinearGradientTest::CreateNativeNodeIllegalColorAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentScaleReduceXYTest", nullptr, CustomComponentScaleTest::CreateNativeNodeReduceXY, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentScaleReduceXTest", nullptr, CustomComponentScaleTest::CreateNativeNodeReduceX, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentScaleEnlargeXYTest", nullptr, CustomComponentScaleTest::CreateNativeNodeEnlargeXY, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentScaleEnlargeXTest", nullptr, CustomComponentScaleTest::CreateNativeNodeEnlargeX, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentScaleAbnormalTest", nullptr, CustomComponentScaleTest::CreateNativeNodeAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentShadowUltraSmallShadowTest", nullptr, + CustomComponentShadowTest::CreateNativeNodeUltraSmallShadow, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentShadowSmallShadowTest", nullptr, CustomComponentShadowTest::CreateNativeNodeSmallShadow, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentShadowMiddleShadowTest", nullptr, CustomComponentShadowTest::CreateNativeNodeMiddleShadow, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentShadowLargeShadowTest", nullptr, CustomComponentShadowTest::CreateNativeNodeLargeShadow, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentShadowFloatingShadowTest", nullptr, CustomComponentShadowTest::CreateNativeNodeFloatingShadow, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentShadowFloatingSmallShadowTest", nullptr, + CustomComponentShadowTest::CreateNativeNodeFloatingSmallShadow, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentShadowLowerBoundAbnormalTest", nullptr, + CustomComponentShadowTest::CreateNativeNodeLowerBoundAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentShadowUpperBoundAbnormalTest", nullptr, + CustomComponentShadowTest::CreateNativeNodeUpperBoundAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentMarginUnifiedTest", nullptr, CustomComponentMarginTest::CreateNativeNodeUnified, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentMarginRespectivelyTest", nullptr, CustomComponentMarginTest::CreateNativeNodeRespectively, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentMarginUnifiedNegativeTest", nullptr, + CustomComponentMarginTest::CreateNativeNodeUnifiedNegative, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentMarginRespectivelyNegativeTest", nullptr, + CustomComponentMarginTest::CreateNativeNodeRespectivelyNegative, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentConstraintSizeMaxSetMinTest", nullptr, + CustomComponentConstraintSizeTest::CreateNativeNodeMaxSetMin, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentConstraintSizeMaxMinSetTest", nullptr, + CustomComponentConstraintSizeTest::CreateNativeNodeMaxMinSet, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentConstraintSizeSetMaxMinTest", nullptr, + CustomComponentConstraintSizeTest::CreateNativeNodeSetMaxMin, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentConstraintSizeMinSetMaxTest", nullptr, + CustomComponentConstraintSizeTest::CreateNativeNodeMinSetMax, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentConstraintSizeMinMaxSetTest", nullptr, + CustomComponentConstraintSizeTest::CreateNativeNodeMinMaxSet, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentConstraintSizeSetMinMaxTest", nullptr, + CustomComponentConstraintSizeTest::CreateNativeNodeSetMinMax, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentTransformTest", nullptr, CustomComponentTransformTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentTransformAbnormalTest", nullptr, CustomComponentTransformTest::CreateNativeNodeAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentMaskTest", nullptr, CustomComponentMaskTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"customComponentMaskAbnormalTest", nullptr, CustomComponentMaskTest::CreateNativeNodeAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentBlendModeTest", nullptr, CustomComponentBlendModeTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentFlexBasisColumnTest", nullptr, CustomComponentFlexBasisTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexBasisFlexColumnReverseTest", nullptr, CustomComponentFlexBasisTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexBasisFlexColumnTest", nullptr, CustomComponentFlexBasisTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexBasisFlexRowReverseTest", nullptr, CustomComponentFlexBasisTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexBasisFlexRowTest", nullptr, CustomComponentFlexBasisTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexBasisRowTest", nullptr, CustomComponentFlexBasisTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentFlexShrinkColumnTest", nullptr, CustomComponentFlexShrinkTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexShrinkFlexColumnReverseTest", nullptr, CustomComponentFlexShrinkTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexShrinkFlexColumnTest", nullptr, CustomComponentFlexShrinkTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexShrinkFlexRowReverseTest", nullptr, CustomComponentFlexShrinkTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexShrinkFlexRowTest", nullptr, CustomComponentFlexShrinkTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexShrinkRowTest", nullptr, CustomComponentFlexShrinkTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentFlexGrowFlexRowTest", nullptr, CustomComponentFlexGrowTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentFlexGrowFlexRowReverseTest", nullptr, CustomComponentFlexGrowTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexGrowFlexColumnTest", nullptr, CustomComponentFlexGrowTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexGrowFlexColumnReverseTest", nullptr, CustomComponentFlexGrowTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentFlexGrowColumnTest", nullptr, CustomComponentFlexGrowTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentFlexGrowRowTest", nullptr, CustomComponentFlexGrowTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentAlignSelfTest", nullptr, CustomComponentAlignSelfTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentAlignSelfChangeTypeTest", nullptr, CustomComponentAlignSelfTest::ChangeType, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"customComponentAccessibilityGroupTrueTest", nullptr, + CustomComponentAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentAccessibilityGroupFalseTest", nullptr, + CustomComponentAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentAccessibilityTextTest", nullptr, CustomComponentAccessibilityTextTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentAccessibilityTextNullTest", nullptr, + CustomComponentAccessibilityTextTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentAccessibilityLevelAutoTest", nullptr, + CustomComponentAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"customComponentAccessibilityLevelDescendantsTest", nullptr, + CustomComponentAccessibilityLevelTest::CreateNativeNodeDescendants, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentAccessibilityLevelDisabledTest", nullptr, + CustomComponentAccessibilityLevelTest::CreateNativeNodeDisabled, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentAccessibilityLevelEnabledTest", nullptr, + CustomComponentAccessibilityLevelTest::CreateNativeNodeEnabled, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentAccessibilityDescriptionTest", nullptr, + CustomComponentAccessibilityDescriptionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentAccessibilityDescriptionNullTest", nullptr, + CustomComponentAccessibilityDescriptionTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"customComponentForegroundBlurStyleTest", nullptr, CustomComponentForegroundBlurStyleTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textInputAccessibilityGroupTrueTest", nullptr, TextInputAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputAccessibilityGroupFalseTest", nullptr, TextInputAccessibilityGroupTest::CreateNativeNodeFalse, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textInputAccessibilityTextTest", nullptr, TextInputAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputAccessibilityTextNullTest", nullptr, TextInputAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputAccessibilityLevelAutoTest", nullptr, TextInputAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputAccessibilityLevelDescendantsTest", nullptr, + TextInputAccessibilityLevelTest::CreateNativeNodeDescendants, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputAccessibilityLevelDisabledTest", nullptr, TextInputAccessibilityLevelTest::CreateNativeNodeDisabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textInputAccessibilityLevelEnabledTest", nullptr, TextInputAccessibilityLevelTest::CreateNativeNodeEnabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textInputAccessibilityDescriptionTest", nullptr, TextInputAccessibilityDescriptionTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textInputAccessibilityDescriptionNullTest", nullptr, + TextInputAccessibilityDescriptionTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAreaAccessibilityGroupTrueTest", nullptr, TextAreaAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaAccessibilityGroupFalseTest", nullptr, TextAreaAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaAccessibilityTextTest", nullptr, TextAreaAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaAccessibilityTextNullTest", nullptr, TextAreaAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaAccessibilityLevelAutoTest", nullptr, TextAreaAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaAccessibilityLevelDescendantsTest", nullptr, + TextAreaAccessibilityLevelTest::CreateNativeNodeDescendants, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAreaAccessibilityLevelDisabledTest", nullptr, TextAreaAccessibilityLevelTest::CreateNativeNodeDisabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAreaAccessibilityLevelEnabledTest", nullptr, TextAreaAccessibilityLevelTest::CreateNativeNodeEnabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAreaAccessibilityDescriptionTest", nullptr, TextAreaAccessibilityDescriptionTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAreaAccessibilityDescriptionNullTest", nullptr, + TextAreaAccessibilityDescriptionTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"swiperAccessibilityGroupTrueTest", nullptr, SwiperAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"swiperAccessibilityGroupFalseTest", nullptr, SwiperAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"swiperAccessibilityTextTest", nullptr, SwiperAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"swiperAccessibilityTextNullTest", nullptr, SwiperAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"swiperAccessibilityLevelAutoTest", nullptr, SwiperAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"swiperAccessibilityLevelDescendantsTest", nullptr, SwiperAccessibilityLevelTest::CreateNativeNodeDescendants, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"swiperAccessibilityLevelDisabledTest", nullptr, SwiperAccessibilityLevelTest::CreateNativeNodeDisabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"swiperAccessibilityLevelEnabledTest", nullptr, SwiperAccessibilityLevelTest::CreateNativeNodeEnabled, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"swiperAccessibilityDescriptionTest", nullptr, SwiperAccessibilityDescriptionTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"swiperAccessibilityDescriptionNullTest", nullptr, SwiperAccessibilityDescriptionTest::CreateNativeNodeNull, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityGroupTrueTest", nullptr, ScrollAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityGroupFalseTest", nullptr, ScrollAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityTextTest", nullptr, ScrollAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollAccessibilityTextNullTest", nullptr, ScrollAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityLevelAutoTest", nullptr, ScrollAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityLevelDescendantsTest", nullptr, ScrollAccessibilityLevelTest::CreateNativeNodeDescendants, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityLevelDisabledTest", nullptr, ScrollAccessibilityLevelTest::CreateNativeNodeDisabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityLevelEnabledTest", nullptr, ScrollAccessibilityLevelTest::CreateNativeNodeEnabled, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityDescriptionTest", nullptr, ScrollAccessibilityDescriptionTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityDescriptionNullTest", nullptr, ScrollAccessibilityDescriptionTest::CreateNativeNodeNull, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listAccessibilityGroupTrueTest", nullptr, ListAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listAccessibilityGroupFalseTest", nullptr, ListAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listAccessibilityTextTest", nullptr, ListAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listAccessibilityTextNullTest", nullptr, ListAccessibilityTextTest::CreateNativeNodeNull, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listAccessibilityLevelAutoTest", nullptr, ListAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listAccessibilityLevelDescendantsTest", nullptr, ListAccessibilityLevelTest::CreateNativeNodeDescendants, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listAccessibilityLevelDisabledTest", nullptr, ListAccessibilityLevelTest::CreateNativeNodeDisabled, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listAccessibilityLevelEnabledTest", nullptr, ListAccessibilityLevelTest::CreateNativeNodeEnabled, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listAccessibilityDescriptionTest", nullptr, ListAccessibilityDescriptionTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listAccessibilityDescriptionNullTest", nullptr, ListAccessibilityDescriptionTest::CreateNativeNodeNull, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityGroupTrueTest", nullptr, ToggleAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityGroupFalseTest", nullptr, ToggleAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityTextTest", nullptr, ToggleAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"toggleAccessibilityTextNullTest", nullptr, ToggleAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityLevelAutoTest", nullptr, ToggleAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityLevelDescendantsTest", nullptr, ToggleAccessibilityLevelTest::CreateNativeNodeDescendants, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityLevelDisabledTest", nullptr, ToggleAccessibilityLevelTest::CreateNativeNodeDisabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityLevelEnabledTest", nullptr, ToggleAccessibilityLevelTest::CreateNativeNodeEnabled, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityDescriptionTest", nullptr, ToggleAccessibilityDescriptionTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityDescriptionNullTest", nullptr, ToggleAccessibilityDescriptionTest::CreateNativeNodeNull, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAccessibilityGroupTrueTest", nullptr, TextAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAccessibilityGroupFalseTest", nullptr, TextAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAccessibilityTextTest", nullptr, TextAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAccessibilityTextNullTest", nullptr, TextAccessibilityTextTest::CreateNativeNodeNull, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAccessibilityLevelAutoTest", nullptr, TextAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAccessibilityLevelDescendantsTest", nullptr, TextAccessibilityLevelTest::CreateNativeNodeDescendants, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAccessibilityLevelDisabledTest", nullptr, TextAccessibilityLevelTest::CreateNativeNodeDisabled, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAccessibilityLevelEnabledTest", nullptr, TextAccessibilityLevelTest::CreateNativeNodeEnabled, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAccessibilityDescriptionTest", nullptr, TextAccessibilityDescriptionTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAccessibilityDescriptionNullTest", nullptr, TextAccessibilityDescriptionTest::CreateNativeNodeNull, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"refreshAccessibilityGroupTrueTest", nullptr, RefreshAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"refreshAccessibilityGroupFalseTest", nullptr, RefreshAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"refreshAccessibilityTextTest", nullptr, RefreshAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"refreshAccessibilityTextNullTest", nullptr, RefreshAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"refreshAccessibilityLevelAutoTest", nullptr, RefreshAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"refreshAccessibilityLevelDescendantsTest", nullptr, + RefreshAccessibilityLevelTest::CreateNativeNodeDescendants, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"refreshAccessibilityLevelDisabledTest", nullptr, RefreshAccessibilityLevelTest::CreateNativeNodeDisabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"refreshAccessibilityLevelEnabledTest", nullptr, RefreshAccessibilityLevelTest::CreateNativeNodeEnabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"refreshAccessibilityDescriptionTest", nullptr, RefreshAccessibilityDescriptionTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"refreshAccessibilityDescriptionNullTest", nullptr, RefreshAccessibilityDescriptionTest::CreateNativeNodeNull, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"datePickerAccessibilityGroupTrueTest", nullptr, DatePickerAccessibilityGroupTest::CreateNativeNodeTrue, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"datePickerAccessibilityGroupFalseTest", nullptr, DatePickerAccessibilityGroupTest::CreateNativeNodeFalse, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"datePickerAccessibilityTextTest", nullptr, DatePickerAccessibilityTextTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"datePickerAccessibilityTextNullTest", nullptr, DatePickerAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"datePickerAccessibilityLevelAutoTest", nullptr, DatePickerAccessibilityLevelTest::CreateNativeNodeAuto, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"datePickerAccessibilityLevelDescendantsTest", nullptr, + DatePickerAccessibilityLevelTest::CreateNativeNodeDescendants, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"datePickerAccessibilityLevelDisabledTest", nullptr, + DatePickerAccessibilityLevelTest::CreateNativeNodeDisabled, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"datePickerAccessibilityLevelEnabledTest", nullptr, DatePickerAccessibilityLevelTest::CreateNativeNodeEnabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"datePickerAccessibilityDescriptionTest", nullptr, DatePickerAccessibilityDescriptionTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"datePickerAccessibilityDescriptionNullTest", nullptr, + DatePickerAccessibilityDescriptionTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"timePickerAccessibilityGroupTrueTest", nullptr, TimePickerAccessibilityGroupTest::CreateNativeNodeTrue, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerAccessibilityGroupFalseTest", nullptr, TimePickerAccessibilityGroupTest::CreateNativeNodeFalse, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerAccessibilityTextTest", nullptr, TimePickerAccessibilityTextTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"timePickerAccessibilityTextNullTest", nullptr, TimePickerAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"timePickerAccessibilityLevelAutoTest", nullptr, TimePickerAccessibilityLevelTest::CreateNativeNodeAuto, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerAccessibilityLevelDescendantsTest", nullptr, + TimePickerAccessibilityLevelTest::CreateNativeNodeDescendants, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"timePickerAccessibilityLevelDisabledTest", nullptr, + TimePickerAccessibilityLevelTest::CreateNativeNodeDisabled, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerAccessibilityLevelEnabledTest", nullptr, TimePickerAccessibilityLevelTest::CreateNativeNodeEnabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerAccessibilityDescriptionTest", nullptr, TimePickerAccessibilityDescriptionTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerAccessibilityDescriptionNullTest", nullptr, + TimePickerAccessibilityDescriptionTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderAccessibilityGroupTrueTest", nullptr, SliderAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"sliderAccessibilityGroupFalseTest", nullptr, SliderAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"sliderAccessibilityTextTest", nullptr, SliderAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"sliderAccessibilityTextNullTest", nullptr, SliderAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"sliderAccessibilityLevelAutoTest", nullptr, SliderAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"sliderAccessibilityLevelDescendantsTest", nullptr, SliderAccessibilityLevelTest::CreateNativeNodeDescendants, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"sliderAccessibilityLevelDisabledTest", nullptr, SliderAccessibilityLevelTest::CreateNativeNodeDisabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"sliderAccessibilityLevelEnabledTest", nullptr, SliderAccessibilityLevelTest::CreateNativeNodeEnabled, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"sliderAccessibilityDescriptionTest", nullptr, SliderAccessibilityDescriptionTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"sliderAccessibilityDescriptionNullTest", nullptr, SliderAccessibilityDescriptionTest::CreateNativeNodeNull, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityGroupTrueTest", nullptr, ButtonAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityGroupFalseTest", nullptr, ButtonAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityTextTest", nullptr, ButtonAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"buttonAccessibilityTextNullTest", nullptr, ButtonAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityLevelAutoTest", nullptr, ButtonAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityLevelDescendantsTest", nullptr, ButtonAccessibilityLevelTest::CreateNativeNodeDescendants, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityLevelDisabledTest", nullptr, ButtonAccessibilityLevelTest::CreateNativeNodeDisabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityLevelEnabledTest", nullptr, ButtonAccessibilityLevelTest::CreateNativeNodeEnabled, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityDescriptionTest", nullptr, ButtonAccessibilityDescriptionTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityDescriptionNullTest", nullptr, ButtonAccessibilityDescriptionTest::CreateNativeNodeNull, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerAccessibilityGroupTrueTest", nullptr, TextPickerAccessibilityGroupTest::CreateNativeNodeTrue, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerAccessibilityGroupFalseTest", nullptr, TextPickerAccessibilityGroupTest::CreateNativeNodeFalse, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerAccessibilityTextTest", nullptr, TextPickerAccessibilityTextTest::CreateNativeNode, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textPickerAccessibilityTextNullTest", nullptr, TextPickerAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textPickerAccessibilityLevelAutoTest", nullptr, TextPickerAccessibilityLevelTest::CreateNativeNodeAuto, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerAccessibilityLevelDescendantsTest", nullptr, + TextPickerAccessibilityLevelTest::CreateNativeNodeDescendants, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textPickerAccessibilityLevelDisabledTest", nullptr, + TextPickerAccessibilityLevelTest::CreateNativeNodeDisabled, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerAccessibilityLevelEnabledTest", nullptr, TextPickerAccessibilityLevelTest::CreateNativeNodeEnabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerAccessibilityDescriptionTest", nullptr, TextPickerAccessibilityDescriptionTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerAccessibilityDescriptionNullTest", nullptr, + TextPickerAccessibilityDescriptionTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"checkboxAccessibilityGroupTrueTest", nullptr, CheckboxAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"checkboxAccessibilityGroupFalseTest", nullptr, CheckboxAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"checkboxAccessibilityTextTest", nullptr, CheckboxAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"checkboxAccessibilityTextNullTest", nullptr, CheckboxAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"checkboxAccessibilityLevelAutoTest", nullptr, CheckboxAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"checkboxAccessibilityLevelDescendantsTest", nullptr, + CheckboxAccessibilityLevelTest::CreateNativeNodeDescendants, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"checkboxAccessibilityLevelDisabledTest", nullptr, CheckboxAccessibilityLevelTest::CreateNativeNodeDisabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"checkboxAccessibilityLevelEnabledTest", nullptr, CheckboxAccessibilityLevelTest::CreateNativeNodeEnabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"checkboxAccessibilityDescriptionTest", nullptr, CheckboxAccessibilityDescriptionTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"checkboxAccessibilityDescriptionNullTest", nullptr, + CheckboxAccessibilityDescriptionTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"progressAccessibilityGroupTrueTest", nullptr, ProgressAccessibilityGroupTest::CreateNativeNodeTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"progressAccessibilityGroupFalseTest", nullptr, ProgressAccessibilityGroupTest::CreateNativeNodeFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"progressAccessibilityTextTest", nullptr, ProgressAccessibilityTextTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"progressAccessibilityTextNullTest", nullptr, ProgressAccessibilityTextTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"progressAccessibilityLevelAutoTest", nullptr, ProgressAccessibilityLevelTest::CreateNativeNodeAuto, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"progressAccessibilityLevelDescendantsTest", nullptr, + ProgressAccessibilityLevelTest::CreateNativeNodeDescendants, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"progressAccessibilityLevelDisabledTest", nullptr, ProgressAccessibilityLevelTest::CreateNativeNodeDisabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"progressAccessibilityLevelEnabledTest", nullptr, ProgressAccessibilityLevelTest::CreateNativeNodeEnabled, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"progressAccessibilityDescriptionTest", nullptr, ProgressAccessibilityDescriptionTest::CreateNativeNode, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"progressAccessibilityDescriptionNullTest", nullptr, + ProgressAccessibilityDescriptionTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textInputAccessibilityLevelUpperAbnormalTest", nullptr, + TextInputAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputAccessibilityLevelLowerAbnormalTest", nullptr, + TextInputAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textAreaAccessibilityLevelUpperAbnormalTest", nullptr, + TextAreaAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textAreaAccessibilityLevelLowerAbnormalTest", nullptr, + TextAreaAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperAccessibilityLevelUpperAbnormalTest", nullptr, + SwiperAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"swiperAccessibilityLevelLowerAbnormalTest", nullptr, + SwiperAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityLevelUpperAbnormalTest", nullptr, + ScrollAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"scrollAccessibilityLevelLowerAbnormalTest", nullptr, + ScrollAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listAccessibilityLevelUpperAbnormalTest", nullptr, ListAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listAccessibilityLevelLowerAbnormalTest", nullptr, ListAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityLevelUpperAbnormalTest", nullptr, + ToggleAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"toggleAccessibilityLevelLowerAbnormalTest", nullptr, + ToggleAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAccessibilityLevelUpperAbnormalTest", nullptr, TextAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAccessibilityLevelLowerAbnormalTest", nullptr, TextAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"refreshAccessibilityLevelUpperAbnormalTest", nullptr, + RefreshAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"refreshAccessibilityLevelLowerAbnormalTest", nullptr, + RefreshAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"datePickerAccessibilityLevelUpperAbnormalTest", nullptr, + DatePickerAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"datePickerAccessibilityLevelLowerAbnormalTest", nullptr, + DatePickerAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"timePickerAccessibilityLevelUpperAbnormalTest", nullptr, + TimePickerAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"timePickerAccessibilityLevelLowerAbnormalTest", nullptr, + TimePickerAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderAccessibilityLevelUpperAbnormalTest", nullptr, + SliderAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"sliderAccessibilityLevelLowerAbnormalTest", nullptr, + SliderAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityLevelUpperAbnormalTest", nullptr, + ButtonAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"buttonAccessibilityLevelLowerAbnormalTest", nullptr, + ButtonAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerAccessibilityLevelUpperAbnormalTest", nullptr, + TextPickerAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textPickerAccessibilityLevelLowerAbnormalTest", nullptr, + TextPickerAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"checkboxAccessibilityLevelUpperAbnormalTest", nullptr, + CheckboxAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"checkboxAccessibilityLevelLowerAbnormalTest", nullptr, + CheckboxAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"progressAccessibilityLevelUpperAbnormalTest", nullptr, + ProgressAccessibilityLevelTest::CreateNativeNodeUpperAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"progressAccessibilityLevelLowerAbnormalTest", nullptr, + ProgressAccessibilityLevelTest::CreateNativeNodeLowerAbnormal, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputBackgroundColorTest", nullptr, TextInputBackgroundColorTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputBackgroundImageTest", nullptr, TextInputBackgroundImageTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputClipTest", nullptr, TextInputClipTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputFontColorTest", nullptr, TextInputFontColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputCaretColorTest", nullptr, TextInputCaretColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputFontSizeTest", nullptr, TextInputFontSizeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputFontStyleTest", nullptr, TextInputFontStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputFontWeightTest", nullptr, TextInputFontWeightTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputPaddingTest", nullptr, TextInputPaddingTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputShowUnderLineTest", nullptr, TextInputShowUnderlineTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputTextAlignTest", nullptr, TextInputTextAlignTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputOnFocusTest", nullptr, TextInputOnFocusTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputOnBlurTest", nullptr, TextInputOnBlurTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputOnSubmitTest", nullptr, TextInputOnSubmitTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputOnCutTest", nullptr, TextInputOnCutTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputOnPasteTest", nullptr, TextInputOnPasteTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputDefaultFocusFalseTest", nullptr, TextInputDefaultFocusTest::CreateNativeNodeFalse, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputDefaultFocusTrueTest", nullptr, TextInputDefaultFocusTest::CreateNativeNodeTrue, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputDefaultFocusNoneTest", nullptr, TextInputDefaultFocusTest::CreateNativeNodeNone, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputDefaultFocusSingleTest", nullptr, TextInputDefaultFocusTest::CreateNativeNodeSingle, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputDefaultFocusMultiTest", nullptr, TextInputDefaultFocusTest::CreateNativeNodeMulti, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"sliderBlockColorTest", nullptr, SliderBlockColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderBlockStyleTest", nullptr, SliderBlockStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderBlockStyleAbnormalTest", nullptr, SliderBlockStyleTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"sliderDirectionTest", nullptr, SliderDirectionTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderDirectionAbnormalTest", nullptr, SliderDirectionTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"sliderValueTest", nullptr, SliderValueTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderValueAbnormalTest", nullptr, SliderValueTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderValueLargeTest", nullptr, SliderValueTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderMinTest", nullptr, SliderMinTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"sliderMinAbnormalTest", nullptr, SliderMinTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderMinLargeTest", nullptr, SliderMinTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderMaxTest", nullptr, SliderMaxTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"sliderMaxAbnormalTest", nullptr, SliderMaxTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderMaxLargeTest", nullptr, SliderMaxTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderReverseTest", nullptr, SliderReverseTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderReverseAbnormalTest", nullptr, SliderReverseTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderReverseLargeTest", nullptr, SliderReverseTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderSelectedColorTest", nullptr, SliderSelectedColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderShowStepsTest", nullptr, SliderShowStepsTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderShowStepsAbnormalTest", nullptr, SliderShowStepsTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"sliderStepTest", nullptr, SliderStepTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"sliderStepAbnormalTest", nullptr, SliderStepTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderStepLargeTest", nullptr, SliderStepTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderStyleTest", nullptr, SliderStyleTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"sliderStyleAbnormalTest", nullptr, SliderStyleTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderStyleLargeTest", nullptr, SliderStyleTest::CreateNativeNodeLarge, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderTrackColorTest", nullptr, SliderTrackColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderOnChangeTest", nullptr, SliderOnChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputStopEditingTrueTest", nullptr, TextInputStopEditingTest::CreateNativeNodeTrue, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputStopEditingFalseTest", nullptr, TextInputStopEditingTest::CreateNativeNodeFalse, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputStopEditingNoneFalseTest", nullptr, TextInputStopEditingTest::CreateNativeNodeNoneFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputStopEditingNoneTrueTest", nullptr, TextInputStopEditingTest::CreateNativeNodeNoneTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputStopEditingChangeType", nullptr, TextInputStopEditingTest::ChangeType, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputLineHeightTest", nullptr, TextInputLineHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputLineHeightAbnormalTest", nullptr, TextInputLineHeightTest::CreateNativeNodeAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaOnBlurTest", nullptr, TextAreaOnBlurTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textAreaFontColorTest", nullptr, TextAreaFontColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaFontColorBlackTest", nullptr, TextAreaFontColorTest::CreateNativeNodeBlack, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaFontColorWhiteTest", nullptr, TextAreaFontColorTest::CreateNativeNodeWhite, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaFontSizeTest", nullptr, TextAreaFontSizeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaFontSizeNoneTest", nullptr, TextAreaFontSizeTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaFontSizeAbnormalTest", nullptr, TextAreaFontSizeTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaFontStyleNormalTest", nullptr, TextAreaFontStyleTest::CreateNativeNodeNormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaFontStyleItalicTest", nullptr, TextAreaFontStyleTest::CreateNativeNodeItalic, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaFontFamilyTest", nullptr, TextAreaFontFamilyTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaFontFamilyNoneTest", nullptr, TextAreaFontFamilyTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaFontWeightTest", nullptr, TextAreaFontWeightTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaFontWeightChangeTypeTest", nullptr, TextAreaFontWeightTest::ChangeType, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaMaxLengthTest", nullptr, TextAreaMaxLengthTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaMaxLengthNoneTest", nullptr, TextAreaMaxLengthTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaMaxLengthAbnormalTest", nullptr, TextAreaMaxLengthTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaPlaceHolderColorTest", nullptr, TextAreaPlaceHolderColorTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaPlaceHolderColorBlackTest", nullptr, TextAreaPlaceHolderColorTest::CreateNativeNodeBlack, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaPlaceHolderColorWhiteTest", nullptr, TextAreaPlaceHolderColorTest::CreateNativeNodeWhite, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaPlaceholderFontTest", nullptr, TextAreaPlaceholderFontTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaPlaceholderFontChangeTypeTest", nullptr, TextAreaPlaceholderFontTest::ChangeType, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaTextAlignStartTest", nullptr, TextAreaTextAlignTest::CreateNativeNodeStart, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaTextAlignCenterTest", nullptr, TextAreaTextAlignTest::CreateNativeNodeCenter, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaTextAlignEndTest", nullptr, TextAreaTextAlignTest::CreateNativeNodeEnd, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaTextAlignJustifyTest", nullptr, TextAreaTextAlignTest::CreateNativeNodeJustify, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaTextAlignAbnormalTest", nullptr, TextAreaTextAlignTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaPaddingTest", nullptr, TextAreaPaddingTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textAreaPaddingAllTest", nullptr, TextAreaPaddingTest::CreateNativeNodeAll, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaBackgroundColorTest", nullptr, TextAreaBackgroundColorTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaBackgroundColorBlackTest", nullptr, TextAreaBackgroundColorTest::CreateNativeNodeBlack, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaBackgroundColorWhiteTest", nullptr, TextAreaBackgroundColorTest::CreateNativeNodeWhite, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaBorderRadiusSingleTest", nullptr, TextAreaBorderRadiusTest::CreateNativeNodeSingle, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaBorderRadiusAbnormalTest", nullptr, TextAreaBorderRadiusTest::CreateNativeNodeAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaBorderRadiusAllParamTest", nullptr, TextAreaBorderRadiusTest::CreateNativeNodeAllParam, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaCaretColorTest", nullptr, TextAreaCaretColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaCaretColorBlackTest", nullptr, TextAreaCaretColorTest::CreateNativeNodeBlack, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaCaretColorWhiteTest", nullptr, TextAreaCaretColorTest::CreateNativeNodeWhite, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputClearButtonModeAbnormalTest", nullptr, TextInputClearButtonModeTest::CreateNativeNodeAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textInputClearButtonModeConstantTest", nullptr, TextInputClearButtonModeTest::CreateNativeNodeConstant, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textAreaLineHeightTest", nullptr, TextAreaLineHeightTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaLineHeightNoneTest", nullptr, TextAreaLineHeightTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaStopEditingTrueTest", nullptr, TextAreaStopEditingTest::CreateNativeNodeTrue, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaStopEditingFalseTest", nullptr, TextAreaStopEditingTest::CreateNativeNodeFalse, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaStopEditingNoneFalseTest", nullptr, TextAreaStopEditingTest::CreateNativeNodeNoneFalse, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaStopEditingNoneTrueTest", nullptr, TextAreaStopEditingTest::CreateNativeNodeNoneTrue, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaStopEditingChangeType", nullptr, TextAreaStopEditingTest::ChangeType, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"loadingProgressColorTest", nullptr, LoadingProgressColorTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"loadingProgressColorBlackTest", nullptr, LoadingProgressColorTest::CreateNativeNodeBlack, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"loadingProgressColorWhiteTest", nullptr, LoadingProgressColorTest::CreateNativeNodeWhite, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"loadingProgressEnableLoadingTrueTest", nullptr, LoadingProgressEnableLoadingTest::CreateNativeNodeTrue, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"loadingProgressEnableLoadingFalseTest", nullptr, LoadingProgressEnableLoadingTest::CreateNativeNodeFalse, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"progressBackgroundColorTest", nullptr, ProgressBackgroundColorTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"progressBackgroundColorBlackTest", nullptr, ProgressBackgroundColorTest::CreateNativeNodeBlack, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"progressBackgroundColorWhiteTest", nullptr, ProgressBackgroundColorTest::CreateNativeNodeWhite, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"progressColorTest", nullptr, ProgressColorTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"progressColorBlackTest", nullptr, ProgressColorTest::CreateNativeNodeBlack, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"progressColorWhiteTest", nullptr, ProgressColorTest::CreateNativeNodeWhite, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"progressStyleRingTest", nullptr, ProgressStyleTest::CreateNativeNodeRing, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"progressStyleEclipseTest", nullptr, ProgressStyleTest::CreateNativeNodeEclipse, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"progressStyleLinearTest", nullptr, ProgressStyleTest::CreateNativeNodeLinear, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"progressStyleScaleRingTest", nullptr, ProgressStyleTest::CreateNativeNodeScaleRing, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"progressStyleCapsuleTest", nullptr, ProgressStyleTest::CreateNativeNodeCapsule, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaOnFocusTest", nullptr, TextAreaOnFocusTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"refreshOnStateChangeTest", nullptr, RefreshOnStateChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"refreshOnRefreshingTest", nullptr, RefreshOnRefreshingTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textAreaOnChangeTest", nullptr, TextAreaOnChangeTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputMaxLengthTest", nullptr, TextInputMaxLengthTest::CreateNativeNode, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputMaxLengthNoneTest", nullptr, TextInputMaxLengthTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputMaxLengthAbnormalTest", nullptr, TextInputMaxLengthTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputPlaceholderColorTest", nullptr, TextInputPlaceholderColorTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputPlaceholderColorBlackTest", nullptr, TextInputPlaceholderColorTest::CreateNativeNodeBlack, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputPlaceholderColorWhiteTest", nullptr, TextInputPlaceholderColorTest::CreateNativeNodeWhite, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputPlaceholderFontTest", nullptr, TextInputPlaceholderFontTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputPlaceholderFontChangeTypeTest", nullptr, TextInputPlaceholderFontTest::ChangeType, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputFontFamilySingleTest", nullptr, TextInputFontFamilyTest::CreateNativeNodeSingle, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textInputFontFamilyAddTest", nullptr, TextInputFontFamilyTest::CreateNativeNodeAdd, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputClearButtonModeInputTest", nullptr, TextInputClearButtonModeTest::CreateNativeNodeInput, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputClearButtonModeInvisibleTest", nullptr, TextInputClearButtonModeTest::CreateNativeNodeInvisible, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textInputResponseRegionSingleTest", nullptr, TextInputResponseRegionTest::CreateNativeNodeSingle, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputResponseRegionDoubleTest", nullptr, TextInputResponseRegionTest::CreateNativeNodeDouble, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaResponseRegionSingleTest", nullptr, TextAreaResponseRegionTest::CreateNativeNodeSingle, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaResponseRegionDoubleTest", nullptr, TextAreaResponseRegionTest::CreateNativeNodeDouble, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaDefaultFocusFalseTest", nullptr, TextAreaDefaultFocusTest::CreateNativeNodeFalse, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaDefaultFocusTrueTest", nullptr, TextAreaDefaultFocusTest::CreateNativeNodeTrue, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaDefaultFocusNoneTest", nullptr, TextAreaDefaultFocusTest::CreateNativeNodeNone, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaDefaultFocusSingleTest", nullptr, TextAreaDefaultFocusTest::CreateNativeNodeSingle, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaDefaultFocusMultiTest", nullptr, TextAreaDefaultFocusTest::CreateNativeNodeMulti, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textAreaKeyTest", nullptr, TextAreaKeyTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"textInputKeyTest", nullptr, TextInputKeyTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"listBackgroundColorNullTest", nullptr, ListBackgroundColorTest::CreateNativeNodeNull, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listBackgroundColorUndefinedTest", nullptr, ListBackgroundColorTest::CreateNativeNodeUndefined, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listBorderColorNullTest", nullptr, ListBorderColorTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listBorderColorUndefinedTest", nullptr, ListBorderColorTest::CreateNativeNodeUndefined, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listCachedCountAbnormalTest", nullptr, ListCachedCountTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listEdgeEffectSpringTest", nullptr, ListEdgeEffectTest::CreateNativeNodeSpring, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listEdgeEffectFadeTest", nullptr, ListEdgeEffectTest::CreateNativeNodeFade, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listEdgeEffectNoneTest", nullptr, ListEdgeEffectTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listEdgeEffectLowerBoundAbnormalTest", nullptr, ListEdgeEffectTest::CreateNativeNodeLowerBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listEdgeEffectUpperBoundAbnormalTest", nullptr, ListEdgeEffectTest::CreateNativeNodeUpperBoundAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemEdgeEffectSpringTest", nullptr, ListItemEdgeEffectTest::CreateNativeNodeSpring, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemEdgeEffectFadeTest", nullptr, ListItemEdgeEffectTest::CreateNativeNodeFade, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemEdgeEffectNoneTest", nullptr, ListItemEdgeEffectTest::CreateNativeNodeNone, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"listItemEdgeEffectLowerBoundAbnormalTest", nullptr, + ListItemEdgeEffectTest::CreateNativeNodeLowerBoundAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemEdgeEffectUpperBoundAbnormalTest", nullptr, + ListItemEdgeEffectTest::CreateNativeNodeUpperBoundAbnormal, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemBackgroundColorNullTest", nullptr, ListItemBackgroundColorTest::CreateNativeNodeNull, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"listItemBackgroundColorUndefinedTest", nullptr, ListItemBackgroundColorTest::CreateNativeNodeUndefined, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"listItemBorderColorNullTest", nullptr, ListItemBorderColorTest::CreateNativeNodeNull, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"listItemBorderColorUndefinedTest", nullptr, ListItemBorderColorTest::CreateNativeNodeUndefined, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollBorderColorNullTest", nullptr, ScrollBorderColorTest::CreateNativeNodeNull, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollBorderColorUndefinedTest", nullptr, ScrollBorderColorTest::CreateNativeNodeUndefined, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"sliderMaxEqualMinTest", nullptr, SliderMaxTest::CreateNativeNodeMaxEqualMin, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"sliderStepUnevenTest", nullptr, SliderStepTest::CreateNativeNodeUneven, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"textInputStopEditingAbnormalTest", nullptr, TextInputStopEditingTest::CreateNativeNodeAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputStopEditingNoneAbnormalTest", nullptr, TextInputStopEditingTest::CreateNativeNodeNoneAbnormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textInputDefaultFocusAbnormalTest", nullptr, TextInputDefaultFocusTest::CreateNativeNodeAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaStopEditingAbnormalTest", nullptr, TextAreaStopEditingTest::CreateNativeNodeAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaStopEditingNoneAbnormalTest", nullptr, TextAreaStopEditingTest::CreateNativeNodeNoneAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textAreaDefaultFocusAbnormalTest", nullptr, TextAreaDefaultFocusTest::CreateNativeNodeAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textInputCaretStyleDecimalTest", nullptr, TextInputCaretStyleTest::CreateNativeNode, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"datePickerEndAbnormalTest", nullptr, DatePickerEndTest::CreateNativeNodeAbnormal, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"datePickerSelectedAbnormalTest", nullptr, DatePickerSelectedTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"datePickerStartAbnormalTest", nullptr, DatePickerStartTest::CreateNativeNodeAbnormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textPickerDisappearTextStyleBoldTest", nullptr, TextPickerDisappearTextStyleTest::CreateNativeNodeBold, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerDisappearTextStyleNormalTest", nullptr, TextPickerDisappearTextStyleTest::CreateNativeNodeNormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerDisappearTextStyleBolderTest", nullptr, TextPickerDisappearTextStyleTest::CreateNativeNodeBolder, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerDisappearTextStyleLighterTest", nullptr, TextPickerDisappearTextStyleTest::CreateNativeNodeLighter, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerDisappearTextStyleMediumTest", nullptr, TextPickerDisappearTextStyleTest::CreateNativeNodeMedium, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerDisappearTextStyleRegularTest", nullptr, TextPickerDisappearTextStyleTest::CreateNativeNodeRegular, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerTextStyleBoldTest", nullptr, TextPickerTextStyleTest::CreateNativeNodeBold, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textPickerTextStyleNormalTest", nullptr, TextPickerTextStyleTest::CreateNativeNodeNormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textPickerTextStyleBolderTest", nullptr, TextPickerTextStyleTest::CreateNativeNodeBolder, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textPickerTextStyleLighterTest", nullptr, TextPickerTextStyleTest::CreateNativeNodeLighter, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textPickerTextStyleMediumTest", nullptr, TextPickerTextStyleTest::CreateNativeNodeMedium, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textPickerTextStyleRegularTest", nullptr, TextPickerTextStyleTest::CreateNativeNodeRegular, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"textPickerSelectedTextStyleBoldTest", nullptr, TextPickerSelectedTextStyleTest::CreateNativeNodeBold, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"textPickerSelectedTextStyleNormalTest", nullptr, TextPickerSelectedTextStyleTest::CreateNativeNodeNormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerSelectedTextStyleBolderTest", nullptr, TextPickerSelectedTextStyleTest::CreateNativeNodeBolder, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerSelectedTextStyleLighterTest", nullptr, TextPickerSelectedTextStyleTest::CreateNativeNodeLighter, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerSelectedTextStyleMediumTest", nullptr, TextPickerSelectedTextStyleTest::CreateNativeNodeMedium, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"textPickerSelectedTextStyleRegularTest", nullptr, TextPickerSelectedTextStyleTest::CreateNativeNodeRegular, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerTextStyleBoldTest", nullptr, TimePickerTextStyleTest::CreateNativeNodeBold, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"timePickerTextStyleNormalTest", nullptr, TimePickerTextStyleTest::CreateNativeNodeNormal, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"timePickerTextStyleBolderTest", nullptr, TimePickerTextStyleTest::CreateNativeNodeBolder, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"timePickerTextStyleLighterTest", nullptr, TimePickerTextStyleTest::CreateNativeNodeLighter, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"timePickerTextStyleMediumTest", nullptr, TimePickerTextStyleTest::CreateNativeNodeMedium, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"timePickerTextStyleRegularTest", nullptr, TimePickerTextStyleTest::CreateNativeNodeRegular, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"timePickerSelectedTextStyleBoldTest", nullptr, TimePickerSelectedTextStyleTest::CreateNativeNodeBold, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"timePickerSelectedTextStyleNormalTest", nullptr, TimePickerSelectedTextStyleTest::CreateNativeNodeNormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerSelectedTextStyleBolderTest", nullptr, TimePickerSelectedTextStyleTest::CreateNativeNodeBolder, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerSelectedTextStyleLighterTest", nullptr, TimePickerSelectedTextStyleTest::CreateNativeNodeLighter, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerSelectedTextStyleMediumTest", nullptr, TimePickerSelectedTextStyleTest::CreateNativeNodeMedium, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerSelectedTextStyleRegularTest", nullptr, TimePickerSelectedTextStyleTest::CreateNativeNodeRegular, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerDisappearTextStyleBoldTest", nullptr, TimePickerDisappearTextStyleTest::CreateNativeNodeBold, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerDisappearTextStyleNormalTest", nullptr, TimePickerDisappearTextStyleTest::CreateNativeNodeNormal, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerDisappearTextStyleBolderTest", nullptr, TimePickerDisappearTextStyleTest::CreateNativeNodeBolder, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerDisappearTextStyleLighterTest", nullptr, TimePickerDisappearTextStyleTest::CreateNativeNodeLighter, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerDisappearTextStyleMediumTest", nullptr, TimePickerDisappearTextStyleTest::CreateNativeNodeMedium, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"timePickerDisappearTextStyleRegularTest", nullptr, TimePickerDisappearTextStyleTest::CreateNativeNodeRegular, + nullptr, nullptr, nullptr, napi_default, nullptr}, + {"swiperLoopTest", nullptr, SwiperLoopTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"swiperIntervalTest", nullptr, SwiperIntervalTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperDurationTest", nullptr, SwiperDurationTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"swiperCurveTest", nullptr, SwiperCurveTest::CreateNativeNode, nullptr, nullptr, nullptr, napi_default, + nullptr}, + {"commonAttrsFocusableCombineTest", nullptr, CommonAttrsFocusableTest::CreateNativeNodeCombine, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"toggleFocusableCombineTest", nullptr, ToggleFocusableTest::CreateNativeNodeCombine, nullptr, nullptr, nullptr, + napi_default, nullptr}, + {"scrollScrollBarColorNullTest", nullptr, ScrollScrollBarColorTest::CreateNativeNodeNull, nullptr, nullptr, + nullptr, napi_default, nullptr}, + {"scrollScrollBarColorUndefinedTest", nullptr, ScrollScrollBarColorTest::CreateNativeNodeUndefined, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollScrollSnapLowerAbnormalTest", nullptr, ScrollScrollSnapTest::CreateNativeNodeLowerAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + {"scrollScrollSnapUpperAbnormalTest", nullptr, ScrollScrollSnapTest::CreateNativeNodeUpperAbnormal, nullptr, + nullptr, nullptr, napi_default, nullptr}, + }; + if (napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc) != napi_ok) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Init", "napi_define_properties failed"); + return nullptr; + } + + PluginManager::GetInstance()->Export(env, exports); + return exports; +} +EXTERN_C_END + +static napi_module nativerenderModule = {.nm_version = 1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, + .nm_modname = "nativerender", + .nm_priv = ((void *)0), + .reserved = {0}}; + +extern "C" __attribute__((constructor)) void RegisterModule(void) { napi_module_register(&nativerenderModule); } +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d343d17712f39fb611f7f3bbd9f75c3f8de7824b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_backgroundcolor_test.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "progress_backgroundcolor_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle loadingProgress; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + loadingProgress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(loadingProgress, NODE_HEIGHT, &height_item); +} + +napi_value ProgressBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idLoadingProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idLoadingProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value ProgressBackgroundColorTest::CreateNativeNodeBlack(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idLoadingProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idLoadingProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value ProgressBackgroundColorTest::CreateNativeNodeWhite(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idLoadingProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idLoadingProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..64b6bd8b8ee0f4f9c03ab736ba4be2483132273a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_backgroundcolor_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_PROGRESS_BACKGROUND_TEST_H +#define ARKUI_CAPI_DEMO_PROGRESS_BACKGROUND_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ProgressBackgroundColorTest { +public: + ~ProgressBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlack(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeWhite(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_PROGRESS_BACKGROUND_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_color_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_color_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a8de63d0782c061f00f90d9e080e845ed27c7e2f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_color_test.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "progress_color_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle loadingProgress; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + loadingProgress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(loadingProgress, NODE_HEIGHT, &height_item); +} + +napi_value ProgressColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_PROGRESS_COLOR, &item); + + // 挂载组件 + std::string idProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value ProgressColorTest::CreateNativeNodeBlack(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_PROGRESS_COLOR, &item); + + // 挂载组件 + std::string idProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value ProgressColorTest::CreateNativeNodeWhite(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置loadingProgress测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(loadingProgress, NODE_PROGRESS_COLOR, &item); + + // 挂载组件 + std::string idProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idProgress), + loadingProgress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_color_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_color_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f215bbb0e7ecad4094e0a20fcd6433c837fa9703 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_color_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_PROGRESS_COLOR_TEST_H +#define ARKUI_CAPI_DEMO_PROGRESS_COLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ProgressColorTest { +public: + ~ProgressColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlack(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeWhite(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_PROGRESS_COLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_style_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_style_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fed71dc0d6a30c03f546ff2c3dd71c8d8622daf3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_style_test.cpp @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "progress_style_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle progress; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + progress = nodeAPI->createNode(ARKUI_NODE_PROGRESS); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(progress, NODE_HEIGHT, &height_item); + + // 设置progress测试属性 + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_BACKGROUND_COLOR, &color_item); +} + +napi_value ProgressStyleTest::CreateNativeNodeLinear(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置progress测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_PROGRESS_TYPE_LINEAR}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_PROGRESS_TYPE, &item); + + // 挂载组件 + std::string idProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idProgress), progress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value ProgressStyleTest::CreateNativeNodeRing(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置progress测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_PROGRESS_TYPE_RING}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_PROGRESS_TYPE, &item); + + // 挂载组件 + std::string idProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idProgress), progress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value ProgressStyleTest::CreateNativeNodeEclipse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置progress测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_PROGRESS_TYPE_ECLIPSE}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_PROGRESS_TYPE, &item); + + // 挂载组件 + std::string idProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idProgress), progress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value ProgressStyleTest::CreateNativeNodeScaleRing(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置progress测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_PROGRESS_TYPE_SCALE_RING}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_PROGRESS_TYPE, &item); + + // 挂载组件 + std::string idProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idProgress), progress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value ProgressStyleTest::CreateNativeNodeCapsule(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置progress测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_PROGRESS_TYPE_CAPSULE}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(progress, NODE_PROGRESS_TYPE, &item); + + // 挂载组件 + std::string idProgress(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idProgress), progress); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_style_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_style_test.h new file mode 100644 index 0000000000000000000000000000000000000000..327163f559c5a2017eea16f0728fe259d0e59adf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/progress/progress_style_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_PROGRESS_STYLE_TEST_H +#define ARKUI_CAPI_DEMO_PROGRESS_STYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ProgressStyleTest { +public: + ~ProgressStyleTest(); + static napi_value CreateNativeNodeLinear(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRing(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEclipse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeScaleRing(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCapsule(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_PROGRESS_STYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onrefreshing_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onrefreshing_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6155b1e48d316a2007f57f2ecfb07f0c6c1a6e8d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onrefreshing_test.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "refresh_onrefreshing_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 +#define ON_REFRESH_EVENT_ID 1212 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle refresh; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 当触发刷新事件时 将组件背景颜色设置为蓝色,默认是红色 + if (ON_REFRESH_EVENT_ID == eventId) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +static void BasicSet() +{ + // 创建组件并添加到容器内 + refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + ArkUI_NumberValue width_value[] = {{.f32 = 2000}}; + ArkUI_NumberValue height_value[] = {{.f32 = 2000}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); +} + +napi_value RefreshOnRefreshingTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 组件基础属性设置 + BasicSet(); + // 设置组件Id + ArkUI_AttributeItem idItem; + idItem.string = "ONREFRESH"; + nodeAPI->setAttribute(refresh, NODE_ID, &idItem); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + nodeAPI->registerNodeEvent(refresh, NODE_REFRESH_ON_REFRESH, ON_REFRESH_EVENT_ID, nullptr); + + // 挂载组件 + std::string idRefresh(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idRefresh), refresh); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onrefreshing_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onrefreshing_test.h new file mode 100644 index 0000000000000000000000000000000000000000..de5b0311ddaec2ce1fb4d296d094d107086666e9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onrefreshing_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_REFRESH_ONREFRESHING_TEST_H +#define ARKUI_CAPI_DEMO_REFRESH_ONREFRESHING_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class RefreshOnRefreshingTest { +public: + ~RefreshOnRefreshingTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_REFRESH_ONREFRESHING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onstatechange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onstatechange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6af59d09c920fc05777804568766251394af97d1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onstatechange_test.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "refresh_onstatechange_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 +#define ON_REFRESH_EVENT_ID 1313 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle refresh; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 当触发刷新事件时 将组件背景颜色设置为蓝色,默认是红色 + if (ON_REFRESH_EVENT_ID == eventId) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +static void BasicSet() +{ + // 创建组件并添加到容器内 + refresh = nodeAPI->createNode(ARKUI_NODE_REFRESH); + ArkUI_NumberValue width_value[] = {{.f32 = 800}}; + ArkUI_NumberValue height_value[] = {{.f32 = 800}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(refresh, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(refresh, NODE_HEIGHT, &height_item); +} + +napi_value RefreshOnStateChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 组件基础属性设置 + BasicSet(); + // 设置组件Id + ArkUI_AttributeItem idItem; + idItem.string = "ONSTATECHANGE"; + nodeAPI->setAttribute(refresh, NODE_ID, &idItem); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(refresh, NODE_REFRESH_STATE_CHANGE, ON_REFRESH_EVENT_ID, nullptr); + + // 挂载组件 + std::string idRefresh(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idRefresh), refresh); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onstatechange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onstatechange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..63e700675e393dd445126cac7d6a1b26ec0c3f90 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/refresh/refresh_onstatechange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_REFRESH_ONSTATECHANGE_TEST_H +#define ARKUI_CAPI_DEMO_REFRESH_ONSTATECHANGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class RefreshOnStateChangeTest { +public: + ~RefreshOnStateChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_REFRESH_ONSTATECHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/row/row_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/row/row_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cea494e88b54c4dcaa70ef4d80c0d069a35f1f3b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/row/row_height_test.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "row_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value RowHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RowHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RowHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置row组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置row组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置row组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first row,设置高度为200 + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(row, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(row, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(row, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_HEIGHT, &height_item); + + // second row,设置高度为异常值 + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(row_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(parentColumn, row); + nodeAPI->insertChildAfter(parentColumn, row_second, row); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RowHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value RowHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RowHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RowHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent parentColumn + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_HEIGHT, &col_height_item); + + // 设置高度为超大值500 + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_HEIGHT, &height_item); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置row组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_WIDTH, &default_width_item); + + nodeAPI->addChild(parentColumn, row); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RowHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/row/row_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/row/row_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b85bd2228d6b5a2710f47348fbdb02c1ef063313 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/row/row_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_ROW_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_ROW_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class RowHeightTest { +public: + ~RowHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_ROW_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c0e6986daf6f2fcfec2567786282d93b6fdbfdad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_backgroundcolor_test.cpp @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_backgroundcolor_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBackgroundColorTest::CreateNativeNodeBlack(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBackgroundColorTest::CreateNativeNodeWhite(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bad13534c51218e2af9e622a6d57ec1db3fec8c1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_backgroundcolor_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_BACKGROUND_COLOR_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_BACKGROUND_COLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollBackgroundColorTest { +public: + ~ScrollBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeWhite(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlack(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_BACKGROUND_COLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_blur_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_blur_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2986233fa6219f76e549f67ada872802fbea506c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_blur_test.cpp @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_blur_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollBlurTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.f32 = 50}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BLUR, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBlurTest::CreateNativeNodeDefault(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.f32 = 0.0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BLUR, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_blur_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_blur_test.h new file mode 100644 index 0000000000000000000000000000000000000000..4c2566d921face81f30ac238cd1a3ad9a61f7b29 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_blur_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BLUR_TEST_H +#define ARKUI_CAPI_DEMO_BLUR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollBlurTest { +public: + ~ScrollBlurTest(); + static napi_value CreateNativeNodeDefault(napi_env env, napi_callback_info info); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BLUR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_bordercolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_bordercolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..554357dbd6b1dfed0ba83d5661750d9e2c03cc88 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_bordercolor_test.cpp @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_bordercolor_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollBorderColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem width_value_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_WIDTH, &width_value_item); + + ArkUI_NumberValue color_value[] = {{.u32 = 0xFFFFffff}}; + ArkUI_AttributeItem color_value_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_COLOR, &color_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBorderColorTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue color_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem color_value_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_COLOR, &color_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBorderColorTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem width_value_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_WIDTH, &width_value_item); + + ArkUI_NumberValue color_value[] = {{.u32 = napi_null}}; + ArkUI_AttributeItem color_value_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_COLOR, &color_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBorderColorTest::CreateNativeNodeUndefined(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem width_value_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_WIDTH, &width_value_item); + + ArkUI_NumberValue color_value[] = {{.u32 = napi_undefined}}; + ArkUI_AttributeItem color_value_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_COLOR, &color_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_bordercolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_bordercolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ed2fa03ea4b270ca000296abba9373913e015532 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_bordercolor_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_BORDER_COLOR_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_BORDER_COLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollBorderColorTest { +public: + ~ScrollBorderColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUndefined(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_BORDER_COLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderradius_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderradius_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f9aa331150e33140956568bb87dd806a62a85714 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderradius_test.cpp @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_borderradius_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollBorderRadiusTest::CreateNativeNodeSingle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue radius_value[] = {{.f32 = 40}}; + ArkUI_AttributeItem radius_value_item = {radius_value, sizeof(radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_RADIUS, &radius_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBorderRadiusTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue radius_value[4] = {{.f32 = -10}, {.f32 = 50}, {.f32 = 10}, {.f32 = 50}}; + ArkUI_AttributeItem radius_value_item = {radius_value, sizeof(radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_RADIUS, &radius_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBorderRadiusTest::CreateNativeNodeAllParam(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_NONE}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue radius_value[4] = {{.f32 = 10}, {.f32 = 50}, {.f32 = 10}, {.f32 = 50}}; + ArkUI_AttributeItem radius_value_item = {radius_value, sizeof(radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_RADIUS, &radius_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderradius_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderradius_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0eec6722080e477bf53965e63078ef9ce1cfc45c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderradius_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_BORDER_RADIUS_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_BORDER_RADIUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollBorderRadiusTest { +public: + ~ScrollBorderRadiusTest(); + static napi_value CreateNativeNodeSingle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAllParam(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_BORDER_RADIUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderwidth_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderwidth_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..853e203c2ba98d05bbecedf9d5f05c910a8b7df0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderwidth_test.cpp @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_borderwidth_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollBorderWidthTest::CreateNativeNodeSingle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = 40}}; + ArkUI_AttributeItem border_value_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_WIDTH, &border_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBorderWidthTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue border_width_value[4] = {{.f32 = -10}, {.f32 = 50}, {.f32 = 10}, {.f32 = 50}}; + ArkUI_AttributeItem border_value_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_WIDTH, &border_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBorderWidthTest::CreateNativeNodeAllParam(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_NONE}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue border_width_value[4] = {{.f32 = 10}, {.f32 = 50}, {.f32 = 10}, {.f32 = 50}}; + ArkUI_AttributeItem border_value_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BORDER_WIDTH, &border_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderwidth_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderwidth_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e5a2f6ce98cac0950d33cd20820ca5b3e30a20d4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_borderwidth_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_BORDER_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_BORDER_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollBorderWidthTest { +public: + ~ScrollBorderWidthTest(); + static napi_value CreateNativeNodeSingle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAllParam(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_BORDER_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_brightness_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_brightness_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7d24def4962a382e19ddb3d152fd0275917d3736 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_brightness_test.cpp @@ -0,0 +1,294 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_brightness_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollBrightnessTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.f32 = 1.0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BRIGHTNESS, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBrightnessTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.f32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BRIGHTNESS, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBrightnessTest::CreateNativeNodeMax(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.f32 = 2}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BRIGHTNESS, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollBrightnessTest::CreateNativeNodeMin(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.f32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BRIGHTNESS, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_brightness_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_brightness_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ac511d1f76247e9d129877d092bbdeb94aaa543a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_brightness_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_BRIGHTNESS_TEST_H +#define ARKUI_CAPI_DEMO_BRIGHTNESS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollBrightnessTest { +public: + ~ScrollBrightnessTest(); + static napi_value CreateNativeNodeMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMax(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_BRIGHTNESS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b6628ba1e550b9f9b36b3b7022c1d82db18e0f7e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_clip_test.cpp @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_clip_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollClipTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue clip_value[] = {{.i32 = true}}; + ArkUI_AttributeItem clip_value_item = {clip_value, sizeof(clip_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_CLIP, &clip_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollClipTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue clip_value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem clip_value_item = {clip_value, sizeof(clip_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_CLIP, &clip_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollClipTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_NONE}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue clip_value[] = {{.i32 = false}}; + ArkUI_AttributeItem clip_value_item = {clip_value, sizeof(clip_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_CLIP, &clip_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e12b3108c85cfd44cbab30702804bc41707439e6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_clip_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_CLIP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollClipTest { +public: + ~ScrollClipTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_common.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_common.cpp new file mode 100644 index 0000000000000000000000000000000000000000..59de43bcc7bd9ff8d1bac8bd1141dbf2e6174a38 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_common.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_common.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle ScrollCommon::CreateScroll(ScrollPropertiesInit flags) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCommon", "CreateScroll"); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + + // width + if (flags.initWidthFlag) { + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + } + + // height + if (flags.initHeightFlag) { + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + } + + // margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_MARGIN, &margin_item); + + // background + if (flags.initBackgroundColorFlag) { + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_value_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_value_item); + } + + // child node + if (flags.initChildNodeFlag) { + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + // 浅蓝 + ArkUI_NumberValue text_background_value[] = {{.u32 = 0xFFAFEEEE}}; + ArkUI_AttributeItem text_background_item = {text_background_value, + sizeof(text_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &text_background_item); + + auto text_second = nodeAPI->createNode(ARKUI_NODE_TEXT); + // 绿 + ArkUI_NumberValue text_second_background_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem text_second_background_item = { + text_second_background_value, sizeof(text_second_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text_second, NODE_BACKGROUND_COLOR, &text_second_background_item); + + auto text_third = nodeAPI->createNode(ARKUI_NODE_TEXT); + // 红 + ArkUI_NumberValue text_third_background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem text_third_background_item = { + text_third_background_value, sizeof(text_third_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text_third, NODE_BACKGROUND_COLOR, &text_third_background_item); + + auto text_fourth = nodeAPI->createNode(ARKUI_NODE_TEXT); + // 蓝 + ArkUI_NumberValue text_fourth_background_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem text_fourth_background_item = { + text_fourth_background_value, sizeof(text_fourth_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text_fourth, NODE_BACKGROUND_COLOR, &text_fourth_background_item); + + nodeAPI->addChild(scroll, text); + nodeAPI->addChild(scroll, text_second); + nodeAPI->addChild(scroll, text_third); + nodeAPI->addChild(scroll, text_fourth); + } + + return scroll; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_common.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_common.h new file mode 100644 index 0000000000000000000000000000000000000000..326a1bbd210709bd3d60728ec7acc0c80145993c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_common.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_COMMON_H +#define ARKUI_CAPI_DEMO_SCROLL_COMMON_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollCommon { +public: + ~ScrollCommon(); + struct ScrollPropertiesInit { + bool initWidthFlag; + bool initHeightFlag; + bool initBackgroundColorFlag; + bool initChildNodeFlag; + }; + + static ArkUI_NodeHandle CreateScroll(ScrollPropertiesInit flags); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_COMMON_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_currentoffset_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_currentoffset_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0e5d8e261e89bf7786b19da59a82ac69e2aa7865 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_currentoffset_test.cpp @@ -0,0 +1,979 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_currentoffset_test.h" +#include +#define SCROLL_TO_EVENT_ID 1111 +#define PARAM_10 10 +#define SIZE_320 320 + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == SCROLL_TO_EVENT_ID) { + if (nodeAPI->getAttribute(nodeHandler, NODE_SCROLL_OFFSET)->value[PARAM_0].f32 == PARAM_0 && + nodeAPI->getAttribute(nodeHandler, NODE_SCROLL_OFFSET)->value[PARAM_1].f32 == PARAM_10) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_LINEAR}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeEase(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_EASE}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeEaseInOut(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_EASE_IN_OUT}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeEaseIn(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_EASE_IN}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeEaseOut(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_EASE_OUT}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeExtremeDeceleration(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_EXTREME_DECELERATION}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeFastOutLinearIn(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_FAST_OUT_LINEAR_IN}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeFastOutSlowIn(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_FAST_OUT_SLOW_IN}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeFriction(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_FRICTION}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeLinearOutSlowIn(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_LINEAR_OUT_SLOW_IN}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeRhythm(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_RHYTHM}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeSharp(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_SHARP}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollCurrentOffsetTest::CreateNativeNodeSmooth(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "CurrentOffset"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + float height = 10.0; + + ArkUI_NumberValue scroll_value[] = { + {.f32 = PARAM_0}, {.f32 = height}, {.i32 = PARAM_64}, {.i32 = ARKUI_CURVE_SMOOTH}, {.i32 = true}}; + ArkUI_AttributeItem scroll_item = {scroll_value, sizeof(scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &scroll_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, SCROLL_TO_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollCurrentOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_currentoffset_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_currentoffset_test.h new file mode 100644 index 0000000000000000000000000000000000000000..674eebfafffde97c7ff87d8d78737a3237502b8b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_currentoffset_test.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_CURRENTOFFSET_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_CURRENTOFFSET_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollCurrentOffsetTest { +public: + ~ScrollCurrentOffsetTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEase(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEaseInOut(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEaseIn(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEaseOut(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeExtremeDeceleration(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFastOutLinearIn(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFastOutSlowIn(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFriction(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLinearOutSlowIn(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRhythm(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSharp(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSmooth(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_CURRENTOFFSET_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_edgeeffect_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_edgeeffect_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4ecfd07daa2e6bdfe33c8283e6353d382a4b4388 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_edgeeffect_test.cpp @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_edgeeffect_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollEdgeEffectTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 绑定id + ArkUI_AttributeItem id_item = {}; + id_item.string = "EdgeEffect"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue edge_value[] = {{.i32 = ARKUI_EDGE_EFFECT_NONE}, {.i32 = 1}}; + ArkUI_AttributeItem edge_value_item = {edge_value, sizeof(edge_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_EDGE_EFFECT, &edge_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollEdgeEffectTest::CreateNativeNodeFade(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 绑定id + ArkUI_AttributeItem id_item = {}; + id_item.string = "EdgeEffect"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue edge_value[] = {{.i32 = ARKUI_EDGE_EFFECT_FADE}, {.i32 = 1}}; + ArkUI_AttributeItem edge_value_item = {edge_value, sizeof(edge_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_EDGE_EFFECT, &edge_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollEdgeEffectTest::CreateNativeNodeSpring(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 绑定id + ArkUI_AttributeItem id_item = {}; + id_item.string = "EdgeEffect"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue edge_value[] = {{.i32 = ARKUI_EDGE_EFFECT_SPRING}, {.i32 = 1}}; + ArkUI_AttributeItem edge_value_item = {edge_value, sizeof(edge_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_EDGE_EFFECT, &edge_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollEdgeEffectTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_edgeeffect_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_edgeeffect_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3944b348c2348a9b57d3b677e178140af972c9af --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_edgeeffect_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_EDGEEFFECT_TEST_H +#define ARKUI_CAPI_DEMO_EDGEEFFECT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollEdgeEffectTest { +public: + ~ScrollEdgeEffectTest(); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSpring(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFade(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_EDGEEFFECT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_enablescrollinteraction_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_enablescrollinteraction_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..681a82e906c1ce0691e2ed53ad9f2e97ead6a6c9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_enablescrollinteraction_test.cpp @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_enablescrollinteraction_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + ArkUI_AttributeItem id_item = {}; + id_item.string = "EnableScrollInteraction"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollEnableScrollInteractionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollEnableScrollInteractionTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue enable_value[] = {{.i32 = true}}; + ArkUI_AttributeItem enable_value_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &enable_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollEnableScrollInteractionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollEnableScrollInteractionTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue enable_value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem enable_value_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &enable_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollEnableScrollInteractionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollEnableScrollInteractionTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_NONE}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue enable_value[] = {{.i32 = false}}; + ArkUI_AttributeItem enable_value_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &enable_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollEnableScrollInteractionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_enablescrollinteraction_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_enablescrollinteraction_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5bfc9c69ea44ebf04f4a9824a95cc3910e931258 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_enablescrollinteraction_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ENABLE_SCROLL_INTERACTION_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ENABLE_SCROLL_INTERACTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollEnableScrollInteractionTest { +public: + ~ScrollEnableScrollInteractionTest(); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ENABLE_SCROLL_INTERACTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_friction_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_friction_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..15cb726810458bddfa8f053e851c89644676d2b6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_friction_test.cpp @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_friction_test.h" + +#define PARAM_NUMBER 2 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +#define ABNORMAL_PARAM 1000 +#define DEFAULT_PARAM (0.6) +#define NORMAL_PARAM (0.9) + +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + char scrollID[64] = {0}; + napi_get_value_string_utf8(env, args[1], scrollID, length, &strLength); + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + ArkUI_AttributeItem id_item = {}; + id_item.string = scrollID; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollFrictionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollFrictionTest::CreateNativeNodeDefault(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue friction_value[] = {{.f32 = 0.9}}; + ArkUI_AttributeItem friction_value_item = {friction_value, sizeof(friction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_FRICTION, &friction_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollFrictionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollFrictionTest::CreateNativeNodeAbNormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue friction_value[] = {{.f32 = 1000}}; + ArkUI_AttributeItem friction_value_item = {friction_value, sizeof(friction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_FRICTION, &friction_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollFrictionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollFrictionTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue friction_value[] = {{.f32 = 0.6}}; + ArkUI_AttributeItem friction_value_item = {friction_value, sizeof(friction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_FRICTION, &friction_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollFrictionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_friction_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_friction_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b63c06508b9e456d97501fff901300f5e54c0dc1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_friction_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_FRICTION_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_FRICTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollFrictionTest { +public: + ~ScrollFrictionTest(); + static napi_value CreateNativeNodeDefault(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_FRICTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5a3ae3cb08904aa124f18ad81b06bf292fc44829 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_height_test.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "scroll_height_test.h" +#include "scroll_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ScrollHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + ScrollCommon::ScrollPropertiesInit init_flags = {true, true, true, false}; + + // first scroll,设置高度为200 + auto scroll = ScrollCommon::CreateScroll(init_flags); + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + // second scroll,设置高度为异常值 + auto scroll_second = ScrollCommon::CreateScroll(init_flags); + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, scroll); + nodeAPI->insertChildAfter(column, scroll_second, scroll); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + ScrollCommon::ScrollPropertiesInit init_flags = {true, false, true, false}; + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置高度为超大值10000 + auto scroll = ScrollCommon::CreateScroll(init_flags); + ArkUI_NumberValue height_value[] = {{.f32 = 10000}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, scroll); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e6ce542292d45417b7969b8f3122ae55c2a6bffd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollHeightTest { +public: + ~ScrollHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_hittestbehavior_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_hittestbehavior_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0ef88a7677d50987f5114787b1beb44946e8c2b5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_hittestbehavior_test.cpp @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_hittestbehavior_test.h" + +#include + +#define SCROLL_ON_TOUCH_EVENT_ID 7001 +#define SCROLL_BROTHER_ON_TOUCH_EVENT_ID 7002 + +using namespace std; + +namespace ArkUICApiDemo { + +void ScrollHitTestBehaviorTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t backgroundColor = 0xFF0000FF; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollEventOnClickTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == SCROLL_ON_TOUCH_EVENT_ID) { + backgroundColor = 0xFF0000FF; + } else { + backgroundColor = 0xFF000000; + } + + if ((eventId == SCROLL_ON_TOUCH_EVENT_ID) || (eventId == SCROLL_BROTHER_ON_TOUCH_EVENT_ID)) { + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +ArkUI_NodeHandle ScrollHitTestBehaviorTest::CreateSubScrollNode(ArkUI_NativeNodeAPI_1 *node_api, + int32_t hittestbehavior, const char *ontouchteststack, + const char *ontouchtestscroll, + const char *ontouchtestscrollbrother) +{ + float stackWidth = 80; + float stackHeight = 80; + float scrollWidth = 60; + float scrollHeight = 60; + float scrollBrotherWidth = 40; + float scrollBrotherHeight = 40; + uint32_t stackBackgroundColor = 0xFF888888; + uint32_t scrollBackgroundColor = 0xFFFF0000; + uint32_t scrollBrotherBackgroundColor = 0xFF00FF00; + + auto stack = node_api->createNode(ARKUI_NODE_STACK); + auto scroll = node_api->createNode(ARKUI_NODE_SCROLL); + auto scrollBrother = node_api->createNode(ARKUI_NODE_SCROLL); + + ArkUI_AttributeItem id_item = {}; + id_item.string = ontouchteststack; + node_api->setAttribute(stack, NODE_ID, &id_item); + + ArkUI_NumberValue stack_width_value[] = {{.f32 = stackWidth}}; + ArkUI_AttributeItem stack_width_item = {stack_width_value, sizeof(stack_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &stack_width_item); + + ArkUI_NumberValue stack_height_value[] = {{.f32 = stackHeight}}; + ArkUI_AttributeItem stack_height_item = {stack_height_value, + sizeof(stack_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &stack_height_item); + + ArkUI_NumberValue stack_background_color_value[] = {{.u32 = stackBackgroundColor}}; + ArkUI_AttributeItem stack_background_color_item = { + stack_background_color_value, sizeof(stack_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &stack_background_color_item); + + ArkUI_AttributeItem scroll_id_item = {}; + scroll_id_item.string = ontouchtestscroll; + node_api->setAttribute(scroll, NODE_ID, &scroll_id_item); + + ArkUI_NumberValue scroll_width_value[] = {{.f32 = scrollWidth}}; + ArkUI_AttributeItem scroll_width_item = {scroll_width_value, + sizeof(scroll_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(scroll, NODE_WIDTH, &scroll_width_item); + + ArkUI_NumberValue scroll_height_value[] = {{.f32 = scrollHeight}}; + ArkUI_AttributeItem scroll_height_item = {scroll_height_value, + sizeof(scroll_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(scroll, NODE_HEIGHT, &scroll_height_item); + + ArkUI_NumberValue scroll_background_color_value[] = {{.u32 = scrollBackgroundColor}}; + ArkUI_AttributeItem scroll_background_color_item = { + scroll_background_color_value, sizeof(scroll_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(scroll, NODE_BACKGROUND_COLOR, &scroll_background_color_item); + + node_api->registerNodeEvent(scroll, NODE_TOUCH_EVENT, SCROLL_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "SCROLL_ON_TOUCH_EVENT_ID", "SCROLL_ON_TOUCH_EVENT_ID"); + + node_api->addChild(stack, scroll); + + ArkUI_AttributeItem scroll_brother_id_item = {}; + scroll_brother_id_item.string = ontouchtestscrollbrother; + node_api->setAttribute(scrollBrother, NODE_ID, &scroll_brother_id_item); + + ArkUI_NumberValue scroll_brother_width_value[] = {{.f32 = scrollBrotherWidth}}; + ArkUI_AttributeItem scroll_brother_width_item = {scroll_brother_width_value, + sizeof(scroll_brother_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(scrollBrother, NODE_WIDTH, &scroll_brother_width_item); + + ArkUI_NumberValue scroll_brother_height_value[] = {{.f32 = scrollBrotherHeight}}; + ArkUI_AttributeItem scroll_brother_height_item = {scroll_brother_height_value, + sizeof(scroll_brother_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(scrollBrother, NODE_HEIGHT, &scroll_brother_height_item); + + ArkUI_NumberValue scroll_brother_background_color_value[] = {{.u32 = scrollBrotherBackgroundColor}}; + ArkUI_AttributeItem scroll_brother_background_color_item = {scroll_brother_background_color_value, + sizeof(scroll_brother_background_color_value) / + sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(scrollBrother, NODE_BACKGROUND_COLOR, &scroll_brother_background_color_item); + + ArkUI_NumberValue scroll_brother_hittestbehavior_value[] = {{.i32 = hittestbehavior}}; + ArkUI_AttributeItem scroll_brother_hittestbehavior_item = { + scroll_brother_hittestbehavior_value, sizeof(scroll_brother_hittestbehavior_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(scrollBrother, NODE_HIT_TEST_BEHAVIOR, &scroll_brother_hittestbehavior_item); + + node_api->registerNodeEvent(scrollBrother, NODE_TOUCH_EVENT, SCROLL_BROTHER_ON_TOUCH_EVENT_ID, nullptr); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "SCROLL_BROTHER_ON_TOUCH_EVENT_ID", + "SCROLL_BROTHER_ON_TOUCH_EVENT_ID"); + + node_api->addChild(stack, scrollBrother); + + return stack; +} + +napi_value ScrollHitTestBehaviorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollHitTestBehaviorTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t hittestbehavior = 0; + string ontouchteststack = "OnTouchTestStackDefault"; + string ontouchtestscroll = "OnTouchTestScrollDefault"; + string ontouchtestscrollbrother = "OnTouchTestScrollBrotherDefault"; + auto stack = CreateSubScrollNode(nodeAPI, hittestbehavior, ontouchteststack.c_str(), ontouchtestscroll.c_str(), + ontouchtestscrollbrother.c_str()); + nodeAPI->addChild(column, stack); + + hittestbehavior = 1; + ontouchteststack = "OnTouchTestStackBlock"; + ontouchtestscroll = "OnTouchTestScrollBlock"; + ontouchtestscrollbrother = "OnTouchTestScrollBrotherBlock"; + stack = CreateSubScrollNode(nodeAPI, hittestbehavior, ontouchteststack.c_str(), ontouchtestscroll.c_str(), + ontouchtestscrollbrother.c_str()); + nodeAPI->addChild(column, stack); + + hittestbehavior = 2; + ontouchteststack = "OnTouchTestStackTransparent"; + ontouchtestscroll = "OnTouchTestScrollTransparent"; + ontouchtestscrollbrother = "OnTouchTestScrollBrotherTransparent"; + stack = CreateSubScrollNode(nodeAPI, hittestbehavior, ontouchteststack.c_str(), ontouchtestscroll.c_str(), + ontouchtestscrollbrother.c_str()); + nodeAPI->addChild(column, stack); + + hittestbehavior = 3; + ontouchteststack = "OnTouchTestStackNone"; + ontouchtestscroll = "OnTouchTestScrollNone"; + ontouchtestscrollbrother = "OnTouchTestScrollBrotherNone"; + stack = CreateSubScrollNode(nodeAPI, hittestbehavior, ontouchteststack.c_str(), ontouchtestscroll.c_str(), + ontouchtestscrollbrother.c_str()); + nodeAPI->addChild(column, stack); + + hittestbehavior = -1; + ontouchteststack = "OnTouchTestStackExceptBelow"; + ontouchtestscroll = "OnTouchTestScrollExceptBelow"; + ontouchtestscrollbrother = "OnTouchTestScrollBrotherExceptBelow"; + stack = CreateSubScrollNode(nodeAPI, hittestbehavior, ontouchteststack.c_str(), ontouchtestscroll.c_str(), + ontouchtestscrollbrother.c_str()); + nodeAPI->addChild(column, stack); + + hittestbehavior = 4; + ontouchteststack = "OnTouchTestStackExceptAbove"; + ontouchtestscroll = "OnTouchTestScrollExceptAbove"; + ontouchtestscrollbrother = "OnTouchTestScrollBrotherExceptAbove"; + stack = CreateSubScrollNode(nodeAPI, hittestbehavior, ontouchteststack.c_str(), ontouchtestscroll.c_str(), + ontouchtestscrollbrother.c_str()); + nodeAPI->addChild(column, stack); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_hittestbehavior_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_hittestbehavior_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d1b11ee2305dbb1bbcc3099e19bb0a578ea93b14 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_hittestbehavior_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_HITTESTBEHAVIOR_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_HITTESTBEHAVIOR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +using namespace std; + +namespace ArkUICApiDemo { + +class ScrollHitTestBehaviorTest { +public: + ~ScrollHitTestBehaviorTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubScrollNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t hittestbehavior, + const char *ontouchteststack, const char *ontouchtestimage, + const char *ontouchtestimagebrother); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_HITTESTBEHAVIOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_lineargradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_lineargradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..105aa9a05beacbeda9a6676f05bf0db4b77c8072 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_lineargradient_test.cpp @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_lineargradient_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollLinearGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + char gradient[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[1], gradient, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollLinearGradientTest", "gradient: %{public}s", gradient); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollLinearGradientTest", "gradient compare: %{public}d", strcmp(gradient, "ScrollLinearGradientTopTest")); + + ArkUI_LinearGradientDirection arkUI_LinearGradientDirection; + if (strcmp(gradient, "ScrollLinearGradientLeftTest") == 0) { + arkUI_LinearGradientDirection = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT; + } else if (strcmp(gradient, "ScrollLinearGradientTopTest") == 0) { + arkUI_LinearGradientDirection = ARKUI_LINEAR_GRADIENT_DIRECTION_TOP; + } else if (strcmp(gradient, "ScrollLinearGradientRightTest") == 0) { + arkUI_LinearGradientDirection = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT; + } else if (strcmp(gradient, "ScrollLinearGradientBottomTest") == 0) { + arkUI_LinearGradientDirection = ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM; + } else if (strcmp(gradient, "ScrollLinearGradientLeftTopTest") == 0) { + arkUI_LinearGradientDirection = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP; + } else if (strcmp(gradient, "ScrollLinearGradientLeftBottomTest") == 0) { + arkUI_LinearGradientDirection = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM; + } else if (strcmp(gradient, "ScrollLinearGradientRightTopTest") == 0) { + arkUI_LinearGradientDirection = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP; + } else if (strcmp(gradient, "ScrollLinearGradientRightBottomTest") == 0) { + arkUI_LinearGradientDirection = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM; + } else if (strcmp(gradient, "ScrollLinearGradientNoneTest") == 0) { + arkUI_LinearGradientDirection = ARKUI_LINEAR_GRADIENT_DIRECTION_NONE; + } + + // 设置目标属性 + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.0, 0.5}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue gradinet_value[] = {{.f32 = 60}, {.i32 = arkUI_LinearGradientDirection}, {.i32 = true}}; + ArkUI_AttributeItem gradient_value_item = {gradinet_value, sizeof(gradinet_value) / sizeof(ArkUI_NumberValue)}; + gradient_value_item.object = &colorStop; + nodeAPI->setAttribute(scroll, NODE_LINEAR_GRADIENT, &gradient_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_lineargradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_lineargradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cf6ff96ecd66e39853a4df70562ff05aa808c00f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_lineargradient_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_LINEARGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_LINEARGRADIENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollLinearGradientTest { +public: + ~ScrollLinearGradientTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_LINEARGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_nestedscroll_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_nestedscroll_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4ffa123f99db583dd3cb037dbb435ca88a97a2a8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_nestedscroll_test.cpp @@ -0,0 +1,331 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "scroll_nestedscroll_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define ON_SCROLL_EVENT_PARENT_ID 66001 +#define ON_SCROLL_EVENT_CHILD_ID 66002 +#define ON_RESET_EVENT_ID 66003 +#define ON_CLEAR_DATA_EVENT_ID 66004 +#define ON_COMPARE_EVENT_ID 66005 +#define OFFSET_TO_BOTTOM 10000 + +static ArkUI_NodeHandle nestedScrollRoot; +static ArkUI_NodeHandle parentScroll; +static ArkUI_NodeHandle childScroll; +static ArkUI_NodeHandle compareButton; +static int32_t testType; +static int32_t scrollForward; +static int32_t scrollBackward; +static uint64_t parentScrollTime; +static uint64_t selfScrollTime; + +static void SetAttributes(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle nodeHandle, float width, float height, + uint32_t backgroundColor) +{ + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); +} + +static uint64_t GetCurrentSystemTime() +{ + auto timeNow = std::chrono::system_clock::now(); + auto timeNowMs = std::chrono::time_point_cast(timeNow); + uint64_t timestampMs = timeNowMs.time_since_epoch().count(); + return timestampMs; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + ArkUI_NodeComponentEvent *componentEvent = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + + if (eventId == ON_SCROLL_EVENT_PARENT_ID) { + float xOffset = componentEvent->data[PARAM_0].f32; + float yOffset = componentEvent->data[PARAM_1].f32; + if ((xOffset != PARAM_0 || yOffset != PARAM_0) && parentScrollTime == PARAM_0) { + parentScrollTime = GetCurrentSystemTime(); + } + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", + "OnScroll parentScrollTime: %{public}llu", parentScrollTime); + } else if (eventId == ON_SCROLL_EVENT_CHILD_ID) { + float xOffset = componentEvent->data[PARAM_0].f32; + float yOffset = componentEvent->data[PARAM_1].f32; + if ((xOffset != PARAM_0 || yOffset != PARAM_0) && selfScrollTime == PARAM_0) { + selfScrollTime = GetCurrentSystemTime(); + } + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", + "OnScroll selfScrollTime: %{public}llu", selfScrollTime); + } else if (eventId == ON_RESET_EVENT_ID) { + int32_t resetOffset = ARKUI_SCROLL_EDGE_TOP; + if (testType > PARAM_4) { + resetOffset = ARKUI_SCROLL_EDGE_BOTTOM; + } + ArkUI_NumberValue edge_value[] = {{.i32 = resetOffset}}; + ArkUI_AttributeItem edge_item = {edge_value, sizeof(edge_value) / sizeof(ArkUI_NumberValue)}; + if (parentScroll != nullptr) { + nodeAPI->setAttribute(parentScroll, NODE_SCROLL_EDGE, &edge_item); + } + if (childScroll != nullptr) { + nodeAPI->setAttribute(childScroll, NODE_SCROLL_EDGE, &edge_item); + } + } else if (eventId == ON_CLEAR_DATA_EVENT_ID) { + selfScrollTime = PARAM_0; + parentScrollTime = PARAM_0; + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GRAY}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + if (compareButton != nullptr) { + nodeAPI->setAttribute(compareButton, NODE_BACKGROUND_COLOR, &background_color_item); + } + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", + "ClearData parentScrollTime: %{public}llu", parentScrollTime); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", + "ClearData selfScrollTime: %{public}llu", selfScrollTime); + } else if (eventId == ON_COMPARE_EVENT_ID) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", + "CompareData parentScrollTime: %{public}llu", parentScrollTime); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", + "CompareData selfScrollTime: %{public}llu", selfScrollTime); + bool compareResult = false; + switch (testType) { + case PARAM_1: + compareResult = (parentScrollTime == PARAM_0 && selfScrollTime != PARAM_0); + break; + case PARAM_2: + compareResult = (parentScrollTime > selfScrollTime && selfScrollTime > PARAM_0); + break; + case PARAM_3: + compareResult = (parentScrollTime < selfScrollTime && parentScrollTime > PARAM_0); + break; + case PARAM_4: + compareResult = (parentScrollTime > PARAM_0 && selfScrollTime > PARAM_0); + break; + case PARAM_5: + compareResult = (parentScrollTime == PARAM_0 && selfScrollTime != PARAM_0); + break; + case PARAM_6: + compareResult = (parentScrollTime > selfScrollTime && selfScrollTime > PARAM_0); + break; + case PARAM_7: + compareResult = (parentScrollTime < selfScrollTime && parentScrollTime > PARAM_0); + break; + case PARAM_8: + compareResult = (parentScrollTime > PARAM_0 && selfScrollTime > PARAM_0); + break; + } + uint32_t color = COLOR_GRAY; + if (compareResult) { + color = COLOR_GREEN; + } else { + color = COLOR_RED; + } + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + if (compareButton != nullptr) { + nodeAPI->setAttribute(compareButton, NODE_BACKGROUND_COLOR, &background_color_item); + } + } +} + +napi_value ScrollNestedScrollTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + std::string id(xComponentID); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", "GetContext env or info is null"); + return nullptr; + } + + // create node + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + nestedScrollRoot = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + compareButton = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto resetButton = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto clearDataButton = nodeAPI->createNode(ARKUI_NODE_BUTTON); + parentScroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + childScroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto parentInnerColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto topColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto bottomColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto childInnerColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "nestedScrollRoot"; + nodeAPI->setAttribute(nestedScrollRoot, NODE_ID, &id_item); + id_item.string = "compareButton"; + nodeAPI->setAttribute(compareButton, NODE_ID, &id_item); + id_item.string = "resetButton"; + nodeAPI->setAttribute(resetButton, NODE_ID, &id_item); + id_item.string = "clearDataButton"; + nodeAPI->setAttribute(clearDataButton, NODE_ID, &id_item); + + // set nestedScroll + ArkUI_NumberValue nested_scroll_value[] = {{.i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY}, + {.i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY}}; + ArkUI_AttributeItem nested_scroll_item = {nested_scroll_value, + sizeof(nested_scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(childScroll, NODE_SCROLL_NESTED_SCROLL, &nested_scroll_item); + + // set button size&backgroundColor + SetAttributes(nodeAPI, resetButton, SIZE_50, SIZE_50, COLOR_BLUE); + SetAttributes(nodeAPI, compareButton, SIZE_50, SIZE_50, COLOR_GRAY); + SetAttributes(nodeAPI, clearDataButton, SIZE_50, SIZE_50, COLOR_PURPLE); + + // set scroller size&backgroundColor + SetAttributes(nodeAPI, parentScroll, SIZE_500, SIZE_400, COLOR_PURPLE); + SetAttributes(nodeAPI, topColumn, SIZE_400, SIZE_50, COLOR_GREEN); + SetAttributes(nodeAPI, childScroll, SIZE_400, SIZE_350, COLOR_GRAY); + SetAttributes(nodeAPI, childInnerColumn, SIZE_350, SIZE_400, COLOR_YELLOW); + SetAttributes(nodeAPI, bottomColumn, SIZE_400, SIZE_50, COLOR_GREEN); + + // add to node + nodeAPI->addChild(nestedScrollRoot, row); + nodeAPI->addChild(row, resetButton); + nodeAPI->addChild(row, compareButton); + nodeAPI->addChild(row, clearDataButton); + nodeAPI->addChild(nestedScrollRoot, parentScroll); + nodeAPI->addChild(parentScroll, parentInnerColumn); + nodeAPI->addChild(parentInnerColumn, topColumn); + nodeAPI->addChild(parentInnerColumn, childScroll); + nodeAPI->addChild(childScroll, childInnerColumn); + nodeAPI->addChild(parentInnerColumn, bottomColumn); + + nodeAPI->registerNodeEvent(parentScroll, NODE_SCROLL_EVENT_ON_SCROLL, ON_SCROLL_EVENT_PARENT_ID, nullptr); + nodeAPI->registerNodeEvent(childScroll, NODE_SCROLL_EVENT_ON_SCROLL, ON_SCROLL_EVENT_CHILD_ID, nullptr); + nodeAPI->registerNodeEvent(compareButton, NODE_ON_CLICK, ON_COMPARE_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(resetButton, NODE_ON_CLICK, ON_RESET_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(clearDataButton, NODE_ON_CLICK, ON_CLEAR_DATA_EVENT_ID, nullptr); + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), + nestedScrollRoot) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollNestedScrollTest::ChangeTestType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // translate to enum + switch (testType) { + case PARAM_1: + scrollForward = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY; + scrollBackward = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY; + break; + case PARAM_2: + scrollForward = ARKUI_SCROLL_NESTED_MODE_SELF_FIRST; + scrollBackward = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY; + break; + case PARAM_3: + scrollForward = ARKUI_SCROLL_NESTED_MODE_PARENT_FIRST; + scrollBackward = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY; + break; + case PARAM_4: + scrollForward = ARKUI_SCROLL_NESTED_MODE_PARALLEL; + scrollBackward = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY; + break; + case PARAM_5: + scrollForward = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY; + scrollBackward = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY; + break; + case PARAM_6: + scrollForward = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY; + scrollBackward = ARKUI_SCROLL_NESTED_MODE_SELF_FIRST; + break; + case PARAM_7: + scrollForward = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY; + scrollBackward = ARKUI_SCROLL_NESTED_MODE_PARENT_FIRST; + break; + case PARAM_8: + scrollForward = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY; + scrollBackward = ARKUI_SCROLL_NESTED_MODE_PARALLEL; + break; + } + + // set nestedScroll + if (childScroll != nullptr) { + ArkUI_NumberValue nested_scroll_value[] = {{.i32 = scrollForward}, {.i32 = scrollBackward}}; + ArkUI_AttributeItem nested_scroll_item = {nested_scroll_value, + sizeof(nested_scroll_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(childScroll, NODE_SCROLL_NESTED_SCROLL, &nested_scroll_item); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollNestedScrollTest", + "ChangeTestType testType= %{public}d", testType); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_nestedscroll_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_nestedscroll_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c5419f418046f41c235e4beeb0780c860e5f4e7d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_nestedscroll_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_NESTEDSCROLL_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_NESTEDSCROLL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollNestedScrollTest { +public: + ~ScrollNestedScrollTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value ChangeTestType(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_NESTEDSCROLL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onappear_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onappear_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f0b3d27f2762c55bdf47dc4d6cdb5571a3a33c88 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onappear_test.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_onappear_test.h" +#include + +#define SIZE_320 320 + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnAppearTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnAppearTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_APPEAR_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value ScrollOnAppearTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnAppearTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnAppearTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnAppear"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_EVENT_ON_APPEAR, ON_APPEAR_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnAppearTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onappear_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onappear_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8eb02664e2601045653f756721e11d403d3e36bb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onappear_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ONAPPEAR_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ONAPPEAR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollOnAppearTest { +public: + ~ScrollOnAppearTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ONAPPEAR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscroll_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscroll_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b31c629a5f8dfa1568677b55ed649c74028f85a7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscroll_test.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_onscroll_test.h" +#include + +#define ON_SCROLL_EVENT_ID 6007 +#define SIZE_320 320 + +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle CreateChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, ON_SCROLL_EVENT_ID, nullptr); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + return scroll; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_SCROLL_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value ScrollOnScrollTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto rootColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scrollCalled = CreateChildNode(nodeAPI); + auto scrollNotCalled = CreateChildNode(nodeAPI); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "scrollCalled"; + nodeAPI->setAttribute(scrollCalled, NODE_ID, &id_item); + id_item.string = "scrollNotCalled"; + nodeAPI->setAttribute(scrollNotCalled, NODE_ID, &id_item); + + nodeAPI->addChild(rootColumn, scrollCalled); + nodeAPI->addChild(rootColumn, scrollNotCalled); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), rootColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscroll_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscroll_test.h new file mode 100644 index 0000000000000000000000000000000000000000..151b3c7c8616870ae0312de43183839ddbcdc55a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscroll_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ONSCROLL_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ONSCROLL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollOnScrollTest { +public: + ~ScrollOnScrollTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ONSCROLL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrolledge_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrolledge_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..610aa03693461e8dab0cdff1a4276803f0418048 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrolledge_test.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_onscrolledge_test.h" +#include + +#define ON_SCROLLEDGE_EVENT_ID 6007 +#define SIZE_320 320 + +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle CreateChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL_EDGE, ON_SCROLLEDGE_EVENT_ID, nullptr); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + return scroll; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollEdgeTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollEdgeTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_SCROLLEDGE_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value ScrollOnScrollEdgeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollEdgeTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollEdgeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto rootColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scrollCalled = CreateChildNode(nodeAPI); + auto scrollNotCalled = CreateChildNode(nodeAPI); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "scrollCalled"; + nodeAPI->setAttribute(scrollCalled, NODE_ID, &id_item); + id_item.string = "scrollNotCalled"; + nodeAPI->setAttribute(scrollNotCalled, NODE_ID, &id_item); + + nodeAPI->addChild(rootColumn, scrollCalled); + nodeAPI->addChild(rootColumn, scrollNotCalled); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), rootColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollEdgeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrolledge_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrolledge_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f64e04cd6196adc1a1af8dd05eca03815898508f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrolledge_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ONSCROLLEDGE_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ONSCROLLEDGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollOnScrollEdgeTest { +public: + ~ScrollOnScrollEdgeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ONSCROLLEDGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollframebegin_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollframebegin_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0ad1fb1b1f79e8353faf3daace976da535b0decd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollframebegin_test.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_onscrollframebegin_test.h" +#include + +#define ON_SCROLLFRAMEBEGIN_EVENT_ID 6007 +#define SIZE_320 320 + +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle CreateChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL_FRAME_BEGIN, ON_SCROLLFRAMEBEGIN_EVENT_ID, nullptr); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + return scroll; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollFrameBeginTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollFrameBeginTest", + "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_SCROLLFRAMEBEGIN_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value ScrollOnScrollFrameBeginTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollFrameBeginTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollFrameBeginTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto rootColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scrollCalled = CreateChildNode(nodeAPI); + auto scrollNotCalled = CreateChildNode(nodeAPI); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "scrollCalled"; + nodeAPI->setAttribute(scrollCalled, NODE_ID, &id_item); + id_item.string = "scrollNotCalled"; + nodeAPI->setAttribute(scrollNotCalled, NODE_ID, &id_item); + + nodeAPI->addChild(rootColumn, scrollCalled); + nodeAPI->addChild(rootColumn, scrollNotCalled); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), rootColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollFrameBeginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollframebegin_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollframebegin_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e12d87a27f42eb3dd293a823c6fc6ec79c7124f7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollframebegin_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ONSCROLLFRAMEBEGIN_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ONSCROLLFRAMEBEGIN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollOnScrollFrameBeginTest { +public: + ~ScrollOnScrollFrameBeginTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ONSCROLLFRAMEBEGIN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstart_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstart_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..47144e9448eef2777785e1569ef0682ae10ac66a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstart_test.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_onscrollstart_test.h" +#include + +#define ON_SCROLLSTART_EVENT_ID 6007 +#define SIZE_320 320 + +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle CreateChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL_START, ON_SCROLLSTART_EVENT_ID, nullptr); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + return scroll; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollStartTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollStartTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_SCROLLSTART_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value ScrollOnScrollStartTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollStartTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollStartTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto rootColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scrollCalled = CreateChildNode(nodeAPI); + auto scrollNotCalled = CreateChildNode(nodeAPI); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "scrollCalled"; + nodeAPI->setAttribute(scrollCalled, NODE_ID, &id_item); + id_item.string = "scrollNotCalled"; + nodeAPI->setAttribute(scrollNotCalled, NODE_ID, &id_item); + + nodeAPI->addChild(rootColumn, scrollCalled); + nodeAPI->addChild(rootColumn, scrollNotCalled); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), rootColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollStartTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstart_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstart_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cd77b183975afe607bba6f1b52991c2ef6efc474 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstart_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ONSCROLLSTART_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ONSCROLLSTART_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollOnScrollStartTest { +public: + ~ScrollOnScrollStartTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ONSCROLLSTART_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstop_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstop_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0f642c3653cda9dd916b6cb92d766a3c34cbc61d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstop_test.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_onscrollstop_test.h" +#include + +#define ON_SCROLLSTOP_EVENT_ID 6007 +#define SIZE_320 320 + +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle CreateChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL_STOP, ON_SCROLLSTOP_EVENT_ID, nullptr); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + return scroll; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollStopTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollStopTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_SCROLLSTOP_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value ScrollOnScrollStopTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollStopTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollStopTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto rootColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto scrollCalled = CreateChildNode(nodeAPI); + auto scrollNotCalled = CreateChildNode(nodeAPI); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "scrollCalled"; + nodeAPI->setAttribute(scrollCalled, NODE_ID, &id_item); + id_item.string = "scrollNotCalled"; + nodeAPI->setAttribute(scrollNotCalled, NODE_ID, &id_item); + + nodeAPI->addChild(rootColumn, scrollCalled); + nodeAPI->addChild(rootColumn, scrollNotCalled); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), rootColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollStopTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstop_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstop_test.h new file mode 100644 index 0000000000000000000000000000000000000000..013b2b49a72e77bf6209744f228370c82e1ca670 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_onscrollstop_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_ONSCROLLSTOP_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_ONSCROLLSTOP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollOnScrollStopTest { +public: + ~ScrollOnScrollStopTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_ONSCROLLSTOP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_opacity_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_opacity_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d0d2b468c8e0cd63f02d2b9425d2bc671956b404 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_opacity_test.cpp @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_opacity_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle column; + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(scroll, button); + nodeAPI->addChild(column, scroll); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + nodeAPI->setAttribute(column, NODE_WIDTH, &button_height_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), column) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollOpacityTest::CreateNativeNodeMin(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.f32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_OPACITY, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), column) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollOpacityTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.f32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_OPACITY, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), column) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollOpacityTest::CreateNativeNodeMax(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.f32 = 1}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_OPACITY, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), column) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollOpacityTest::CreateNativeNodeMiddle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.f32 = 0.5}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_OPACITY, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), column) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_opacity_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_opacity_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f2925b43582f29897c3904efdc788a922b64be43 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_opacity_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_OPACITY_TEST_H +#define ARKUI_CAPI_DEMO_OPACITY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollOpacityTest { +public: + ~ScrollOpacityTest(); + static napi_value CreateNativeNodeMax(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMiddle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMin(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_OPACITY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_overlay_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_overlay_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..758b83732174e0486dba8cbc0a486d695a93f4a6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_overlay_test.cpp @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "hilog/log.h" +#include "scroll_overlay_test.h" +#include "string.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffffffff}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOverlayTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollOverlayTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + char overlayValue[64] = {0}; + napi_get_value_string_utf8(env, args[1], overlayValue, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + ArkUI_Alignment arkUI_Alignment; + if (strcmp(overlayValue, "ScrollOverlayTopTest") == 0) { + arkUI_Alignment = ARKUI_ALIGNMENT_TOP; + } else if (strcmp(overlayValue, "ScrollOverlayTopStartTest") == 0) { + arkUI_Alignment = ARKUI_ALIGNMENT_TOP_START; + } else if (strcmp(overlayValue, "ScrollOverlayStartTest") == 0) { + arkUI_Alignment = ARKUI_ALIGNMENT_START; + } else if (strcmp(overlayValue, "ScrollOverlayTopEndTest") == 0) { + arkUI_Alignment = ARKUI_ALIGNMENT_TOP_END; + } else if (strcmp(overlayValue, "ScrollOverlayCenterTest") == 0) { + arkUI_Alignment = ARKUI_ALIGNMENT_CENTER; + } else if (strcmp(overlayValue, "ScrollOverlayEndTest") == 0) { + arkUI_Alignment = ARKUI_ALIGNMENT_END; + } else if (strcmp(overlayValue, "ScrollOverlayBottomStartTest") == 0) { + arkUI_Alignment = ARKUI_ALIGNMENT_BOTTOM_START; + } else if (strcmp(overlayValue, "ScrollOverlayBottomTest") == 0) { + arkUI_Alignment = ARKUI_ALIGNMENT_BOTTOM; + } else if (strcmp(overlayValue, "ScrollOverlayBottomEndTest") == 0) { + arkUI_Alignment = ARKUI_ALIGNMENT_BOTTOM_END; + } + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = arkUI_Alignment}, {.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + + value_item.string = "TEXT"; + nodeAPI->setAttribute(scroll, NODE_OVERLAY, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOverlayTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_overlay_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_overlay_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d57b00c9cd8c4f593be5f63e79915b2bf5efce8d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_overlay_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_OVERLAY_TEST_H +#define ARKUI_CAPI_DEMO_OVERLAY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollOverlayTest { +public: + ~ScrollOverlayTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_OVERLAY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_pageenable_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_pageenable_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..66d9fb31ca8a3b120e9601f6dc9da12b28de0457 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_pageenable_test.cpp @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_pageenable_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button1 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button2 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button3 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button4 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button5 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button1); + nodeAPI->addChild(column, button2); + nodeAPI->addChild(column, button3); + nodeAPI->addChild(column, button4); + nodeAPI->addChild(column, button5); + nodeAPI->addChild(scroll, column); + + ArkUI_AttributeItem id_item; + id_item.string = "Scroll"; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 400}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + + ArkUI_NumberValue button_color_value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem button_color_item = {button_color_value, + sizeof(button_color_value) / sizeof(ArkUI_NumberValue)}; + + nodeAPI->setAttribute(button1, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button1, NODE_HEIGHT, &button_height_item); + nodeAPI->setAttribute(button1, NODE_BACKGROUND_COLOR, &button_color_item); + + nodeAPI->setAttribute(button2, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button2, NODE_HEIGHT, &button_height_item); + + nodeAPI->setAttribute(button3, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button3, NODE_HEIGHT, &button_height_item); + nodeAPI->setAttribute(button3, NODE_BACKGROUND_COLOR, &button_color_item); + + nodeAPI->setAttribute(button4, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button4, NODE_HEIGHT, &button_height_item); + + nodeAPI->setAttribute(button5, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button5, NODE_HEIGHT, &button_height_item); + nodeAPI->setAttribute(button5, NODE_BACKGROUND_COLOR, &button_color_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 400}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollPageEnableTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue background_value[] = {{.i32 = false}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_ENABLE_PAGING, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollPageEnableTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue background_value[] = {{.i32 = true}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_ENABLE_PAGING, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_pageenable_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_pageenable_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c5bc9ec5d8f948b58bb5dc0fd422205a9f4ae284 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_pageenable_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_PAGE_ENABLE_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_PAGE_ENABLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollPageEnableTest { +public: + ~ScrollPageEnableTest(); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_PAGE_ENABLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_position_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_position_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..716701b8a0fd10fe1be5b177b06b30948b506c68 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_position_test.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "scroll_position_test.h" +#include "scroll_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ScrollPositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollPositionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollPositionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + ScrollCommon::ScrollPropertiesInit init_flags = {true, true, true, false}; + + // first scroll,设置position为{10,10} + auto scroll = ScrollCommon::CreateScroll(init_flags); + ArkUI_NumberValue position_value[] = {{.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_POSITION, &position_item); + + // second scroll,设置position为{-10,-10} + auto scroll_second = ScrollCommon::CreateScroll(init_flags); + ArkUI_NumberValue position_second_value[] = {{.f32 = -10}, {.f32 = -10}}; + ArkUI_AttributeItem position_second_item = {position_second_value, + sizeof(position_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll_second, NODE_POSITION, &position_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, scroll); + nodeAPI->insertChildAfter(column, scroll_second, scroll); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollPositionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_position_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_position_test.h new file mode 100644 index 0000000000000000000000000000000000000000..65c094004ed2d28f1b72e8820b718649a0e7cd8e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_position_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_POSITION_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_POSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollPositionTest { +public: + ~ScrollPositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_POSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_rotate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_rotate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7066244c068ff91ca0993e885cc387d5786b6aec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_rotate_test.cpp @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_rotate_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollRotateTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ROTATE, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollRotateTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.f32 = 10}, {.f32 = 0}, {.f32 = 0}, {.f32 = (-1000)}, {.f32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ROTATE, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollRotateTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 10}, {.f32 = (10)}, {.f32 = 10}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_ROTATE, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_rotate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_rotate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..41b2958f78978f4a91f3ecb12b1bb27f2f3bc1c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_rotate_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_ROTATE_TEST_H +#define ARKUI_CAPI_DEMO_ROTATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollRotateTest { +public: + ~ScrollRotateTest(); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_ROTATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_saturate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_saturate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cf11f81541b4fed516b37bf17605e93fcdbb7026 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_saturate_test.cpp @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_saturate_test.h" +#include + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollSaturateTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue saturate_value[] = {{.f32 = 3}}; + ArkUI_AttributeItem saturate_value_item = {saturate_value, sizeof(saturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SATURATION, &saturate_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollSaturateTest::CreateNativeNodeDefault(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue saturate_value[] = {{.f32 = 1.0}}; + ArkUI_AttributeItem saturate_value_item = {saturate_value, sizeof(saturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SATURATION, &saturate_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollSaturateTest::CreateNativeNodeMax(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue saturate_value[] = {{.f32 = FLT_MAX}}; + ArkUI_AttributeItem saturate_value_item = {saturate_value, sizeof(saturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SATURATION, &saturate_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollSaturateTest::CreateNativeNodeMin(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + ArkUI_NumberValue saturate_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem saturate_value_item = {saturate_value, sizeof(saturate_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SATURATION, &saturate_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_saturate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_saturate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..dd178827512bdea0cd9d6562077e458f81bb5965 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_saturate_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SATURATE_TEST_H +#define ARKUI_CAPI_DEMO_SATURATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollSaturateTest { +public: + ~ScrollSaturateTest(); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMax(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDefault(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SATURATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scale_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scale_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1b0b60d9dc8e67860fe13c4b1a750e3eefdef386 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scale_test.cpp @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_scale_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollScaleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.f32 = 1}, {.f32 = 1}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCALE, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScaleTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.f32 = 0.5}, {.f32 = 0.5}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCALE, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScaleTest::CreateNativeNodeAbNormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.f32 = (-1)}, {.f32 = (-1)}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCALE, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scale_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scale_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c46f13341cc3427d23b5dc842cfd38753399ad10 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scale_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCALE_TEST_H +#define ARKUI_CAPI_DEMO_SCALE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollScaleTest { +public: + ~ScrollScaleTest(); + static napi_value CreateNativeNodeAbNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCALE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollable_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollable_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dfacb5ef82630bb8194b9bbbb07dcbf1d79392b8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollable_test.cpp @@ -0,0 +1,300 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_scrollable_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollAbleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollScrollAbleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollAbleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollAbleTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = 1000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollAbleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollAbleTest::CreateNativeNodeAbnormalNone(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_NONE}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollAbleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollAbleTest::CreateNativeNodeHorizontal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 400}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_HORIZONTAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SCROLL_DIRECTION, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollAbleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollable_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollable_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f4442d3999aea340d328f0f601c2b21a7ae7bf71 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollable_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_SCROLL_ABLE_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_SCROLL_ABLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollScrollAbleTest { +public: + ~ScrollScrollAbleTest(); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormalNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeHorizontal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_SCROLL_ABLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbar_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbar_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..35c140f86774e49e33a14d64d154c0afadc226e9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbar_test.cpp @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_scrollbar_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollScrollBarTest::CreateNativeNodeOn(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollBarTest::CreateNativeNodeOff(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_OFF}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollBarTest::CreateNativeNodeAuto(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + char scrollID[64] = {0}; + napi_get_value_string_utf8(env, args[1], scrollID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = scrollID; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollBarTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbar_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbar_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0098c49fdf22a77783dc5048e8a85902c979fd49 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbar_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_SCROLLBAR_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_SCROLLBAR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollScrollBarTest { +public: + ~ScrollScrollBarTest(); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAuto(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeOn(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeOff(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_SCROLLBAR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbarcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbarcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7bcdcf973c25295b9a44770a9e58bc9192d049d0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbarcolor_test.cpp @@ -0,0 +1,304 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_scrollbarcolor_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollScrollBarColorTest::CreateNativeNodeScrollBarColor(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollBarColorTest::CreateNativeNodeBlack(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollBarColorTest::CreateNativeNodeWhite(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollBarColorTest::CreateNativeNodeNull(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = napi_null}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollBarColorTest::CreateNativeNodeUndefined(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = napi_undefined}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollBarTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbarcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbarcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1c7a9e9fa8c95d3bb7a1fb10ca9e0406bab222e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollbarcolor_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_SCROLLBARCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_SCROLLBARCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollScrollBarColorTest { +public: + ~ScrollScrollBarColorTest(); + static napi_value CreateNativeNodeBlack(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeWhite(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeScrollBarColor(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNull(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUndefined(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_SCROLLBARCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrolledge_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrolledge_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f2f67abc082333405b8d8d3d7bb8e0c357692734 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrolledge_test.cpp @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_scrolledge_test.h" +#include + +#define ON_SCROLL_EVENT_ID 6007 +#define SIZE_320 320 + +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle scrollEdge; +static ArkUI_ScrollEdge edgeValue; + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_SCROLL_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } + + if (eventId == ON_CLICK_EVENT_ID) { + nodeAPI->registerNodeEvent(scrollEdge, NODE_SCROLL_EVENT_ON_SCROLL, ON_SCROLL_EVENT_ID, nullptr); + ArkUI_NumberValue edge_value[] = {{.i32 = edgeValue}}; + ArkUI_AttributeItem edge_item = {edge_value, sizeof(edge_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scrollEdge, NODE_SCROLL_EDGE, &edge_item); + return; + } +} + +napi_value ScrollScrollEdgeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", "CreateNativeNode"); + + size_t argc = PARAM_2; + napi_value args[PARAM_2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", "GetContext env or info is null"); + return nullptr; + } + + int32_t value; + napi_get_value_int32(env, args[PARAM_1], &value); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + scrollEdge = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "ScrollEdge"; + nodeAPI->setAttribute(scrollEdge, NODE_ID, &id_item); + id_item.string = "ScrollEdgeButton"; + nodeAPI->setAttribute(button, NODE_ID, &id_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scrollEdge, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scrollEdge, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = SIZE_320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scrollEdge, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scrollEdge, NODE_BACKGROUND_COLOR, &background_color_item); + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", "GetParam value: %{public}d", value); + + if (PARAM_0 == value) { + edgeValue = ARKUI_SCROLL_EDGE_TOP; + } else if (PARAM_1 == value) { + edgeValue = ARKUI_SCROLL_EDGE_BOTTOM; + } else if (PARAM_2 == value) { + edgeValue = ARKUI_SCROLL_EDGE_START; + ArkUI_NumberValue direction_value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_HORIZONTAL}}; + ArkUI_AttributeItem direction_item = {direction_value, sizeof(direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scrollEdge, NODE_SCROLL_SCROLL_DIRECTION, &direction_item); + } else if (PARAM_3 == value) { + edgeValue = ARKUI_SCROLL_EDGE_END; + ArkUI_NumberValue direction_value[] = {{.i32 = ARKUI_SCROLL_DIRECTION_HORIZONTAL}}; + ArkUI_AttributeItem direction_item = {direction_value, sizeof(direction_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scrollEdge, NODE_SCROLL_SCROLL_DIRECTION, &direction_item); + } + + ArkUI_NumberValue offset_value[] = {{.f32 = PARAM_8}, {.f32 = PARAM_8}}; + ArkUI_AttributeItem offset_item = {offset_value, sizeof(offset_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scrollEdge, NODE_SCROLL_OFFSET, &offset_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(button, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scrollEdge) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollOnScrollTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrolledge_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrolledge_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0ff78e4aed08422d23121a80693b8c69959b9976 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrolledge_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_SCROLLEDGE_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_SCROLLEDGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollScrollEdgeTest { +public: + ~ScrollScrollEdgeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_SCROLLEDGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollsnap_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollsnap_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..26513c10dc2244b52ff3a4f1e4baa8c7667c6fcc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollsnap_test.cpp @@ -0,0 +1,412 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_scrollsnap_test.h" + +#define PARAM_NUMBER 2 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + char scrollID[64] = {0}; + napi_get_value_string_utf8(env, args[1], scrollID, length, &strLength); + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button1 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button2 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto button3 = nodeAPI->createNode(ARKUI_NODE_BUTTON); + ArkUI_AttributeItem id_item = {}; + id_item.string = scrollID; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(column, button1); + nodeAPI->addChild(column, button2); + nodeAPI->addChild(column, button3); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + nodeAPI->setAttribute(button1, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button1, NODE_HEIGHT, &button_height_item); + nodeAPI->setAttribute(button2, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button2, NODE_HEIGHT, &button_height_item); + nodeAPI->setAttribute(button3, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button3, NODE_HEIGHT, &button_height_item); + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollSnapTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollScrollSnapTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_SNAP_ALIGN_NONE}, {.i32 = true}, {.i32 = true}, {.f32 = 0}, {.f32 = 100}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SNAP, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollSnapTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollSnapTest::CreateNativeNodeStart(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_SNAP_ALIGN_START}, {.i32 = true}, {.i32 = true}, {.f32 = 0}, {.f32 = 100}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SNAP, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollSnapTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollSnapTest::CreateNativeNodeCenter(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_SNAP_ALIGN_CENTER}, {.i32 = true}, {.i32 = true}, {.f32 = 0}, {.f32 = 100}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SNAP, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollSnapTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollSnapTest::CreateNativeNodeEnd(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_SNAP_ALIGN_END}, {.i32 = true}, {.i32 = true}, {.f32 = 0}, {.f32 = 100}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SNAP, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollSnapTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollSnapTest::CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = -10}, {.i32 = true}, {.i32 = true}, {.f32 = 100}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SNAP, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollSnapTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollScrollSnapTest::CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = 10}, {.i32 = true}, {.i32 = true}, {.f32 = 100}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_SNAP, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollSnapTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollsnap_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollsnap_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1d350b2f7f6af947864795c9ce024d3ea2a30891 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollsnap_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_SCROLLSNAP_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_SCROLLSNAP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollScrollSnapTest { +public: + ~ScrollScrollSnapTest(); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeStart(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCenter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnd(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLowerAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUpperAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_SCROLLSNAP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollto_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollto_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c4d49d6dd74ccca09c98b5ba0dab2bc2f210bfaf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollto_test.cpp @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_scrollto_test.h" +#include + +#define ON_SCROLL_EVENT_ID 6007 +#define SIZE_320 320 +#define PARAM_1 1 +#define PARAM_0 0 +#define COLOR_RED 0xFFFF0000 +#define COLOR_GREEN 0xFF00FF00 + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollScrollToTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollToTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_SCROLL_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value ScrollScrollToTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ScrollScrollToTest", "CreateNativeNode"); + + size_t argc = 2; + napi_value args[2] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + char scrollID[64] = {0}; + napi_get_value_string_utf8(env, args[1], scrollID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollToTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_AttributeItem id_item = {}; + id_item.string = scrollID; + nodeAPI->setAttribute(scroll, NODE_ID, &id_item); + + ArkUI_AnimationCurve arkUI_AnimationCurve; + if (strcmp(scrollID, "ScrollScrollToLinearTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_LINEAR; + } else if (strcmp(scrollID, "ScrollScrollToEaseTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_EASE; + } else if (strcmp(scrollID, "ScrollScrollToEaseInTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_EASE_IN; + } else if (strcmp(scrollID, "ScrollScrollToEaseOutTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_EASE_OUT; + } else if (strcmp(scrollID, "ScrollScrollToEaseInOutTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_EASE_IN_OUT; + } else if (strcmp(scrollID, "ScrollScrollToFastOutSlowInTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_FAST_OUT_SLOW_IN; + } else if (strcmp(scrollID, "ScrollScrollToLinearOutSlowInTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_LINEAR_OUT_SLOW_IN; + } else if (strcmp(scrollID, "ScrollScrollToFastOutLinearInTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_FAST_OUT_LINEAR_IN; + } else if (strcmp(scrollID, "ScrollScrollToExtremeDecelerationTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_EXTREME_DECELERATION; + } else if (strcmp(scrollID, "ScrollScrollToSharpTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_SHARP; + } else if (strcmp(scrollID, "ScrollScrollToRhythmTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_RHYTHM; + } else if (strcmp(scrollID, "ScrollScrollToSmoothTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_SMOOTH; + } else if (strcmp(scrollID, "ScrollScrollToFrictionTest") == 0) { + arkUI_AnimationCurve = ARKUI_CURVE_FRICTION; + } + + ArkUI_NumberValue offset_value[] = { + {.f32 = 10}, {.f32 = 10}, {.i32 = 1000}, {.i32 = arkUI_AnimationCurve}, {.i32 = 1}}; + ArkUI_AttributeItem offset_item = {offset_value, sizeof(offset_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_OFFSET, &offset_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue button_length_value[] = {{.f32 = 320}}; + ArkUI_AttributeItem button_length_item = {button_length_value, + sizeof(button_length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_length_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_length_item); + + nodeAPI->addChild(scroll, column); + nodeAPI->addChild(column, button); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(scroll, NODE_SCROLL_EVENT_ON_SCROLL, ON_SCROLL_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), scroll) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollScrollToTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollto_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollto_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f2384a81e8ea1724c6a2af6cb98768f7294f8956 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_scrollto_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_SCROLLTO_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_SCROLLTO_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollScrollToTest { +public: + ~ScrollScrollToTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_SCROLLTO_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_shadow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_shadow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0162bb299594530f3868792a633ab601eb3d8b6d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_shadow_test.cpp @@ -0,0 +1,368 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_shadow_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffffffff}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollShadowTest::CreateNativeNodeMin(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SHADOW, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollShadowTest::CreateNativeNodeLittle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SHADOW, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollShadowTest::CreateNativeNodeMiddle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SHADOW, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollShadowTest::CreateNativeNodeFloatMiddle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SHADOW, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollShadowTest::CreateNativeNodeBig(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SHADOW, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollShadowTest::CreateNativeNodeFloatLittle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SHADOW, &value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_shadow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_shadow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1bfb8c30576f2f9e430c945dcb0f67d8b22b042f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_shadow_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SHADOW_TEST_H +#define ARKUI_CAPI_DEMO_SHADOW_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollShadowTest { +public: + ~ScrollShadowTest(); + static napi_value CreateNativeNodeMin(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLittle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMiddle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBig(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFloatLittle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFloatMiddle(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SHADOW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_translate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_translate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..695193055aff57a4e168a4181c3dff3323b7ed07 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_translate_test.cpp @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "scroll_translate_test.h" + +#define PARAM_NUMBER 1 +#define LENGTH 64 +#define STRLENGTH 0 +#define ABNORMAL_PARAM 1000 +#define PARAM_ERROR 401 +namespace ArkUICApiDemo { + +static ArkUI_NodeHandle BasicSet(napi_env env, napi_callback_info info, ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Test", "GetContext env or info is null"); + return nullptr; + } + + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建组件 + auto scroll = nodeAPI->createNode(ARKUI_NODE_SCROLL); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto button = nodeAPI->createNode(ARKUI_NODE_BUTTON); + + // 嵌套组件 + nodeAPI->addChild(column, button); + nodeAPI->addChild(scroll, column); + + // 设置子组件基础属性 + ArkUI_NumberValue button_width_value[] = {{.f32 = 100}}; + ArkUI_NumberValue button_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem button_width_item = {button_width_value, + sizeof(button_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem button_height_item = {button_height_value, + sizeof(button_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(button, NODE_WIDTH, &button_width_item); + nodeAPI->setAttribute(button, NODE_HEIGHT, &button_height_item); + + // 设置scroll基础属性 + ArkUI_NumberValue length_value[] = {{.f32 = 200}}; + ArkUI_NumberValue scroll_color_value[] = {{.u32 = 0xffff0000}}; + ArkUI_AttributeItem length_item = {length_value, sizeof(length_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &length_item); + nodeAPI->setAttribute(scroll, NODE_HEIGHT, &length_item); + ArkUI_AttributeItem color_item = {scroll_color_value, sizeof(scroll_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &color_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + return scroll; +} + +napi_value ScrollTranslateTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_ON}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + ArkUI_NumberValue value[] = {{.f32 = 0}, {.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_TRANSLATE, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollTranslateTest::CreateNativeNodeDefault(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = PARAM_NUMBER; + napi_value args[PARAM_NUMBER] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = LENGTH; + size_t strLength = STRLENGTH; + char xComponentID[LENGTH] = {STRLENGTH}; + napi_get_value_string_utf8(env, args[STRLENGTH], xComponentID, length, &strLength); + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto scroll = BasicSet(env, info, nodeAPI); + + // 设置目标组件测试属性 + ArkUI_NumberValue attribute_value[] = {{.u32 = 0xffff0000}}; + ArkUI_NodeAttributeType type = NODE_SCROLL_BAR_DISPLAY_MODE; + ArkUI_AttributeItem attribute_item = {attribute_value, sizeof(attribute_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, type, &attribute_item); + + ArkUI_NumberValue scroll_bar_color_value[] = {{.u32 = 0xff00ff00}}; + ArkUI_AttributeItem bar_color_item = {scroll_bar_color_value, + sizeof(scroll_bar_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_SCROLL_BAR_COLOR, &bar_color_item); + + ArkUI_NumberValue value[] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_TRANSLATE, &value_item); + + ArkUI_NumberValue background_value[] = {{.u32 = 1000}}; + ArkUI_AttributeItem background_value_item = {background_value, + sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_BACKGROUND_COLOR, &background_value_item); + + // 挂载组件 + std::string idScroll(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idScroll), scroll) == + PARAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_translate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_translate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b4e13dc017583657393865de0fa48f1385efa94f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_translate_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TRANSLATE_TEST_H +#define ARKUI_CAPI_DEMO_TRANSLATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollTranslateTest { +public: + ~ScrollTranslateTest(); + static napi_value CreateNativeNodeDefault(napi_env env, napi_callback_info info); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TRANSLATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..be08d4e8776f9c1bd82b9eacdf7253fc41b90ec3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_width_test.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "scroll_width_test.h" +#include "scroll_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ScrollWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + ScrollCommon::ScrollPropertiesInit init_flags = {true, true, true, false}; + + // first scroll,设置宽度为300 + auto scroll = ScrollCommon::CreateScroll(init_flags); + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + // second scroll,设置宽度为异常值 + auto scroll_second = ScrollCommon::CreateScroll(init_flags); + ArkUI_NumberValue width_second_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, scroll); + nodeAPI->insertChildAfter(column, scroll_second, scroll); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ScrollWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollWidthTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + ScrollCommon::ScrollPropertiesInit init_flags = {false, true, true, false}; + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为超大值10000 + auto scroll = ScrollCommon::CreateScroll(init_flags); + ArkUI_NumberValue width_value[] = {{.f32 = 10000}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(scroll, NODE_WIDTH, &width_item); + + nodeAPI->addChild(column, scroll); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ScrollWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..31603f7cea9edac99496a63815a966d2845743f9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/scroll/scroll_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SCROLL_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_SCROLL_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ScrollWidthTest { +public: + ~ScrollWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SCROLL_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..94147bb3d0dbf3354e89330402925b3d4de8b5b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockcolor_test.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_blockcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderBlockColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderBlockColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderBlockColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置红色 + auto sliderRed = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueRed[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem value_itemRed = {valueRed, sizeof(valueRed) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderRed, NODE_SLIDER_BLOCK_COLOR, &value_itemRed); + + // 滑块类型设置图片效果,设置蓝色不生效 + auto sliderImage = nodeAPI->createNode(ARKUI_NODE_SLIDER); + int32_t blockStyle = ARKUI_SLIDER_BLOCK_STYLE_IMAGE; + const char *imageUrl = "./resources/base/media/icon.png"; + ArkUI_NumberValue valueImage[] = {{.i32 = blockStyle}}; + ArkUI_AttributeItem valueItemImage = {valueImage, sizeof(valueImage) / sizeof(ArkUI_NumberValue), imageUrl}; + nodeAPI->setAttribute(sliderImage, NODE_SLIDER_BLOCK_STYLE, &valueItemImage); + ArkUI_NumberValue valueBlue[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem valueItemBlue = {valueBlue, sizeof(valueBlue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderImage, NODE_SLIDER_BLOCK_COLOR, &valueItemBlue); + + // 滑块设成矩形,设置绿色 + auto sliderRectangle = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueRectangle[] = {{.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, + {.i32 = ARKUI_SHAPE_TYPE_RECTANGLE}, + {.f32 = 20.00}, + {.f32 = 20.00}, + {.f32 = 5.00}, + {.f32 = 5.00}}; + ArkUI_AttributeItem valueItemRectangle = {valueRectangle, sizeof(valueRectangle) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderRectangle, NODE_SLIDER_BLOCK_STYLE, &valueItemRectangle); + ArkUI_NumberValue valueGreen[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem valueItemGreen = {valueGreen, sizeof(valueGreen) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderRectangle, NODE_SLIDER_BLOCK_COLOR, &valueItemGreen); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderRed); + nodeAPI->addChild(column, sliderImage); + nodeAPI->addChild(column, sliderRectangle); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderBlockColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..30fbbe4379cabd8051f3ea5946f2805b2c9f3f65 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_BLOCKCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_BLOCKCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderBlockColorTest { +public: + ~SliderBlockColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_BLOCKCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..502a172fc58ca0ea9773409ff446bdd32ec4fd44 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockstyle_test.cpp @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_blockstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderBlockStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderBlockStyleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderBlockColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 默认效果 + auto sliderDefault = nodeAPI->createNode(ARKUI_NODE_SLIDER); + // image滑块效果 + auto sliderImage = nodeAPI->createNode(ARKUI_NODE_SLIDER); + int32_t blockStyle = ARKUI_SLIDER_BLOCK_STYLE_IMAGE; + const char *imageUrl = "./resources/base/media/icon.png"; + ArkUI_NumberValue valueImage[] = {{.i32 = blockStyle}}; + ArkUI_AttributeItem valueItemImage = {valueImage, sizeof(valueImage) / sizeof(ArkUI_NumberValue), imageUrl}; + nodeAPI->setAttribute(sliderImage, NODE_SLIDER_BLOCK_STYLE, &valueItemImage); + + // 矩形滑块效果 + auto sliderRectangle = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueRectangle[] = {{.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, + {.i32 = ARKUI_SHAPE_TYPE_RECTANGLE}, + {.f32 = 20.00}, + {.f32 = 20.00}, + {.f32 = 5.00}, + {.f32 = 5.00}}; + ArkUI_AttributeItem valueItemRectangle = {valueRectangle, sizeof(valueRectangle) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderRectangle, NODE_SLIDER_BLOCK_STYLE, &valueItemRectangle); + + // 圆形滑块效果 + auto sliderCircle = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueCircle[] = { + {.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, {.i32 = ARKUI_SHAPE_TYPE_CIRCLE}, {.f32 = 21.00}, {.f32 = 21.00}}; + ArkUI_AttributeItem valueItemCircle = {valueCircle, sizeof(valueCircle) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderCircle, NODE_SLIDER_BLOCK_STYLE, &valueItemCircle); + + // 椭圆形滑块效果 + auto sliderEllipse = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueEllipse[] = { + {.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, {.i32 = ARKUI_SHAPE_TYPE_ELLIPSE}, {.f32 = 22}, {.f32 = 20}}; + ArkUI_AttributeItem valueItemEllipse = {valueEllipse, sizeof(valueEllipse) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderEllipse, NODE_SLIDER_BLOCK_STYLE, &valueItemEllipse); + + // 路径滑块效果 + auto sliderPath = nodeAPI->createNode(ARKUI_NODE_SLIDER); + const char *path = "M0 0 H50 V50 H0 Z"; + ArkUI_NumberValue valuePath[] = { + {.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, {.i32 = ARKUI_SHAPE_TYPE_PATH}, {.f32 = 23.00}, {.f32 = 23.00}}; + ArkUI_AttributeItem valueItemPath = {valuePath, sizeof(valuePath) / sizeof(ArkUI_NumberValue), path}; + nodeAPI->setAttribute(sliderPath, NODE_SLIDER_BLOCK_STYLE, &valueItemPath); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderDefault); + nodeAPI->addChild(column, sliderImage); + nodeAPI->addChild(column, sliderRectangle); + nodeAPI->addChild(column, sliderCircle); + nodeAPI->addChild(column, sliderEllipse); + nodeAPI->addChild(column, sliderPath); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderBlockStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderBlockStyleTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderBlockStyleTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderBlockColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // image滑块效果(图片路径为空) + auto sliderImage = nodeAPI->createNode(ARKUI_NODE_SLIDER); + int32_t blockStyle = ARKUI_SLIDER_BLOCK_STYLE_IMAGE; + const char *imageUrl = nullptr; + ArkUI_NumberValue valueImage[] = {{.i32 = blockStyle}}; + ArkUI_AttributeItem valueItemImage = {valueImage, sizeof(valueImage) / sizeof(ArkUI_NumberValue), imageUrl}; + nodeAPI->setAttribute(sliderImage, NODE_SLIDER_BLOCK_STYLE, &valueItemImage); + + // 矩形滑块效果(长度均为负值) + auto sliderRectangle = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueRectangle[] = {{.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, + {.i32 = ARKUI_SHAPE_TYPE_RECTANGLE}, + {.f32 = -20.00}, + {.f32 = -20.00}, + {.f32 = -5.00}, + {.f32 = -5.00}}; + ArkUI_AttributeItem valueItemRectangle = {valueRectangle, sizeof(valueRectangle) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderRectangle, NODE_SLIDER_BLOCK_STYLE, &valueItemRectangle); + + // 圆形滑块效果(长度均为负值) + auto sliderCircle = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueCircle[] = { + {.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, {.i32 = ARKUI_SHAPE_TYPE_CIRCLE}, {.f32 = -21.00}, {.f32 = -21.00}}; + ArkUI_AttributeItem valueItemCircle = {valueCircle, sizeof(valueCircle) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderCircle, NODE_SLIDER_BLOCK_STYLE, &valueItemCircle); + + // 椭圆形滑块效果(长度均为负值) + auto sliderEllipse = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueEllipse[] = { + {.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, {.i32 = ARKUI_SHAPE_TYPE_ELLIPSE}, {.f32 = -22.00}, {.f32 = -20.00}}; + ArkUI_AttributeItem valueItemEllipse = {valueEllipse, sizeof(valueEllipse) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderEllipse, NODE_SLIDER_BLOCK_STYLE, &valueItemEllipse); + + // 路径滑块效果(长度均为负值,.string传入空) + auto sliderPath = nodeAPI->createNode(ARKUI_NODE_SLIDER); + const char *path = nullptr; + ArkUI_NumberValue valuePath[] = { + {.i32 = ARKUI_SLIDER_BLOCK_STYLE_SHAPE}, {.i32 = ARKUI_SHAPE_TYPE_PATH}, {.f32 = -23.00}, {.f32 = -23.00}}; + ArkUI_AttributeItem valueItemPath = {valuePath, sizeof(valuePath) / sizeof(ArkUI_NumberValue), path}; + nodeAPI->setAttribute(sliderPath, NODE_SLIDER_BLOCK_STYLE, &valueItemPath); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderImage); + nodeAPI->addChild(column, sliderRectangle); + nodeAPI->addChild(column, sliderCircle); + nodeAPI->addChild(column, sliderEllipse); + nodeAPI->addChild(column, sliderPath); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderBlockColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..25d260bc770e18b005020bc24308150c8ac51b4d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_blockstyle_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_BLOCKSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_BLOCKSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderBlockStyleTest { +public: + ~SliderBlockStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_BLOCKSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_direction_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_direction_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d9bac4f9d6cf6af687207cb0011984a992767eb8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_direction_test.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_direction_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderDirectionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderDirectionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderDirectionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 默认效果 + auto sliderDefault = nodeAPI->createNode(ARKUI_NODE_SLIDER); + // 垂直效果 + auto sliderVertical = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueVertical[] = {{.i32 = ARKUI_SLIDER_DIRECTION_VERTICAL}}; + ArkUI_AttributeItem value_itemVertical = {valueVertical, sizeof(valueVertical) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderVertical, NODE_SLIDER_DIRECTION, &value_itemVertical); + + // 水平效果 + auto sliderHorizontal = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueHorizontal[] = {{.i32 = ARKUI_SLIDER_DIRECTION_HORIZONTAL}}; + ArkUI_AttributeItem value_itemHorizontal = {valueHorizontal, sizeof(valueHorizontal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderHorizontal, NODE_SLIDER_DIRECTION, &value_itemHorizontal); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(column, sliderDefault); + nodeAPI->addChild(column, sliderHorizontal); + nodeAPI->addChild(row, sliderVertical); + nodeAPI->addChild(row, column); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderDirectionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderDirectionTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderDirectionTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderDirectionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 枚举值异常 + auto sliderAbnormal = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueAbnormal[] = {{.i32 = 3}}; + ArkUI_AttributeItem valueItemAbnormal = {valueAbnormal, sizeof(valueAbnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderAbnormal, NODE_SLIDER_DIRECTION, &valueItemAbnormal); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderAbnormal); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderDirectionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_direction_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_direction_test.h new file mode 100644 index 0000000000000000000000000000000000000000..add4b4db8e7b4fd6fea27f5984db16173033b2d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_direction_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_DIRECTION_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_DIRECTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderDirectionTest { +public: + ~SliderDirectionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_DIRECTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_enabled_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_enabled_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..429cf9a909dc5436b9d01a253f0904f4cd13d22c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_enabled_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_enabled_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_SLIDER); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + // set background color + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + // set width + ArkUI_NumberValue width_value[] = {{.f32 = SLIDER_WIDTH_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // set height + ArkUI_NumberValue height_value[] = {{.f32 = SLIDER_HEIGHT_30}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "SliderEnabledTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderEnabledTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + uint32_t color = COLOR_PURPLE; + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + switch (eventId) { + case ON_CLICK_EVENT_ID: + color = COLOR_GREEN; + break; + case ON_FOCUS_EVENT_ID: + color = COLOR_BLUE; + break; + case ON_BLUR_EVENT_ID: + color = COLOR_YELLOW; + break; + default: + break; + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 如果是点击事件,修改背景色 + if (eventId == ON_CLICK_EVENT_ID) { + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } + + // 如果是获取焦点事件,修改滑轨的未滑动部分颜色 + if (eventId == ON_FOCUS_EVENT_ID) { + nodeAPI->setAttribute(nodeHandler, NODE_SLIDER_BLOCK_COLOR, &background_color_item); + return; + } + + // 如果是失去焦点事件,修改滑轨的滑块颜色 + if (eventId == ON_BLUR_EVENT_ID) { + nodeAPI->setAttribute(nodeHandler, NODE_SLIDER_TRACK_COLOR, &background_color_item); + return; + } +} + +napi_value SliderEnabledTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderEnabledTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderEnabledTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // set height + ArkUI_NumberValue col_height_value[] = {{.f32 = COLUMN_HEIGHT_700}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // set width + ArkUI_NumberValue col_width_value[] = {{.f32 = COLUMN_WIDTH_150}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + // set alignment + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + + // first slider + auto slider = createChildNode(nodeAPI, PARAM_1); + + // second slider + auto sliderDisabled = createChildNode(nodeAPI, PARAM_0); + + // third slider + auto sliderAbnormal = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + + // set slider ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnClickEnabledSlider"; + nodeAPI->setAttribute(slider, NODE_ID, &id_item); + ArkUI_AttributeItem id_second_item = {}; + id_second_item.string = "OnClickDisabledSlider"; + nodeAPI->setAttribute(sliderDisabled, NODE_ID, &id_second_item); + ArkUI_AttributeItem id_third_item = {}; + id_third_item.string = "OnClickAbnormalSlider"; + nodeAPI->setAttribute(sliderAbnormal, NODE_ID, &id_third_item); + + nodeAPI->addChild(column, slider); + nodeAPI->addChild(column, sliderDisabled); + nodeAPI->addChild(column, sliderAbnormal); + + // Bind click event + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_enabled_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_enabled_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d5cb3a03553fd3f9b94694f67ee6bff64616234b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_enabled_test.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_ENABLED_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_ENABLED_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +#define COLUMN_HEIGHT_700 700 +#define COLUMN_WIDTH_150 150 + +#define SLIDER_HEIGHT_30 30 +#define SLIDER_WIDTH_200 200 + +#define FOCUSABLE_TRUE 1 + +class SliderEnabledTest { +public: + ~SliderEnabledTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_ENABLED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0a9fe779025a4978e1b16800f88cff3e06284ada --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_height_test.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置slider组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置slider组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置slider组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first slider,设置高度为200 + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(slider, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(slider, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(slider, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // second slider,设置高度为异常值 + auto slider_second = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->setAttribute(slider_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(slider_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(slider_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(slider_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(parentColumn, slider); + nodeAPI->insertChildAfter(parentColumn, slider_second, slider); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent parentColumn + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_HEIGHT, &col_height_item); + + // 设置高度为超大值500 + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &height_item); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置slider组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &default_width_item); + + nodeAPI->addChild(parentColumn, slider); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7eb187266b0581badeb5ad6fe67eded9bea5ead2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderHeightTest { +public: + ~SliderHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_max_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_max_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8886ee41e102109a3b7615db0d5c92b0be453a87 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_max_test.cpp @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "slider_max_test.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderMaxTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 最大值设为90 + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue maxValue[] = {{.f32 = 90.00}}; + ArkUI_AttributeItem maxValueItem = {maxValue, sizeof(maxValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_SLIDER_MAX_VALUE, &maxValueItem); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, slider); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderMaxTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 最大值设为负值 + auto sliderAbnormal = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueAbnormal[] = {{.f32 = -100}}; + ArkUI_AttributeItem valueItemAbnormal = {valueAbnormal, sizeof(valueAbnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderAbnormal, NODE_SLIDER_MAX_VALUE, &valueItemAbnormal); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderAbnormal); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderMaxTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 最大值超过100 + auto sliderLarge = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueLarge[] = {{.f32 = 101}}; + ArkUI_AttributeItem valueItemLarge = {valueLarge, sizeof(valueLarge) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderLarge, NODE_SLIDER_MAX_VALUE, &valueItemLarge); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderLarge); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderMaxTest::CreateNativeNodeMaxEqualMin(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 最大值超过100 + auto sliderEqual = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueEqual[] = {{.f32 = 50}}; + ArkUI_AttributeItem valueItemEqual = {valueEqual, sizeof(valueEqual) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderEqual, NODE_SLIDER_MIN_VALUE, &valueItemEqual); + + nodeAPI->setAttribute(sliderEqual, NODE_SLIDER_MAX_VALUE, &valueItemEqual); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderEqual); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMaxTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_max_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_max_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b7291a547847f2d24fc3ac355f9166def48afcfa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_max_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_MAX_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_MAX_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderMaxTest { +public: + ~SliderMaxTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMaxEqualMin(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_MAX_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_min_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_min_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..329b2d0b57b9e852bfaf4ef613f9637663049315 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_min_test.cpp @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_min_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderMinTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMinTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMinTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 最小值设为20 + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue minValue[] = {{.f32 = 20.00}}; + ArkUI_AttributeItem minValueItem = {minValue, sizeof(minValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_SLIDER_MIN_VALUE, &minValueItem); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, slider); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMinTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderMinTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMinTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMinTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 最小值设为负值 + auto sliderAbnormal = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueAbnormal[] = {{.f32 = -20}}; + ArkUI_AttributeItem valueItemAbnormal = {valueAbnormal, sizeof(valueAbnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderAbnormal, NODE_SLIDER_MIN_VALUE, &valueItemAbnormal); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderAbnormal); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMinTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderMinTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMinTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMinTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 进度值异常 + auto sliderLarge = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueLarge[] = {{.f32 = 101}}; + ArkUI_AttributeItem valueItemLarge = {valueLarge, sizeof(valueLarge) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderLarge, NODE_SLIDER_MIN_VALUE, &valueItemLarge); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderLarge); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderMinTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_min_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_min_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5fb4ae881ed29cb694d84071ec574ddb916871d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_min_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_MIN_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_MIN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderMinTest { +public: + ~SliderMinTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_MIN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_onchange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_onchange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f03887b4b3fea6b4b030f90ffd44df74e7373792 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_onchange_test.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_onchange_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define ON_CHANGE_EVENT_ID 6007 + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "SliderOnChangeTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderOnChangeTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + + if (eventId == ON_CHANGE_EVENT_ID) { + ArkUI_NumberValue trackColorValue[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem trackColorItem = {trackColorValue, sizeof(trackColorValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_SLIDER_TRACK_COLOR, &trackColorItem); + } +} + +napi_value SliderOnChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderOnChangeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderOnChangeTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // slider + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_AttributeItem idItem = {}; + idItem.string = "OnChangeSlider"; + nodeAPI->setAttribute(slider, NODE_ID, &idItem); + + nodeAPI->addChild(column, slider); + + // Bind click event + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(slider, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(slider, NODE_SLIDER_EVENT_ON_CHANGE, ON_CHANGE_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderOnChangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_onchange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_onchange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8dc1f5a48280634eb25712a01a74e270700e76a5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_onchange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_ONCHANGE_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_ONCHANGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderOnChangeTest { +public: + ~SliderOnChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_VALUE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_reverse_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_reverse_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3cdac6bacf635bcb980cec1db844e9f648abaf13 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_reverse_test.cpp @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_reverse_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderReverseTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderReverseTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderReverseTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置为反向 + auto sliderTrue = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueTrue[] = {{.i32 = 1}}; + ArkUI_AttributeItem valueItemTrue = {valueTrue, sizeof(valueTrue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderTrue, NODE_SLIDER_REVERSE, &valueItemTrue); + // 设置为正向 + auto sliderFalse = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueFalse[] = {{.i32 = 0}}; + ArkUI_AttributeItem valueItemFalse = {valueFalse, sizeof(valueFalse) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderFalse, NODE_SLIDER_REVERSE, &valueItemFalse); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderTrue); + nodeAPI->addChild(column, sliderFalse); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderReverseTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderReverseTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderReverseTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderReverseTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 传入参数为负值 + auto sliderAbnormal = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueAbnormal[] = {{.i32 = -1}}; + ArkUI_AttributeItem valueItemAbnormal = {valueAbnormal, sizeof(valueAbnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderAbnormal, NODE_SLIDER_REVERSE, &valueItemAbnormal); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderAbnormal); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderReverseTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderReverseTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderReverseTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderReverseTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 传入参数超范围 + auto sliderLarge = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueLarge[] = {{.i32 = 2}}; + ArkUI_AttributeItem valueItemLarge = {valueLarge, sizeof(valueLarge) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderLarge, NODE_SLIDER_REVERSE, &valueItemLarge); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderLarge); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderReverseTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_reverse_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_reverse_test.h new file mode 100644 index 0000000000000000000000000000000000000000..80ed83858fdef06b5b5991db56a8d84401b5cc51 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_reverse_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_REVERSE_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_REVERSE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderReverseTest { +public: + ~SliderReverseTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_REVERSE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_selectedcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_selectedcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2e533c934407aa38d63dc596d11bd92f3103aeef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_selectedcolor_test.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_selectedcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderSelectedColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderSelectedColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderSelectedColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 默认效果 + auto sliderDefault = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueProgress[] = {{.f32 = 50.00}}; + ArkUI_AttributeItem value_itemProgress = {valueProgress, sizeof(valueProgress) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderDefault, NODE_SLIDER_VALUE, &value_itemProgress); + // 设置红色 + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem valueItem = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_SLIDER_SELECTED_COLOR, &valueItem); + nodeAPI->setAttribute(slider, NODE_SLIDER_VALUE, &value_itemProgress); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderDefault); + nodeAPI->addChild(column, slider); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderSelectedColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_selectedcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_selectedcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..98b8ad72a0d4658241a33a374430b6110de62286 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_selectedcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_SELECTEDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_SELECTEDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderSelectedColorTest { +public: + ~SliderSelectedColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_SELECTEDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_showsteps_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_showsteps_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..01b9220761d1a79aca11e28657b9af12e01f1b92 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_showsteps_test.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_showsteps_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderShowStepsTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderShowStepsTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderShowStepsTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置参数为1 + auto sliderSteps = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue value[] = {{.i32 = 1}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderSteps, NODE_SLIDER_SHOW_STEPS, &value_item); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderSteps); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderShowStepsTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderShowStepsTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderShowStepsTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderShowStepsTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 传入参数超范围 + auto sliderAbnormal = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueAbnormal[] = {{.i32 = 3}}; + ArkUI_AttributeItem valueItemAbnormal = {valueAbnormal, sizeof(valueAbnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderAbnormal, NODE_SLIDER_SHOW_STEPS, &valueItemAbnormal); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderAbnormal); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderShowStepsTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_showsteps_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_showsteps_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f2a5dc3f3977953fe1607188a51838bd2e0e4b33 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_showsteps_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_SHOWSTEPS_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_SHOWSTEPS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderShowStepsTest { +public: + ~SliderShowStepsTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_SHOWSTEPS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_step_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_step_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c4fd7e67af98a36ba1acf9646cd79ced4ffd82a5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_step_test.cpp @@ -0,0 +1,256 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "slider_step_test.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderStepTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 默认效果 + auto sliderDefault = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueShowSteps[] = {{.i32 = 1}}; + ArkUI_AttributeItem value_itemShowSteps = {valueShowSteps, sizeof(valueShowSteps) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderDefault, NODE_SLIDER_SHOW_STEPS, &value_itemShowSteps); + + // 滑动步长设置为10 + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue value[] = {{.f32 = 30}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_SLIDER_STEP, &value_item); + + ArkUI_NumberValue max_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem max_value_item = {max_value, sizeof(max_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_SLIDER_MAX_VALUE, &max_value_item); + + ArkUI_NumberValue selectedValue[] = {{.f32 = 1}}; + ArkUI_AttributeItem selectedItem = {selectedValue, sizeof(selectedValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_SLIDER_VALUE, &selectedItem); + + nodeAPI->setAttribute(slider, NODE_SLIDER_SHOW_STEPS, &value_itemShowSteps); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderDefault); + nodeAPI->addChild(column, slider); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderStepTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 默认效果 + auto sliderDefault = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueShowSteps[] = {{.i32 = 1}}; + ArkUI_AttributeItem value_itemShowSteps = {valueShowSteps, sizeof(valueShowSteps) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderDefault, NODE_SLIDER_SHOW_STEPS, &value_itemShowSteps); + + // 滑动步长设置为负值 + auto sliderNegative = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueNegative[] = {{.f32 = -10.00}}; + ArkUI_AttributeItem value_itemNegative = {valueNegative, sizeof(valueNegative) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderNegative, NODE_SLIDER_STEP, &value_itemNegative); + nodeAPI->setAttribute(sliderNegative, NODE_SLIDER_SHOW_STEPS, &value_itemShowSteps); + + // 滑动步长设置为更小单位 + auto sliderAbnormal = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueAbnormal[] = {{.f32 = 0.001}}; + ArkUI_AttributeItem value_itemAbnormal = {valueAbnormal, sizeof(valueAbnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderAbnormal, NODE_SLIDER_STEP, &value_itemAbnormal); + nodeAPI->setAttribute(sliderAbnormal, NODE_SLIDER_SHOW_STEPS, &value_itemShowSteps); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderDefault); + nodeAPI->addChild(column, sliderNegative); + nodeAPI->addChild(column, sliderAbnormal); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderStepTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 滑动步长设置值超出范围 + auto sliderLarge = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueShowSteps[] = {{.i32 = 1}}; + ArkUI_AttributeItem value_itemShowSteps = {valueShowSteps, sizeof(valueShowSteps) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue valueLarge[] = {{.f32 = 101}}; + ArkUI_AttributeItem valueItemLarge = {valueLarge, sizeof(valueLarge) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderLarge, NODE_SLIDER_VALUE, &valueItemLarge); + nodeAPI->setAttribute(sliderLarge, NODE_SLIDER_SHOW_STEPS, &value_itemShowSteps); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderLarge); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderStepTest::CreateNativeNodeUneven(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 默认效果 + auto sliderDefault = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueShowSteps[] = {{.i32 = 1}}; + ArkUI_AttributeItem value_itemShowSteps = {valueShowSteps, sizeof(valueShowSteps) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderDefault, NODE_SLIDER_SHOW_STEPS, &value_itemShowSteps); + + // 滑动步长设置为10 + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue value[] = {{.f32 = 30}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_SLIDER_STEP, &value_item); + + ArkUI_NumberValue max_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem max_value_item = {max_value, sizeof(max_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_SLIDER_MAX_VALUE, &max_value_item); + + ArkUI_NumberValue selectedValue[] = {{.f32 = 1}}; + ArkUI_AttributeItem selectedItem = {selectedValue, sizeof(selectedValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_SLIDER_VALUE, &selectedItem); + + nodeAPI->setAttribute(slider, NODE_SLIDER_SHOW_STEPS, &value_itemShowSteps); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderDefault); + nodeAPI->addChild(column, slider); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStepTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_step_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_step_test.h new file mode 100644 index 0000000000000000000000000000000000000000..26c95429e500bf3d764ebd08599dbb86d2251f86 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_step_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_STEP_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_STEP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderStepTest { +public: + ~SliderStepTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeUneven(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_STEP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_style_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_style_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..650bb3176b71b9a8ea108b4179b18910f2cb606f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_style_test.cpp @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_style_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStyleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStyleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 默认效果 + auto sliderDefault = nodeAPI->createNode(ARKUI_NODE_SLIDER); + // 显示样式设置为in + auto sliderIn = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueIn[] = {{.i32 = ARKUI_SLIDER_STYLE_IN_SET}}; + ArkUI_AttributeItem value_itemIn = {valueIn, sizeof(valueIn) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderIn, NODE_SLIDER_STYLE, &value_itemIn); + + // 显示样式设置为out + auto sliderOut = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueOut[] = {{.i32 = ARKUI_SLIDER_STYLE_OUT_SET}}; + ArkUI_AttributeItem value_itemOut = {valueOut, sizeof(valueOut) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderOut, NODE_SLIDER_STYLE, &value_itemOut); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderDefault); + nodeAPI->addChild(column, sliderIn); + nodeAPI->addChild(column, sliderOut); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderStyleTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStyleTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStyleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 传入参数为负值 + auto sliderAbnormal = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueAbnormal[] = {{.i32 = -1}}; + ArkUI_AttributeItem valueItemAbnormal = {valueAbnormal, sizeof(valueAbnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderAbnormal, NODE_SLIDER_STYLE, &valueItemAbnormal); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderAbnormal); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderStyleTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStyleTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStyleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 传入参数超范围 + auto sliderLarge = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueLarge[] = {{.i32 = 2}}; + ArkUI_AttributeItem valueItemLarge = {valueLarge, sizeof(valueLarge) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderLarge, NODE_SLIDER_VALUE, &valueItemLarge); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderLarge); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_style_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_style_test.h new file mode 100644 index 0000000000000000000000000000000000000000..03014d4eb6ce47865c562e12250fdaf0920b7e71 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_style_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_STYLE_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_STYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderStyleTest { +public: + ~SliderStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_STYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_trackcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_trackcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6e48474ed4b3b100cb2efc96586960d2ae7fcd16 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_trackcolor_test.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_trackcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderTrackColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderTrackColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderTrackColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 默认效果 + auto sliderDefault = nodeAPI->createNode(ARKUI_NODE_SLIDER); + // 设置红色 + auto sliderRed = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueRed[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem value_itemRed = {valueRed, sizeof(valueRed) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderRed, NODE_SLIDER_TRACK_COLOR, &value_itemRed); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderDefault); + nodeAPI->addChild(column, sliderRed); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderTrackColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_trackcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_trackcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e3dda184f57cdb02d4531aec6fcf2fa8033717f2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_trackcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_TRACKCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_TRACKCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderTrackColorTest { +public: + ~SliderTrackColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_TRACKCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_value_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_value_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..08d5980d7cc95a0ec6c03086c0a49af7ce56c30d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_value_test.cpp @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_value_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderValueTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderValueTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderValueTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 默认效果 + auto sliderDefault = nodeAPI->createNode(ARKUI_NODE_SLIDER); + // 进度值设置为10 + auto sliderProgress = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueProgress[] = {{.f32 = 10.00}}; + ArkUI_AttributeItem value_itemProgress = {valueProgress, sizeof(valueProgress) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderProgress, NODE_SLIDER_VALUE, &value_itemProgress); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderDefault); + nodeAPI->addChild(column, sliderProgress); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderValueTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderValueTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderValueTest", "CreateNativeNodeAbnormal"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderValueTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 进度值为负值 + auto sliderAbnormal = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueAbnormal[] = {{.f32 = -10}}; + ArkUI_AttributeItem valueItemAbnormal = {valueAbnormal, sizeof(valueAbnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderAbnormal, NODE_SLIDER_VALUE, &valueItemAbnormal); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderAbnormal); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderValueTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderValueTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderValueTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderValueTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 进度值异常 + auto sliderLarge = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue valueLarge[] = {{.f32 = 101}}; + ArkUI_AttributeItem valueItemLarge = {valueLarge, sizeof(valueLarge) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(sliderLarge, NODE_SLIDER_VALUE, &valueItemLarge); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, sliderLarge); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderValueTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_value_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_value_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a3cdd031c42b35191f67d6afa06445a3489f600f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_value_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_VALUE_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_VALUE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderValueTest { +public: + ~SliderValueTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_VALUE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d6e3ca9df2b09bda1e7fde3b70ac466eb04e1fe6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_width_test.cpp @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "slider_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SliderWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置slider组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置slider组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置slider组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first slider,设置宽度为300 + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(slider, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(slider, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(slider, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + // second slider,设置宽度为异常值 + auto slider_second = nodeAPI->createNode(ARKUI_NODE_SLIDER); + nodeAPI->setAttribute(slider_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(slider_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(slider_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(slider_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider_second, NODE_WIDTH, &width_second_item); + + // parent node + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(parentColumn, slider); + nodeAPI->insertChildAfter(parentColumn, slider_second, slider); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SliderWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderWidthTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent parentColumn + auto parentColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(parentColumn, NODE_HEIGHT, &col_height_item); + + // 设置宽度为超大值500 + auto slider = nodeAPI->createNode(ARKUI_NODE_SLIDER); + ArkUI_NumberValue width_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_WIDTH, &width_item); + + ArkUI_NumberValue default_height_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_HEIGHT, &default_height_item); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(slider, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->addChild(parentColumn, slider); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), parentColumn) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SliderWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ce506e2ee2a1b5b8c3cf2299af8c948afac78779 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/slider/slider_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SLIDER_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_SLIDER_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SliderWidthTest { +public: + ~SliderWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SLIDER_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_decoration_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_decoration_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..17240b99b886a5d137191f91324dfaed400fb2b9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_decoration_test.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "span_decoration_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle SpanDecorationTest::CreateSubNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t decorationType, + uint32_t color, std::string content) +{ + // 创建span组件 + auto span = nodeAPI->createNode(ARKUI_NODE_SPAN); + + // 设置span的decoration属性 + ArkUI_NumberValue decoration_value[] = {{.i32 = decorationType}, {.u32 = color}}; + ArkUI_AttributeItem decoration_item = {decoration_value, sizeof(decoration_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(span, NODE_TEXT_DECORATION, &decoration_item); + + // 设置span内容 + ArkUI_AttributeItem content_item = {.string = content.c_str()}; + nodeAPI->setAttribute(span, NODE_SPAN_CONTENT, &content_item); + + // 创建父节点text,加入span子组件 + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->addChild(text, span); + + return text; +} + +napi_value SpanDecorationTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanDecorationTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanDecorationTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // span first:无文本装饰线 + std::string content = "123456789"; + int32_t decorationType = ARKUI_TEXT_DECORATION_TYPE_NONE; + uint32_t color = 0x00000000; + auto span_first = CreateSubNode(nodeAPI, decorationType, color, content); + + // span second:红色下划线 + decorationType = ARKUI_TEXT_DECORATION_TYPE_UNDERLINE; + color = 0xFFFF0000; + auto span_second = CreateSubNode(nodeAPI, decorationType, color, content); + + // span third:黑色上划线 + decorationType = ARKUI_TEXT_DECORATION_TYPE_OVERLINE; + color = 0xFF000000; + auto span_third = CreateSubNode(nodeAPI, decorationType, color, content); + + // span fourth:白色中划线 + decorationType = ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH; + color = 0xFFFFFFFF; + auto span_fourth = CreateSubNode(nodeAPI, decorationType, color, content); + + // span fifth:无文本装饰线 + decorationType = -1; + color = 0xFF000000; + auto span_fifth = CreateSubNode(nodeAPI, decorationType, color, content); + + // 子组件加入到父容器 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, span_first); + nodeAPI->addChild(column, span_second); + nodeAPI->addChild(column, span_third); + nodeAPI->addChild(column, span_fourth); + nodeAPI->addChild(column, span_fifth); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为200vp,高度为500vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 500}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanDecorationTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_decoration_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_decoration_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7546aa951b7d658bd28d28b50b874cb1658ee67c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_decoration_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SPAN_DECORATION_TEST_H +#define ARKUI_CAPI_DEMO_SPAN_DECORATION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SpanDecorationTest { +public: + ~SpanDecorationTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static ArkUI_NodeHandle CreateSubNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t decorationType, uint32_t color, + std::string content); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SPAN_DECORATION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..20c74b9732ee55b49ceaeea84b8596b82b390fd3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontcolor_test.cpp @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "span_fontcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_SPAN); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + // span text + ArkUI_AttributeItem content_item = {}; + content_item.string = "123456789"; + nodeAPI->setAttribute(nodeHandle, NODE_SPAN_CONTENT, &content_item); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t fontColor) +{ + auto span = createDefaultChildNode(nodeAPI); + + // span font color + ArkUI_NumberValue fontColor_value[] = {{.u32 = fontColor}}; + ArkUI_AttributeItem fontColor_item = {fontColor_value, sizeof(fontColor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(span, NODE_FONT_COLOR, &fontColor_item); + + return span; +} + +static auto createTextChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle span) +{ + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BORDER_WIDTH, &border_item); + nodeAPI->addChild(text, span); + + return text; +} + +napi_value SpanFontColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "SpanFontColorTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanFontColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + + auto spanFirst = createTextChildNode(nodeAPI, createChildNode(nodeAPI, COLOR_TRANSPARENT)); + auto spanSecond = createTextChildNode(nodeAPI, createChildNode(nodeAPI, COLOR_RED)); + auto spanThird = createTextChildNode(nodeAPI, createChildNode(nodeAPI, COLOR_WHITE)); + + nodeAPI->addChild(rowFirst, spanFirst); + nodeAPI->addChild(rowSecond, spanSecond); + nodeAPI->addChild(rowThird, spanThird); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanFontColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fb294ae63b68c8e52d770fe20494274c0941e5be --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SPAN_FONTCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_SPAN_FONTCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SpanFontColorTest { +public: + ~SpanFontColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SPAN_FONTCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontsize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontsize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c3bae3c174588f5b44e9f90851863bf25d739512 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontsize_test.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "span_fontsize_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_SPAN); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + // span text + ArkUI_AttributeItem content_item = {}; + content_item.string = "123456789"; + nodeAPI->setAttribute(nodeHandle, NODE_SPAN_CONTENT, &content_item); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, float fontSize) +{ + auto span = createDefaultChildNode(nodeAPI); + + // span font size + ArkUI_NumberValue fontSize_value[] = {{.f32 = fontSize}}; + ArkUI_AttributeItem fontColor_item = {fontSize_value, sizeof(fontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(span, NODE_FONT_SIZE, &fontColor_item); + + return span; +} + +static auto createTextChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle span) +{ + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BORDER_WIDTH, &border_item); + nodeAPI->addChild(text, span); + + return text; +} + +napi_value SpanFontSizeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "SpanFontSizeTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanFontSizeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowFourth = nodeAPI->createNode(ARKUI_NODE_ROW); + + auto spanFirst = createTextChildNode(nodeAPI, createChildNode(nodeAPI, SIZE_10)); + auto spanSecond = createTextChildNode(nodeAPI, createChildNode(nodeAPI, PARAM_NEGATIVE_1)); + auto spanThird = createTextChildNode(nodeAPI, createChildNode(nodeAPI, SIZE_100)); + + nodeAPI->addChild(rowFirst, spanFirst); + nodeAPI->addChild(rowSecond, spanSecond); + nodeAPI->addChild(rowThird, spanThird); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanFontSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontsize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontsize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..de022dc3bd6a2fccd1de05e3a52c3797711846f9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontsize_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SPAN_FONTSIZE_TEST_H +#define ARKUI_CAPI_DEMO_SPAN_FONTSIZE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SpanFontSizeTest { +public: + ~SpanFontSizeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SPAN_FONTSIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9cf902a3b2e4e6e9a0e505acdabb899c083add53 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontstyle_test.cpp @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "span_fontstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_SPAN); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + // span text + ArkUI_AttributeItem content_item = {}; + content_item.string = "123456789"; + nodeAPI->setAttribute(nodeHandle, NODE_SPAN_CONTENT, &content_item); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t fontStyle) +{ + auto span = createDefaultChildNode(nodeAPI); + + // span font style + ArkUI_NumberValue fontStyle_value[] = {{.i32 = fontStyle}}; + ArkUI_AttributeItem fontStyle_item = {fontStyle_value, sizeof(fontStyle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(span, NODE_FONT_STYLE, &fontStyle_item); + + return span; +} + +static auto createTextChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle span) +{ + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BORDER_WIDTH, &border_item); + nodeAPI->addChild(text, span); + + return text; +} + +napi_value SpanFontStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "SpanFontStyleTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanFontStyleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + + auto spanFirst = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_STYLE_NORMAL)); + auto spanFirstEnd = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_STYLE_ITALIC)); + auto spanSecond = createTextChildNode(nodeAPI, createChildNode(nodeAPI, -1)); + + nodeAPI->addChild(rowFirst, spanFirst); + nodeAPI->addChild(rowFirst, spanFirstEnd); + nodeAPI->addChild(rowSecond, spanSecond); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanFontStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..75e75a6f26eb7063bfd7c15eb17e71dab4da96f3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SPAN_FONTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_SPAN_FONTSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SpanFontStyleTest { +public: + ~SpanFontStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SPAN_FONTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontweight_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontweight_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..755ef505fec0deb1799660f6bb0e3cb393d2284c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontweight_test.cpp @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "span_fontweight_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_SPAN); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + // span text + ArkUI_AttributeItem content_item = {}; + content_item.string = "123456789"; + nodeAPI->setAttribute(nodeHandle, NODE_SPAN_CONTENT, &content_item); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t fontWeight) +{ + auto span = createDefaultChildNode(nodeAPI); + + // span font weight + ArkUI_NumberValue fontWeight_value[] = {{.i32 = fontWeight}}; + ArkUI_AttributeItem fontWeight_item = {fontWeight_value, sizeof(fontWeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(span, NODE_FONT_WEIGHT, &fontWeight_item); + + return span; +} + +static auto createTextChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle span) +{ + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BORDER_WIDTH, &border_item); + nodeAPI->addChild(text, span); + + return text; +} + +napi_value SpanFontWeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "SpanFontWeightTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanFontWeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowFourth = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowFifth = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSixth = nodeAPI->createNode(ARKUI_NODE_ROW); + + auto spanFirst = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_W100)); + auto spanFirstMiddle = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_W200)); + auto spanFirstEnd = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_W300)); + auto spanSecond = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_W400)); + auto spanSecondMiddle = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_W500)); + auto spanSecondEnd = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_W600)); + auto spanThird = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_W700)); + auto spanThirdMiddle = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_W800)); + auto spanThirdEnd = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_W900)); + auto spanFourth = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_BOLD)); + auto spanFourthMiddle = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_NORMAL)); + auto spanFourthEnd = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_BOLDER)); + auto spanFifth = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_LIGHTER)); + auto spanFifthMiddle = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_MEDIUM)); + auto spanFifthEnd = createTextChildNode(nodeAPI, createChildNode(nodeAPI, ARKUI_FONT_WEIGHT_REGULAR)); + auto spanSix = createTextChildNode(nodeAPI, createChildNode(nodeAPI, -1)); + + nodeAPI->addChild(rowFirst, spanFirst); + nodeAPI->addChild(rowFirst, spanFirstMiddle); + nodeAPI->addChild(rowFirst, spanFirstEnd); + nodeAPI->addChild(rowSecond, spanSecond); + nodeAPI->addChild(rowSecond, spanSecondMiddle); + nodeAPI->addChild(rowSecond, spanSecondEnd); + nodeAPI->addChild(rowThird, spanThird); + nodeAPI->addChild(rowThird, spanThirdMiddle); + nodeAPI->addChild(rowThird, spanThirdEnd); + nodeAPI->addChild(rowFourth, spanFourth); + nodeAPI->addChild(rowFourth, spanFourthMiddle); + nodeAPI->addChild(rowFourth, spanFourthEnd); + nodeAPI->addChild(rowFifth, spanFifth); + nodeAPI->addChild(rowFifth, spanFifthMiddle); + nodeAPI->addChild(rowFifth, spanFifthEnd); + nodeAPI->addChild(rowSixth, spanSix); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + nodeAPI->addChild(column, rowFourth); + nodeAPI->addChild(column, rowFifth); + nodeAPI->addChild(column, rowSixth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanFontWeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontweight_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontweight_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5f9ab0e7fa05e1d38ebdf8837c15016958a5a959 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_fontweight_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SPAN_FONTWEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_SPAN_FONTWEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SpanFontWeightTest { +public: + ~SpanFontWeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SPAN_FONTWEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_letterspacing_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_letterspacing_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0b9bd1b90381fffcb0d44169c5f5499e50584fc8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_letterspacing_test.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "span_letterspacing_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle SpanLetterSpacingTest::CreateSubNode(ArkUI_NativeNodeAPI_1 *nodeAPI, float letterSpacing, + std::string content) +{ + // 创建span组件 + auto span = nodeAPI->createNode(ARKUI_NODE_SPAN); + + // 设置span的LetterSpacing属性 + ArkUI_NumberValue letterspacing_value[] = {{.f32 = letterSpacing}}; + ArkUI_AttributeItem letterspacing_item = {letterspacing_value, + sizeof(letterspacing_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(span, NODE_TEXT_LETTER_SPACING, &letterspacing_item); + + // 设置span内容 + ArkUI_AttributeItem content_item = {.string = content.c_str()}; + nodeAPI->setAttribute(span, NODE_SPAN_CONTENT, &content_item); + + // 创建父节点text,加入span子组件 + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + nodeAPI->addChild(text, span); + + return text; +} + +napi_value SpanLetterSpacingTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanLetterSpacingTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanLetterSpacingTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // span first:文本字符间距为3 + std::string content = "123456789"; + float letterSpacing = 3; + auto span_first = CreateSubNode(nodeAPI, letterSpacing, content); + + // span second:文本字符间距为0 + letterSpacing = 0; + auto span_second = CreateSubNode(nodeAPI, letterSpacing, content); + + // span third:文本字符间距为-1 + letterSpacing = -1; + auto span_third = CreateSubNode(nodeAPI, letterSpacing, content); + + // 子组件加入到父容器 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, span_first); + nodeAPI->addChild(column, span_second); + nodeAPI->addChild(column, span_third); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为200vp,高度为500vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 500}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanLetterSpacingTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_letterspacing_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_letterspacing_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9f29144ca937ded82a17aa394ddca7c3b308e121 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_letterspacing_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SPAN_LETTERSPACING_TEST_H +#define ARKUI_CAPI_DEMO_SPAN_LETTERSPACING_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SpanLetterSpacingTest { +public: + ~SpanLetterSpacingTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static ArkUI_NodeHandle CreateSubNode(ArkUI_NativeNodeAPI_1 *nodeAPI, float letterspacing, std::string content); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SPAN_LETTERSPACING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_lineheight_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_lineheight_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f1125dd80eb45875a24b99d7b3c370c1b804fbb8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_lineheight_test.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "span_lineheight_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle SpanLineHeightTest::CreateSubNode(ArkUI_NativeNodeAPI_1 *nodeAPI, float lineHeight, + std::string content) +{ + // 创建span组件 + auto span = nodeAPI->createNode(ARKUI_NODE_SPAN); + + // 设置span的LineHeight属性 + ArkUI_NumberValue lineheight_value[] = {{.f32 = lineHeight}}; + ArkUI_AttributeItem lineheight_item = {lineheight_value, sizeof(lineheight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(span, NODE_TEXT_LINE_HEIGHT, &lineheight_item); + + // 设置span内容 + ArkUI_AttributeItem content_item = {.string = content.c_str()}; + nodeAPI->setAttribute(span, NODE_SPAN_CONTENT, &content_item); + + // 创建父节点text,加入span子组件 + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置Text组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BORDER_WIDTH, &border_width_item); + + nodeAPI->addChild(text, span); + + return text; +} + +napi_value SpanLineHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanLineHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanLineHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // span first:行高为100 + std::string content = "123456789123456789123456789"; + float lineHeight = 100; + auto span_first = CreateSubNode(nodeAPI, lineHeight, content); + + // span second:行高为0 + lineHeight = 0; + auto span_second = CreateSubNode(nodeAPI, lineHeight, content); + + // span third:行高为-100 + lineHeight = -100; + auto span_third = CreateSubNode(nodeAPI, lineHeight, content); + + // 子组件加入到父容器 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, span_first); + nodeAPI->addChild(column, span_second); + nodeAPI->addChild(column, span_third); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为200vp,高度为700vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 700}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanLineHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_lineheight_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_lineheight_test.h new file mode 100644 index 0000000000000000000000000000000000000000..27f0e4433c45370702c1b13c5ce848b37eaaf20e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_lineheight_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SPAN_LINEHEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_SPAN_LINEHEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SpanLineHeightTest { +public: + ~SpanLineHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static ArkUI_NodeHandle CreateSubNode(ArkUI_NativeNodeAPI_1 *nodeAPI, float lineHeight, std::string content); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SPAN_LINEHEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_textcase_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_textcase_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9e115390edb4180c7c262c9059b7032708e6d75d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_textcase_test.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "span_textcase_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle SpanTextCaseTest::CreateSubNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t textcase, std::string content) +{ + // 创建span组件 + auto span = nodeAPI->createNode(ARKUI_NODE_SPAN); + + // 设置span的TextCase属性 + ArkUI_NumberValue textcase_value[] = {{.i32 = textcase}}; + ArkUI_AttributeItem textcase_item = {textcase_value, sizeof(textcase_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(span, NODE_TEXT_CASE, &textcase_item); + + // 设置span内容 + ArkUI_AttributeItem content_item = {.string = content.c_str()}; + nodeAPI->setAttribute(span, NODE_SPAN_CONTENT, &content_item); + + // 创建父节点text,加入span子组件 + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + nodeAPI->addChild(text, span); + + return text; +} + +napi_value SpanTextCaseTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanTextCaseTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanTextCaseTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // span first:文本保持原有大小写 + std::string content = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + int32_t textCase = ARKUI_TEXT_CASE_NORMAL; + auto span_first = CreateSubNode(nodeAPI, textCase, content); + + // span second:文本全小写 + textCase = ARKUI_TEXT_CASE_LOWER; + auto span_second = CreateSubNode(nodeAPI, textCase, content); + + // span third:文本全大写 + textCase = ARKUI_TEXT_CASE_UPPER; + auto span_third = CreateSubNode(nodeAPI, textCase, content); + + // span fourth:文本大小写为-1 + textCase = -1; + auto span_fourth = CreateSubNode(nodeAPI, textCase, content); + + // 子组件加入到父容器 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, span_first); + nodeAPI->addChild(column, span_second); + nodeAPI->addChild(column, span_third); + nodeAPI->addChild(column, span_fourth); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为300vp,高度为500vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 500}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SpanTextCaseTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_textcase_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_textcase_test.h new file mode 100644 index 0000000000000000000000000000000000000000..332699c1b0e4f9a3bc869f07762782b1ec0fb358 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/span/span_textcase_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SPAN_TEXTCASE_TEST_H +#define ARKUI_CAPI_DEMO_SPAN_TEXTCASE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SpanTextCaseTest { +public: + ~SpanTextCaseTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static ArkUI_NodeHandle CreateSubNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t testcase, std::string content); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SPAN_TEXTCASE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_align_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_align_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4a8261c14f6af07488979b3019bda9cb7cfeb2e1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_align_test.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_align_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_STACK); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + // add child + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + ArkUI_NumberValue text_width_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem text_width_item = {text_width_value, sizeof(text_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &text_width_item); + nodeAPI->setAttribute(text, NODE_HEIGHT, &text_width_item); + + ArkUI_NumberValue text_background_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem text_background_item = {text_background_value, + sizeof(text_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &text_background_item); + nodeAPI->addChild(nodeHandle, text); + + return nodeHandle; +} + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t alignment) +{ + auto nodeHandle = createDefaultChildNode(nodeAPI); + + ArkUI_NumberValue align_value[] = {{.i32 = alignment}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT, &align_item); + + return nodeHandle; +} + +napi_value StackAlignTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackAlignTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackAlignTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowFourth = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowFifth = nodeAPI->createNode(ARKUI_NODE_ROW); + auto stackFirst = createChildNode(nodeAPI, ARKUI_ALIGNMENT_TOP_START); + auto stackFirstEnd = createChildNode(nodeAPI, ARKUI_ALIGNMENT_TOP); + auto stackSecond = createChildNode(nodeAPI, ARKUI_ALIGNMENT_TOP_END); + auto stackSecondEnd = createChildNode(nodeAPI, ARKUI_ALIGNMENT_START); + auto stackThird = createChildNode(nodeAPI, ARKUI_ALIGNMENT_CENTER); + auto stackThirdEnd = createChildNode(nodeAPI, ARKUI_ALIGNMENT_END); + auto stackFourth = createChildNode(nodeAPI, ARKUI_ALIGNMENT_BOTTOM_START); + auto stackFourthEnd = createChildNode(nodeAPI, ARKUI_ALIGNMENT_BOTTOM); + auto stackFifth = createChildNode(nodeAPI, ARKUI_ALIGNMENT_BOTTOM_END); + auto stackFifthEnd = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + + nodeAPI->addChild(rowFirst, stackFirst); + nodeAPI->addChild(rowFirst, stackFirstEnd); + nodeAPI->addChild(rowSecond, stackSecond); + nodeAPI->addChild(rowSecond, stackSecondEnd); + nodeAPI->addChild(rowThird, stackThird); + nodeAPI->addChild(rowThird, stackThirdEnd); + nodeAPI->addChild(rowFourth, stackFourth); + nodeAPI->addChild(rowFourth, stackFourthEnd); + nodeAPI->addChild(rowFifth, stackFifth); + nodeAPI->addChild(rowFifth, stackFifthEnd); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + nodeAPI->addChild(column, rowFourth); + nodeAPI->addChild(column, rowFifth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackAlignTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_align_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_align_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cbfa8f617772245d6d1b2990ea65e206ddb83416 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_align_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_ALIGN_TEST_H +#define ARKUI_CAPI_DEMO_STACK_ALIGN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackAlignTest { +public: + ~StackAlignTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_ALIGN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundblurstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundblurstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b9bd8cd5b28450c68536522e46ea04fffede2124 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundblurstyle_test.cpp @@ -0,0 +1,343 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_backgroundblurstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value StackBackgroundBlurStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundBlurStyleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundBlurStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // stack宽度设置为70 + ArkUI_NumberValue width_value[] = {{.f32 = 70}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + // stack高度设置为50 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + // 设置每行及每个stack边框为1 + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + // 设置父控件背景图片 + const char *image_url = "./resources/base/media/background.png"; + + // stack in the left of first row + auto stack_first = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_first, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_first, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_first, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_value[] = {{.i32 = ARKUI_BLUR_STYLE_THIN}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_item = {blur_style_value, sizeof(blur_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first, NODE_BACKGROUND_BLUR_STYLE, &blur_style_item); + + // stack in the middle of first row + auto stack_first_middle = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_first_middle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_first_middle, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_first_middle, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_first_middle_value[] = {{.i32 = ARKUI_BLUR_STYLE_REGULAR}, + {.i32 = ARKUI_COLOR_MODE_LIGHT}, + {.i32 = ARKUI_ADAPTIVE_COLOR_AVERAGE}, + {.f32 = 0.5}, + {.f32 = 0}, + {.f32 = 50}}; + ArkUI_AttributeItem blur_style_first_middle_item = { + blur_style_first_middle_value, sizeof(blur_style_first_middle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first_middle, NODE_BACKGROUND_BLUR_STYLE, &blur_style_first_middle_item); + + // stack in the end of first row + auto stack_first_end = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_first_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_first_end, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_first_end, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_first_end_value[] = {{.i32 = ARKUI_BLUR_STYLE_THICK}, + {.i32 = ARKUI_COLOR_MODE_DARK}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 1}, + {.f32 = 0}, + {.f32 = 127}}; + ArkUI_AttributeItem blur_style_first_end_item = {blur_style_first_end_value, + sizeof(blur_style_first_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first_end, NODE_BACKGROUND_BLUR_STYLE, &blur_style_first_end_item); + + // stack in the left of second row + auto stack_second = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_second, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_second, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_second_value[] = {{.i32 = ARKUI_BLUR_STYLE_BACKGROUND_THIN}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_second_item = {blur_style_second_value, + sizeof(blur_style_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second, NODE_BACKGROUND_BLUR_STYLE, &blur_style_second_item); + + // stack in the middle of second row + auto stack_second_middle = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second_middle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_second_middle, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_second_middle, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_second_middle_value[] = {{.i32 = ARKUI_BLUR_STYLE_BACKGROUND_REGULAR}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_second_middle_item = { + blur_style_second_middle_value, sizeof(blur_style_second_middle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second_middle, NODE_BACKGROUND_BLUR_STYLE, &blur_style_second_middle_item); + + // stack in the end of second row + auto stack_second_end = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_second_end, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_second_end, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_second_end_value[] = {{.i32 = ARKUI_BLUR_STYLE_BACKGROUND_THICK}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_second_end_item = {blur_style_second_end_value, + sizeof(blur_style_second_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second_end, NODE_BACKGROUND_BLUR_STYLE, &blur_style_second_end_item); + + // stack in the left of third row + auto stack_third = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_third, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_third, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_third, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_third_value[] = {{.i32 = ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_third_item = {blur_style_third_value, + sizeof(blur_style_third_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_third, NODE_BACKGROUND_BLUR_STYLE, &blur_style_third_item); + + // stack in the middle of third row + auto stack_third_middle = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_third_middle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_third_middle, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_third_middle, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_third_middle_value[] = {{.i32 = ARKUI_BLUR_STYLE_NONE}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_third_middle_item = { + blur_style_third_middle_value, sizeof(blur_style_third_middle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_third_middle, NODE_BACKGROUND_BLUR_STYLE, &blur_style_third_middle_item); + + // stack in the end of third row + auto stack_third_end = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_third_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_third_end, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_third_end, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_third_end_value[] = {{.i32 = ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_third_end_item = {blur_style_third_end_value, + sizeof(blur_style_third_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_third_end, NODE_BACKGROUND_BLUR_STYLE, &blur_style_third_end_item); + + // stack in the left of fourth row + auto stack_fourth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fourth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_fourth, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_fourth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_fourth_value[] = {{.i32 = ARKUI_BLUR_STYLE_COMPONENT_THIN}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_fourth_item = {blur_style_fourth_value, + sizeof(blur_style_fourth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fourth, NODE_BACKGROUND_BLUR_STYLE, &blur_style_fourth_item); + + // stack in the middle of fourth row + auto stack_fourth_middle = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fourth_middle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_fourth_middle, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_fourth_middle, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_fourth_middle_value[] = {{.i32 = ARKUI_BLUR_STYLE_COMPONENT_REGULAR}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_fourth_middle_item = { + blur_style_fourth_middle_value, sizeof(blur_style_fourth_middle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fourth_middle, NODE_BACKGROUND_BLUR_STYLE, &blur_style_fourth_middle_item); + + // stack in the end of fourth row + auto stack_fourth_end = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fourth_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_fourth_end, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_fourth_end, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_fourth_end_value[] = {{.i32 = ARKUI_BLUR_STYLE_COMPONENT_THICK}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_fourth_end_item = {blur_style_fourth_end_value, + sizeof(blur_style_fourth_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fourth_end, NODE_BACKGROUND_BLUR_STYLE, &blur_style_fourth_end_item); + + // stack in the left of fifth row + auto stack_fifth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fifth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_fifth, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_fifth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_fifth_value[] = {{.i32 = ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_DEFAULT}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}}; + ArkUI_AttributeItem blur_style_fifth_item = {blur_style_fifth_value, + sizeof(blur_style_fifth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fifth, NODE_BACKGROUND_BLUR_STYLE, &blur_style_fifth_item); + + // stack in the end of fifth row + auto stack_fifth_end = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fifth_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_fifth_end, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_fifth_end, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue blur_style_fifth_end_value[] = {{.i32 = -1}, {.i32 = -1}, {.i32 = -1}, + {.f32 = -1}, {.f32 = -1}, {.f32 = 128}}; + ArkUI_AttributeItem blur_style_fifth_end_item = {blur_style_fifth_end_value, + sizeof(blur_style_fifth_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fifth_end, NODE_BACKGROUND_BLUR_STYLE, &blur_style_fifth_end_item); + + // 创建一个parent node:column中包含5个row + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fifth = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue row_width_value[] = {{.f32 = 300}}; + ArkUI_NumberValue row_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + + // 设置每行宽高,背景颜色,边框,水平方向上的对齐格式 + nodeAPI->setAttribute(row_first, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_third, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_fourth, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_fourth, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_fourth, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_fourth, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_fifth, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_fifth, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_fifth, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_fifth, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + + // 子组件加入到父容器 + nodeAPI->addChild(row_first, stack_first); + nodeAPI->insertChildAfter(row_first, stack_first_middle, stack_first); + nodeAPI->insertChildAfter(row_first, stack_first_end, stack_first_middle); + + nodeAPI->addChild(row_second, stack_second); + nodeAPI->insertChildAfter(row_second, stack_second_middle, stack_second); + nodeAPI->insertChildAfter(row_second, stack_second_end, stack_second_middle); + + nodeAPI->addChild(row_third, stack_third); + nodeAPI->insertChildAfter(row_third, stack_third_middle, stack_third); + nodeAPI->insertChildAfter(row_third, stack_third_end, stack_third_middle); + + nodeAPI->addChild(row_fourth, stack_fourth); + nodeAPI->insertChildAfter(row_fourth, stack_fourth_middle, stack_fourth); + nodeAPI->insertChildAfter(row_fourth, stack_fourth_end, stack_fourth_middle); + + nodeAPI->addChild(row_fifth, stack_fifth); + nodeAPI->insertChildAfter(row_fifth, stack_fifth_end, stack_fifth); + + // 设置父控件背景,并将五个行容器全部添加到父控件column + ArkUI_NumberValue background_image_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_NONE}}; + ArkUI_AttributeItem background_image_value_item = { + background_image_value, sizeof(background_image_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_IMAGE, &background_image_value_item); + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + nodeAPI->insertChildAfter(column, row_fourth, row_third); + nodeAPI->insertChildAfter(column, row_fifth, row_fourth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundBlurStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundblurstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundblurstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cafffd5fbd3a563d54f6d6e0b1fb7814f17f7176 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundblurstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_BACKGROUNDBLURSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_STACK_BACKGROUNDBLURSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackBackgroundBlurStyleTest { +public: + ~StackBackgroundBlurStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_BACKGROUNDBLURSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..28959b4f76bac2319d78350e7a797f48e552f4df --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundcolor_test.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_backgroundcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value StackBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // Stack1:背景颜色为红色0xFFFF0000,宽度为30vp,高度为30vp + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFAAAA}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + ArkUI_NumberValue width_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem width_value_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack, NODE_HEIGHT, &width_value_item); + + // Stack2:背景颜色为透明色0x00000000,宽度为30vp,高度为30vp + auto stack_small = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue background_color_small_value[] = {{.u32 = 0x00000000}}; + ArkUI_AttributeItem background_small_color_item = { + background_color_small_value, sizeof(background_color_small_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_small, NODE_BACKGROUND_COLOR, &background_small_color_item); + nodeAPI->setAttribute(stack_small, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_small, NODE_HEIGHT, &width_value_item); + + // Stack3:背景颜色为白色0xFFFFFFFF,宽度为30vp,高度为30vp + auto stack_large = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue background_color_large_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_large_color_item = { + background_color_large_value, sizeof(background_color_large_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_large, NODE_BACKGROUND_COLOR, &background_large_color_item); + nodeAPI->setAttribute(stack_large, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_large, NODE_HEIGHT, &width_value_item); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, stack); + nodeAPI->addChild(column, stack_small); + nodeAPI->addChild(column, stack_large); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0e5cbdaa3141607be434fd7e3552a70ad8f29ede --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_STACK_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackBackgroundColorTest { +public: + ~StackBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimage_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimage_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a204168a4e55b704313d79c7c6e7ecdc69b74073 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimage_test.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_backgroundimage_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value StackBackgroundImageTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundImageTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundImageTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 背景图片路径 + const char *image_url = "./resources/base/media/icon.png"; + // 背景图片(底色透明)路径 + const char *image_transparent_url = "./resources/base/media/icon_transparent.png"; + // 边框宽度设置为1 + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + + // 设置宽高 + ArkUI_NumberValue width_value[] = {{.f32 = 120}}; + ArkUI_AttributeItem width_value_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + + // first stack,设置背景图片为image_url,图片不重复铺设 + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_NONE}}; + ArkUI_AttributeItem background_image_value_item = { + background_image_value, sizeof(background_image_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(stack, NODE_BACKGROUND_IMAGE, &background_image_value_item); + nodeAPI->setAttribute(stack, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack, NODE_HEIGHT, &width_value_item); + + // second stack,设置背景图片为image_url,图片在X轴方向重复铺设 + auto stack_second = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_second_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_X}}; + ArkUI_AttributeItem background_image_second_value_item = { + background_image_second_value, sizeof(background_image_second_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(stack_second, NODE_BACKGROUND_IMAGE, &background_image_second_value_item); + nodeAPI->setAttribute(stack_second, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_second, NODE_HEIGHT, &width_value_item); + + // third stack,设置背景图片为image_url,图片在Y轴方向重复铺设 + auto stack_third = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_third, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_third_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_Y}}; + ArkUI_AttributeItem background_image_third_value_item = { + background_image_third_value, sizeof(background_image_third_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(stack_third, NODE_BACKGROUND_IMAGE, &background_image_third_value_item); + nodeAPI->setAttribute(stack_third, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_third, NODE_HEIGHT, &width_value_item); + + // fourth stack,设置背景图片为image_url,图片在X轴和Y轴方向重复铺设 + auto stack_fourth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fourth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_fourth_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_XY}}; + ArkUI_AttributeItem background_image_fourth_value_item = { + background_image_fourth_value, sizeof(background_image_fourth_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(stack_fourth, NODE_BACKGROUND_IMAGE, &background_image_fourth_value_item); + nodeAPI->setAttribute(stack_fourth, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_fourth, NODE_HEIGHT, &width_value_item); + + // fifth stack,设置背景图片为异常值,图片在X轴方向重复铺设 + auto stack_fifth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fifth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_fifth_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_X}}; + ArkUI_AttributeItem background_image_fifth_value_item = { + background_image_fifth_value, sizeof(background_image_fifth_value) / sizeof(ArkUI_NumberValue), "abcdefg"}; + nodeAPI->setAttribute(stack_fifth, NODE_BACKGROUND_IMAGE, &background_image_fifth_value_item); + nodeAPI->setAttribute(stack_fifth, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_fifth, NODE_HEIGHT, &width_value_item); + + // sixth stack,设置背景图片为image_url,图片重复铺设为异常值 + auto stack_sixth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_sixth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_sixth_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem background_image_sixth_value_item = { + background_image_sixth_value, sizeof(background_image_sixth_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(stack_sixth, NODE_BACKGROUND_IMAGE, &background_image_sixth_value_item); + nodeAPI->setAttribute(stack_sixth, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_sixth, NODE_HEIGHT, &width_value_item); + + // seventh stack,设置背景图片为异常值,图片重复铺设为异常值 + auto stack_seventh = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_seventh, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_seventh_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem background_image_seventh_value_item = { + background_image_seventh_value, sizeof(background_image_seventh_value) / sizeof(ArkUI_NumberValue), "abcdefg"}; + nodeAPI->setAttribute(stack_seventh, NODE_BACKGROUND_IMAGE, &background_image_seventh_value_item); + nodeAPI->setAttribute(stack_seventh, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_seventh, NODE_HEIGHT, &width_value_item); + + // eighth stack,设置背景图片为image_transparent_url,不主动设置图片重复铺设类型,并且设置背景颜色为0xFF00FF00 + auto stack_eighth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_eighth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_item = {background_value, sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_eighth, NODE_BACKGROUND_COLOR, &background_item); + ArkUI_AttributeItem background_image_eighth_value_item = {}; + background_image_eighth_value_item.string = image_transparent_url; + nodeAPI->setAttribute(stack_eighth, NODE_BACKGROUND_IMAGE, &background_image_eighth_value_item); + nodeAPI->setAttribute(stack_eighth, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_eighth, NODE_HEIGHT, &width_value_item); + + // parent node + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + + nodeAPI->addChild(row_first, stack); + nodeAPI->insertChildAfter(row_first, stack_second, stack); + + nodeAPI->addChild(row_second, stack_third); + nodeAPI->insertChildAfter(row_second, stack_fourth, stack_third); + + nodeAPI->addChild(row_third, stack_fifth); + nodeAPI->insertChildAfter(row_third, stack_sixth, stack_fifth); + + nodeAPI->addChild(row_fourth, stack_seventh); + nodeAPI->insertChildAfter(row_fourth, stack_eighth, stack_seventh); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + nodeAPI->insertChildAfter(column, row_fourth, row_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundImageTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimage_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimage_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c24282904a53994c1c86f5ed1bd763b4caf63daa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimage_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_BACKGROUNDIMAGE_TEST_H +#define ARKUI_CAPI_DEMO_STACK_BACKGROUNDIMAGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackBackgroundImageTest { +public: + ~StackBackgroundImageTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_BACKGROUNDIMAGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimageposition_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimageposition_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..362396daef0d1465761203db7fc7bfe23b3758b4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimageposition_test.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_backgroundimageposition_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value StackBackgroundImagePositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundImagePositionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundImagePositionTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 背景图片路径 + const char *image_url = "./resources/base/media/rectIcon.png"; + + // Stack1:宽为120vp,高为120vp,显示边框,背景图片组件中显示位置为x轴:50vp,y轴:50vp,背景图片为rectIcon.png + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue width_value[] = {{.f32 = 120}}; + ArkUI_AttributeItem width_value_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack, NODE_HEIGHT, &width_value_item); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_BORDER_WIDTH, &border_item); + ArkUI_AttributeItem background_image_value_item = {.string = image_url}; + nodeAPI->setAttribute(stack, NODE_BACKGROUND_IMAGE, &background_image_value_item); + ArkUI_NumberValue value[] = {{.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_BACKGROUND_IMAGE_POSITION, &value_item); + + // Stack2:宽为120vp,高为120vp,显示边框,背景图片组件中显示位置为x轴:-50vp,y轴:-50vp,背景图片为rectIcon.png + auto stack_negative = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_negative, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_negative, NODE_HEIGHT, &width_value_item); + nodeAPI->setAttribute(stack_negative, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(stack_negative, NODE_BACKGROUND_IMAGE, &background_image_value_item); + ArkUI_NumberValue negative_value[] = {{.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem negative_value_item = {negative_value, sizeof(negative_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_negative, NODE_BACKGROUND_IMAGE_POSITION, &negative_value_item); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, stack); + nodeAPI->addChild(column, stack_negative); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundImagePositionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimageposition_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimageposition_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2b611a19519db81232cb9c6b88be98c33022ae9f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimageposition_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_BACKGROUNDIMAGEPOSITION_TEST_H +#define ARKUI_CAPI_DEMO_STACK_BACKGROUNDIMAGEPOSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackBackgroundImagePositionTest { +public: + ~StackBackgroundImagePositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_BACKGROUNDIMAGEPOSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimagesize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimagesize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7a0599ae60cd4c08f481bd6a480cf06ca70afd64 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimagesize_test.cpp @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_backgroundimagesize_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value StackBackgroundImageSizeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundImageSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundImageSizeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 背景图片路径 + const char *image_url = "./resources/base/media/rectIcon.png"; + + // Stack1:宽为120vp,高为120vp,背景图片宽度为50vp,背景图片高度为50vp,背景图片为rectIcon.png + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue width_value[] = {{.f32 = 120}}; + ArkUI_AttributeItem width_value_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack, NODE_HEIGHT, &width_value_item); + ArkUI_AttributeItem background_image_value_item = {.string = image_url}; + nodeAPI->setAttribute(stack, NODE_BACKGROUND_IMAGE, &background_image_value_item); + ArkUI_NumberValue value[] = {{.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_BACKGROUND_IMAGE_SIZE, &value_item); + + // Stack2:宽为120vp,高为120vp,背景图片宽度为-50vp,背景图片高度为-50vp,背景图片为rectIcon.png + auto stack_abnormal = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_abnormal, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_abnormal, NODE_HEIGHT, &width_value_item); + nodeAPI->setAttribute(stack_abnormal, NODE_BACKGROUND_IMAGE, &background_image_value_item); + ArkUI_NumberValue abnormal_value[] = {{.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem abnormal_value_item = {abnormal_value, sizeof(abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_abnormal, NODE_BACKGROUND_IMAGE_SIZE, &abnormal_value_item); + + // Stack3:宽为120vp,高为120vp,背景图片宽度未设置,背景图片高度为50vp,背景图片为rectIcon.png + auto stack_only_height = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_only_height, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_only_height, NODE_HEIGHT, &width_value_item); + nodeAPI->setAttribute(stack_only_height, NODE_BACKGROUND_IMAGE, &background_image_value_item); + ArkUI_NumberValue only_height_value[] = {{}, {.f32 = 50}}; + ArkUI_AttributeItem only_height_value_item = {only_height_value, + sizeof(only_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_only_height, NODE_BACKGROUND_IMAGE_SIZE, &only_height_value_item); + + // Stack4:宽为120vp,高为120vp,背景图片宽度为10000vp,背景图片高度为10000vp,背景图片为rectIcon.png + auto stack_large = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_large, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_large, NODE_HEIGHT, &width_value_item); + nodeAPI->setAttribute(stack_large, NODE_BACKGROUND_IMAGE, &background_image_value_item); + ArkUI_NumberValue large_value[] = {{.f32 = 10000}, {.f32 = 10000}}; + ArkUI_AttributeItem large_value_item = {large_value, sizeof(large_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_large, NODE_BACKGROUND_IMAGE_SIZE, &large_value_item); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, stack); + nodeAPI->addChild(column, stack_abnormal); + nodeAPI->addChild(column, stack_only_height); + nodeAPI->addChild(column, stack_large); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBackgroundImageSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimagesize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimagesize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..668192150286333a4b92b351c3f2676f224605ec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_backgroundimagesize_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_BACKGROUNDIMAGESIZE_TEST_H +#define ARKUI_CAPI_DEMO_STACK_BACKGROUNDIMAGESIZE_TEST_H + +#include "../common/common.h" + +#include +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackBackgroundImageSizeTest { +public: + ~StackBackgroundImageSizeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_BACKGROUNDIMAGESIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_bordercolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_bordercolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ee103195988934a9dfbb1f1a789a21984aec7e21 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_bordercolor_test.cpp @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_bordercolor_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle StackBorderColorTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, uint32_t border_color) +{ + float width = 50; + float height = 50; + float border_width = 10; + + auto stack = node_api->createNode(ARKUI_NODE_STACK); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BORDER_WIDTH, &border_width_item); + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = border_color}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BORDER_COLOR, &border_color_item); + + return stack; +} + +ArkUI_NodeHandle StackBorderColorTest::CreateSubStackNodeWithColors(ArkUI_NativeNodeAPI_1 *node_api, + uint32_t border_color_top, + uint32_t border_color_bottom, + uint32_t border_color_left, + uint32_t border_color_right) +{ + float width = 50; + float height = 50; + float border_width = 10; + auto stack = node_api->createNode(ARKUI_NODE_STACK); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BORDER_WIDTH, &border_width_item); + // 设置组件边框颜色 + ArkUI_NumberValue border_color_value[] = {{.u32 = border_color_top}, + {.u32 = border_color_bottom}, + {.u32 = border_color_left}, + {.u32 = border_color_right}}; + ArkUI_AttributeItem border_color_item = {border_color_value, + sizeof(border_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BORDER_COLOR, &border_color_item); + + return stack; +} + +napi_value StackBorderColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + uint32_t border_color = 0xFFFF0000; + auto stack = CreateSubStackNode(nodeAPI, border_color); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_color = 0xFFFFFFFF; + stack = CreateSubStackNode(nodeAPI, border_color); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_color = 0x00000000; + stack = CreateSubStackNode(nodeAPI, border_color); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + uint32_t border_color_top = 0xFFFF0000; + uint32_t border_color_bottom = 0xFFFF0000; + uint32_t border_color_left = 0xFFFF0000; + uint32_t border_color_right = 0xFFFF0000; + stack = CreateSubStackNodeWithColors(nodeAPI, border_color_top, border_color_bottom, border_color_left, + border_color_right); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_color_top = 0xFFFFFFFF; + border_color_bottom = 0xFFFFFFFF; + border_color_left = 0xFFFFFFFF; + border_color_right = 0xFFFFFFFF; + stack = CreateSubStackNodeWithColors(nodeAPI, border_color_top, border_color_bottom, border_color_left, + border_color_right); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_color_top = 0x00000000; + border_color_bottom = 0x00000000; + border_color_left = 0x00000000; + border_color_right = 0x00000000; + stack = CreateSubStackNodeWithColors(nodeAPI, border_color_top, border_color_bottom, border_color_left, + border_color_right); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_bordercolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_bordercolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a6bb1b54cedc3ef82423a71cb0fc556557a3d335 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_bordercolor_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_BORDERCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_STACK_BORDERCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackBorderColorTest { +public: + ~StackBorderColorTest(); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, uint32_t border_color); + static ArkUI_NodeHandle CreateSubStackNodeWithColors(ArkUI_NativeNodeAPI_1 *node_api, uint32_t border_color_top, + uint32_t border_color_bottom, uint32_t border_color_left, + uint32_t border_color_right); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_BORDERCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderradius_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderradius_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f5b1a7cef0ce210fb0ac87085c618c6d625b255b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderradius_test.cpp @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_borderradius_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle StackBorderRadiusTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float border_radius) +{ + float width = 80; + float height = 80; + float border_width = 10; + + auto stack = node_api->createNode(ARKUI_NODE_STACK); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BORDER_WIDTH, &border_width_item); + + // 设置组件边框圆角值 + ArkUI_NumberValue border_radius_value[] = {{.f32 = border_radius}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BORDER_RADIUS, &border_radius_item); + + return stack; +} + +ArkUI_NodeHandle StackBorderRadiusTest::CreateSubStackNodeWithBorderRadius(ArkUI_NativeNodeAPI_1 *node_api, + float border_radius_left_top, + float border_radius_right_top, + float border_radius_left_bottom, + float border_radius_right_bottom) +{ + float width = 80; + float height = 80; + float border_width = 10; + auto stack = node_api->createNode(ARKUI_NODE_STACK); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BORDER_WIDTH, &border_width_item); + // 设置组件边框圆角值 + ArkUI_NumberValue border_radius_value[] = {{.f32 = border_radius_left_top}, + {.f32 = border_radius_right_top}, + {.f32 = border_radius_left_bottom}, + {.f32 = border_radius_right_bottom}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BORDER_RADIUS, &border_radius_item); + + return stack; +} + +napi_value StackBorderRadiusTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderRadiusTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float border_radius = 10; + auto stack = CreateSubStackNode(nodeAPI, border_radius); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_radius = 0; + stack = CreateSubStackNode(nodeAPI, border_radius); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_radius = 40; + stack = CreateSubStackNode(nodeAPI, border_radius); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_radius = -1; + stack = CreateSubStackNode(nodeAPI, border_radius); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_radius = 50; + stack = CreateSubStackNode(nodeAPI, border_radius); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + float border_radius_left_top = 10; + float border_radius_right_top = 11; + float border_radius_left_bottom = 12; + float border_radius_right_bottom = 13; + stack = CreateSubStackNodeWithBorderRadius(nodeAPI, border_radius_left_top, border_radius_right_top, + border_radius_left_bottom, border_radius_right_bottom); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_radius_left_top = 0; + border_radius_right_top = 0; + border_radius_left_bottom = 0; + border_radius_right_bottom = 0; + stack = CreateSubStackNodeWithBorderRadius(nodeAPI, border_radius_left_top, border_radius_right_top, + border_radius_left_bottom, border_radius_right_bottom); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_radius_left_top = 40; + border_radius_right_top = 40; + border_radius_left_bottom = 40; + border_radius_right_bottom = 40; + stack = CreateSubStackNodeWithBorderRadius(nodeAPI, border_radius_left_top, border_radius_right_top, + border_radius_left_bottom, border_radius_right_bottom); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_radius_left_top = -1; + border_radius_right_top = -1; + border_radius_left_bottom = -1; + border_radius_right_bottom = -1; + stack = CreateSubStackNodeWithBorderRadius(nodeAPI, border_radius_left_top, border_radius_right_top, + border_radius_left_bottom, border_radius_right_bottom); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + border_radius_left_top = 50; + border_radius_right_top = 50; + border_radius_left_bottom = 50; + border_radius_right_bottom = 50; + stack = CreateSubStackNodeWithBorderRadius(nodeAPI, border_radius_left_top, border_radius_right_top, + border_radius_left_bottom, border_radius_right_bottom); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderradius_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderradius_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c95ff82d1ba25185cf14ba6234ef11b8354198dc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderradius_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_BORDERRADIUS_TEST_H +#define ARKUI_CAPI_DEMO_STACK_BORDERRADIUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackBorderRadiusTest { +public: + ~StackBorderRadiusTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float border_radius); + static ArkUI_NodeHandle CreateSubStackNodeWithBorderRadius(ArkUI_NativeNodeAPI_1 *node_api, + float border_radius_left_top, + float border_radius_right_top, + float border_radius_left_bottom, + float border_radius_right_bottom); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_BORDERRADIUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2130c504ade495ebdd1b2db593f4865507bd0f8c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderstyle_test.cpp @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_borderstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createStackNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_STACK); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue border_width_value[] = {{.f32 = PARAM_5}}; + ArkUI_AttributeItem border_width_item = {border_width_value, + sizeof(border_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &border_width_item); + + return nodeHandle; +} + +napi_value StackBorderStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackBorderStyleTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderStyleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + + // First stack + auto stackFirst = createStackNode(nodeAPI); + ArkUI_NumberValue border_style_value[] = {{.i32 = ARKUI_BORDER_STYLE_SOLID}}; + ArkUI_AttributeItem border_style_item = {border_style_value, + sizeof(border_style_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFirst, NODE_BORDER_STYLE, &border_style_item); + + // FirstEnd stack + auto stackFirstEnd = createStackNode(nodeAPI); + ArkUI_NumberValue border_style_first_end_value[] = {{.i32 = ARKUI_BORDER_STYLE_DASHED}}; + ArkUI_AttributeItem border_style_first_end_item = { + border_style_first_end_value, sizeof(border_style_first_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFirstEnd, NODE_BORDER_STYLE, &border_style_first_end_item); + + // Second stack + auto stackSecond = createStackNode(nodeAPI); + ArkUI_NumberValue border_style_second_value[] = {{.i32 = ARKUI_BORDER_STYLE_DOTTED}}; + ArkUI_AttributeItem border_style_second_item = {border_style_second_value, + sizeof(border_style_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackSecond, NODE_BORDER_STYLE, &border_style_second_item); + + // SecondEnd stack + auto stackSecondEnd = createStackNode(nodeAPI); + ArkUI_NumberValue border_style_second_end_value[] = {{.i32 = PARAM_NEGATIVE_1}}; + ArkUI_AttributeItem border_style_second_end_item = { + border_style_second_end_value, sizeof(border_style_second_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackSecondEnd, NODE_BORDER_STYLE, &border_style_second_end_item); + + // Third stack + auto stackThird = createStackNode(nodeAPI); + ArkUI_NumberValue border_style_third_value[] = {{.i32 = ARKUI_BORDER_STYLE_SOLID}, + {.i32 = ARKUI_BORDER_STYLE_DASHED}, + {.i32 = ARKUI_BORDER_STYLE_DOTTED}, + {.i32 = ARKUI_BORDER_STYLE_SOLID}}; + ArkUI_AttributeItem border_style_third_item = {border_style_third_value, + sizeof(border_style_third_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackThird, NODE_BORDER_STYLE, &border_style_third_item); + + // ThirdEnd stack + auto stackThirdEnd = createStackNode(nodeAPI); + ArkUI_NumberValue border_style_third_end_value[] = { + {.i32 = PARAM_NEGATIVE_1}, {.i32 = PARAM_NEGATIVE_1}, {.i32 = PARAM_NEGATIVE_1}, {.i32 = PARAM_NEGATIVE_1}}; + ArkUI_AttributeItem border_style_third_end_item = { + border_style_third_end_value, sizeof(border_style_third_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackThirdEnd, NODE_BORDER_STYLE, &border_style_third_end_item); + + nodeAPI->addChild(rowFirst, stackFirst); + nodeAPI->addChild(rowFirst, stackFirstEnd); + nodeAPI->addChild(rowSecond, stackSecond); + nodeAPI->addChild(rowSecond, stackSecondEnd); + nodeAPI->addChild(rowThird, stackThird); + nodeAPI->addChild(rowThird, stackThirdEnd); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f4a187153aff40ed8b8e864671b381f31d584548 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_BORDERSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_STACK_BORDERSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackBorderStyleTest { +public: + ~StackBorderStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_BORDERSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderwidth_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderwidth_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1c8c8ff49d3e38ed9fcf5f101e957b5d57b14e96 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderwidth_test.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_borderwidth_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value StackBorderWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // Stack1:宽度为80vp,高度为80vp,边框宽度属性为{1} + auto stack_first = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue width_value[] = {{.f32 = 80}}; + ArkUI_AttributeItem width_value_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_first, NODE_HEIGHT, &width_value_item); + ArkUI_NumberValue borderwidth_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem borderwidth_item = {borderwidth_value, sizeof(borderwidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first, NODE_BORDER_WIDTH, &borderwidth_item); + + // Stack2:宽度为80vp,高度为80vp,边框宽度属性为{-1} + auto stack_second = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_second, NODE_HEIGHT, &width_value_item); + ArkUI_NumberValue borderwidth_negative_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem borderwidth_negative_item = {borderwidth_negative_value, + sizeof(borderwidth_negative_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second, NODE_BORDER_WIDTH, &borderwidth_negative_item); + + // Stack3:宽度为80vp,高度为80vp,边框宽度属性为{1,2,3,4} + auto stack_third = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_third, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_third, NODE_HEIGHT, &width_value_item); + ArkUI_NumberValue borderwidth_many_value[] = {{.f32 = 1}, {.f32 = 2}, {.f32 = 3}, {.f32 = 4}}; + ArkUI_AttributeItem borderwidth_many_item = {borderwidth_many_value, + sizeof(borderwidth_many_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_third, NODE_BORDER_WIDTH, &borderwidth_many_item); + + // Stack4:宽度为80vp,高度为80vp,边框宽度属性为{-1,-2,-3,-4} + auto stack_fourth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fourth, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_fourth, NODE_HEIGHT, &width_value_item); + ArkUI_NumberValue borderwidth_many_negative_value[] = {{.f32 = -1}, {.f32 = -2}, {.f32 = -3}, {.f32 = -4}}; + ArkUI_AttributeItem borderwidth_many_negative_item = { + borderwidth_many_negative_value, sizeof(borderwidth_many_negative_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fourth, NODE_BORDER_WIDTH, &borderwidth_many_negative_item); + + // Stack5:宽度为80vp,高度为80vp,边框宽度属性为{10} + auto stack_fifth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fifth, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_fifth, NODE_HEIGHT, &width_value_item); + ArkUI_NumberValue borderwidth_large_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem borderwidth_large_item = {borderwidth_large_value, + sizeof(borderwidth_large_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fifth, NODE_BORDER_WIDTH, &borderwidth_large_item); + + // Stack6:宽度为80vp,高度为80vp,边框宽度属性为{10,11,12,13} + auto stack_sixth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_sixth, NODE_WIDTH, &width_value_item); + nodeAPI->setAttribute(stack_sixth, NODE_HEIGHT, &width_value_item); + ArkUI_NumberValue borderwidth_manylarge_value[] = {{.f32 = 10}, {.f32 = 11}, {.f32 = 12}, {.f32 = 13}}; + ArkUI_AttributeItem borderwidth_manylarge_item = {borderwidth_manylarge_value, + sizeof(borderwidth_manylarge_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_sixth, NODE_BORDER_WIDTH, &borderwidth_manylarge_item); + + // 子组件加入到父容器 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, stack_first); + nodeAPI->addChild(column, stack_second); + nodeAPI->addChild(column, stack_third); + nodeAPI->addChild(column, stack_fourth); + nodeAPI->addChild(column, stack_fifth); + nodeAPI->addChild(column, stack_sixth); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为150vp,高度为700vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 700}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderwidth_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderwidth_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b4d93c65e438f963cb46aaaeb4e735964011da59 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_borderwidth_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_BORDERWIDTH_TEST_H +#define ARKUI_CAPI_DEMO_STACK_BORDERWIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackBorderWidthTest { +public: + ~StackBorderWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_BORDERWIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_brightness_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_brightness_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..657d0459aaaf6b1abcdd9a8da7fb235962fbe36d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_brightness_test.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_brightness_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle StackBrightnessTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float value) +{ + float width = 50; + float height = 50; + uint32_t background_color = 0xFFFF0000; + auto stack = node_api->createNode(ARKUI_NODE_STACK); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + + ArkUI_NumberValue brightness_value[] = {{.f32 = value}}; + ArkUI_AttributeItem brightness_item = {brightness_value, sizeof(brightness_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BRIGHTNESS, &brightness_item); + + return stack; +} + +napi_value StackBrightnessTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBrightnessTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBrightnessTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float value = -1; + auto stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = 0; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = 0.5; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = 1.5; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = 2; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = 3; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = 1; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为150vp,高度为500vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 500}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackBrightnessTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_brightness_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_brightness_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f9536e974ed0cf2cc1c3c71a113fa64ba14dd3e4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_brightness_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_BRIGHTNESS_TEST_H +#define ARKUI_CAPI_DEMO_STACK_BRIGHTNESS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackBrightnessTest { +public: + ~StackBrightnessTest(); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_BRIGHTNESS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..129bd8dd3b127f53655cf21ac6db89d18c108d88 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_clip_test.cpp @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_clip_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle StackClipTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api) +{ + float width = 35; + float height = 20; + uint32_t background_color = 0xFFFF0000; + float border_width = 1; + auto stack = node_api->createNode(ARKUI_NODE_STACK); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件边框宽度 + ArkUI_NumberValue border_width_value[] = {{.f32 = border_width}}; + ArkUI_AttributeItem border_width_item = {border_width_value, sizeof(border_width) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BORDER_WIDTH, &border_width_item); + + return stack; +} + +napi_value StackClipTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackClipTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // stack在第一行的左边,裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE,矩形宽度:20,矩形高度:20,矩形圆角宽度:3,矩形圆角高度:3 + auto stack_first = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_rect_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 20}, {.f32 = 20}, {.f32 = 3}, {.f32 = 3}}; + ArkUI_AttributeItem clip_rect_item = {clip_rect_value, sizeof(clip_rect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first, NODE_CLIP_SHAPE, &clip_rect_item); + + // stack在第一行的中间,裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE,矩形宽度:-20,矩形高度:-20,矩形圆角宽度:-3,矩形圆角高度:-3 + auto stack_first_middle = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_rect_abnormal_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = -20}, {.f32 = -20}, {.f32 = -3}, {.f32 = -3}}; + ArkUI_AttributeItem clip_rect_abnormal_item = {clip_rect_abnormal_value, + sizeof(clip_rect_abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first_middle, NODE_CLIP_SHAPE, &clip_rect_abnormal_item); + + // stack在第一行的最后,裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE,矩形宽度:30000,矩形高度:30000,矩形圆角宽度:10000,矩形圆角高度:10000 + auto stack_first_end = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_rect_large_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 30000}, {.f32 = 30000}, {.f32 = 10000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_rect_large_item = {clip_rect_large_value, + sizeof(clip_rect_large_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first_end, NODE_CLIP_SHAPE, &clip_rect_large_item); + + // stack在第二行的左边,裁剪类型:ARKUI_CLIP_TYPE_CIRCLE,圆形宽度:20,圆形高度:20 + auto stack_second = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_circle_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem clip_circle_item = {clip_circle_value, sizeof(clip_circle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second, NODE_CLIP_SHAPE, &clip_circle_item); + + // stack在第二行的中间,裁剪类型:ARKUI_CLIP_TYPE_CIRCLE,圆形宽度:-20,圆形高度:-20 + auto stack_second_middle = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_circle_middle_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = -20}, {.f32 = -20}}; + ArkUI_AttributeItem clip_circle_middle_item = {clip_circle_middle_value, + sizeof(clip_circle_middle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second_middle, NODE_CLIP_SHAPE, &clip_circle_middle_item); + + // stack在第二行的最后,裁剪类型:ARKUI_CLIP_TYPE_CIRCLE,圆形宽度:10000,圆形高度:10000 + auto stack_second_end = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_circle_end_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 10000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_circle_end_item = {clip_circle_end_value, + sizeof(clip_circle_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second_end, NODE_CLIP_SHAPE, &clip_circle_end_item); + + // stack在第三行的左边,裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE,椭圆形宽度:35,椭圆形高度:20 + auto stack_third = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_ellipse_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 35}, {.f32 = 20}}; + ArkUI_AttributeItem clip_ellipse_item = {clip_ellipse_value, + sizeof(clip_ellipse_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_third, NODE_CLIP_SHAPE, &clip_ellipse_item); + + // stack在第三行的中间,裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE,椭圆形宽度:-35,椭圆形高度:-20 + auto stack_third_middle = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_ellipse_middle_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = -35}, {.f32 = -20}}; + ArkUI_AttributeItem clip_ellipse_middle_item = {clip_ellipse_middle_value, + sizeof(clip_ellipse_middle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_third_middle, NODE_CLIP_SHAPE, &clip_ellipse_middle_item); + + // stack在第三行的最后,裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE,椭圆形宽度:20000,椭圆形高度:10000 + auto stack_third_end = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_ellipse_end_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 20000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_ellipse_end_item = {clip_ellipse_end_value, + sizeof(clip_ellipse_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_third_end, NODE_CLIP_SHAPE, &clip_ellipse_end_item); + + // stack在第四行的左边,裁剪类型:ARKUI_CLIP_TYPE_PATH,路径宽度:35,路径高度:20,路径绘制的命令字符串:"M0 0 H20 + // V20 H0 Z" + auto stack_fourth = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_path_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 35}, {.f32 = 20}}; + std::string path = "M0 0 H20 V20 H0 Z"; + ArkUI_AttributeItem clip_path_item = {clip_path_value, sizeof(clip_path_value) / sizeof(ArkUI_NumberValue), + path.c_str()}; + nodeAPI->setAttribute(stack_fourth, NODE_CLIP_SHAPE, &clip_path_item); + + // stack在第四行的中间,裁剪类型:ARKUI_CLIP_TYPE_PATH,路径宽度:-35,路径高度:-20,路径绘制的命令字符串:"" + auto stack_fourth_middle = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_path_abnormal_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = -35}, {.f32 = -20}}; + std::string null_path = ""; + ArkUI_AttributeItem clip_path_abnormal_item = { + clip_path_abnormal_value, sizeof(clip_path_abnormal_value) / sizeof(ArkUI_NumberValue), null_path.c_str()}; + nodeAPI->setAttribute(stack_fourth_middle, NODE_CLIP_SHAPE, &clip_path_abnormal_item); + + // stack在第四行的右边,裁剪类型:ARKUI_CLIP_TYPE_PATH,路径宽度:10000,路径高度:10000,路径绘制的命令字符串:"M0 + // 0 H20 V20 H0 Z" + auto stack_fourth_end = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_path_large_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 10000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_path_large_item = { + clip_path_large_value, sizeof(clip_path_large_value) / sizeof(ArkUI_NumberValue), path.c_str()}; + nodeAPI->setAttribute(stack_fourth_end, NODE_CLIP_SHAPE, &clip_path_large_item); + + // stack在第五行的左边,NODE_CLIP设置为1,宽为35vp,高为20vp + auto stack_fifth = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem clip_item = {clip_value, sizeof(clip_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fifth, NODE_CLIP, &clip_item); + ArkUI_NumberValue stack_width_value[] = {{.f32 = 35}}; + ArkUI_AttributeItem stack_width_item = {stack_width_value, sizeof(stack_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fifth, NODE_WIDTH, &stack_width_item); + ArkUI_NumberValue stack_height_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem stack_height_item = {stack_height_value, + sizeof(stack_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fifth, NODE_HEIGHT, &stack_height_item); + + // stack在第五行的中间,NODE_CLIP设置为0,宽为35vp,高为20vp + auto stack_fifth_middle = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_false_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem clip_false_item = {clip_false_value, sizeof(clip_false_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fifth_middle, NODE_CLIP, &clip_false_item); + nodeAPI->setAttribute(stack_fifth_middle, NODE_WIDTH, &stack_width_item); + nodeAPI->setAttribute(stack_fifth_middle, NODE_HEIGHT, &stack_height_item); + + // stack在第五行的第三个,NODE_CLIP设置为-1,宽为35vp,高为20vp + auto stack_fifth_third = CreateSubStackNode(nodeAPI); + ArkUI_NumberValue clip_abnormal_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem clip_abnormal_item = {clip_abnormal_value, + sizeof(clip_abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fifth_third, NODE_CLIP, &clip_abnormal_item); + nodeAPI->setAttribute(stack_fifth_third, NODE_WIDTH, &stack_width_item); + nodeAPI->setAttribute(stack_fifth_third, NODE_HEIGHT, &stack_height_item); + + // 第五行的左边的stack子组件,宽为40vp,高为40vp,背景图片为rectIcon.png + auto subStack = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue width_value[] = {{.f32 = 40}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + char *image_url = "./resources/base/media/rectIcon.png"; + ArkUI_NumberValue background_image_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_NONE}}; + ArkUI_AttributeItem background_image_value_item = { + background_image_value, sizeof(background_image_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(subStack, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(subStack, NODE_HEIGHT, &width_item); + nodeAPI->setAttribute(subStack, NODE_BACKGROUND_IMAGE, &background_image_value_item); + + // 第五行的中间的stack子组件,宽为40vp,高为40vp,背景图片为rectIcon.png + auto subStackMiddle = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(subStackMiddle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(subStackMiddle, NODE_HEIGHT, &width_item); + nodeAPI->setAttribute(subStackMiddle, NODE_BACKGROUND_IMAGE, &background_image_value_item); + + // 第五行第三个的stack子组件,宽为40vp,高为40vp,背景图片为rectIcon.png + auto subStackThird = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(subStackThird, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(subStackThird, NODE_HEIGHT, &width_item); + nodeAPI->setAttribute(subStackThird, NODE_BACKGROUND_IMAGE, &background_image_value_item); + + // 创建一个column中包含5个row,并设置row的边框为1,宽为180vp,高为150vp + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue col_height_value[] = {{.f32 = 150}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 180}}; + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_first, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_third, NODE_BORDER_WIDTH, &border_item); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_fourth, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_fourth, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_fourth, NODE_BORDER_WIDTH, &border_item); + auto row_fifth = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_fifth, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_fifth, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_fifth, NODE_BORDER_WIDTH, &border_item); + + // 设置row子组件在水平方向上的对齐格式 + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_fourth, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_fifth, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + + // 子组件加入到父容器 + nodeAPI->addChild(column, row_first); + nodeAPI->addChild(column, row_second); + nodeAPI->addChild(column, row_third); + nodeAPI->addChild(column, row_fourth); + nodeAPI->addChild(column, row_fifth); + nodeAPI->addChild(row_first, stack_first); + nodeAPI->addChild(row_first, stack_first_middle); + nodeAPI->addChild(row_first, stack_first_end); + nodeAPI->addChild(row_second, stack_second); + nodeAPI->addChild(row_second, stack_second_middle); + nodeAPI->addChild(row_second, stack_second_end); + nodeAPI->addChild(row_third, stack_third); + nodeAPI->addChild(row_third, stack_third_middle); + nodeAPI->addChild(row_third, stack_third_end); + nodeAPI->addChild(row_fourth, stack_fourth); + nodeAPI->addChild(row_fourth, stack_fourth_middle); + nodeAPI->addChild(row_fourth, stack_fourth_end); + nodeAPI->addChild(stack_fifth, subStack); + nodeAPI->addChild(stack_fifth_middle, subStackMiddle); + nodeAPI->addChild(stack_fifth_third, subStackThird); + nodeAPI->addChild(row_fifth, stack_fifth); + nodeAPI->addChild(row_fifth, stack_fifth_middle); + nodeAPI->addChild(row_fifth, stack_fifth_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e321a848e55c13482c5304f3e5bbfaec89b71268 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_clip_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_STACK_CLIP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackClipTest { +public: + ~StackClipTest(); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..19b85a92f26d6c37d6e4df23bd0c4cd076d65ab8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_height_test.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value StackHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置stack组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置stack组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置stack组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first stack,设置高度为200 + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(stack, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(stack, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(stack, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_HEIGHT, &height_item); + + // second stack,设置高度为异常值 + auto stack_second = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(stack_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(stack_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(stack_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, stack); + nodeAPI->insertChildAfter(column, stack_second, stack); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value StackHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置高度为超大值500 + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置stack组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_WIDTH, &default_width_item); + + nodeAPI->addChild(column, stack); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d5aa32326517c360442e1266b38bd99aac333e0f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_STACK_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackHeightTest { +public: + ~StackHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_hittestbehavior_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_hittestbehavior_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0eb278d953dba870775cfa73460dc01feea386c6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_hittestbehavior_test.cpp @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_hittestbehavior_test.h" +#include "../manager/plugin_manager.h" + +#define STACK_ON_TOUCH_EVENT_ID 7001 +#define STACK_BROTHER_ON_TOUCH_EVENT_ID 7002 + +using namespace std; + +namespace ArkUICApiDemo { + +void StackHitTestBehaviorTest::OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t backgroundColor = 0xFF0000FF; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackEventOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackEventOnClickTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == STACK_ON_TOUCH_EVENT_ID) { + backgroundColor = 0xFF0000FF; + } else { + backgroundColor = 0xFF000000; + } + + // 如果是触摸事件 + if ((eventId == STACK_ON_TOUCH_EVENT_ID) || (eventId == STACK_BROTHER_ON_TOUCH_EVENT_ID)) { + // 修改组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +ArkUI_NodeHandle StackHitTestBehaviorTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t hitTestBehavior, + const char *onTouchTestStackParent, + const char *onTouchTestStack, + const char *onTouchTestStackBrother) +{ + float stackParentWidth = 80; + float stackParentHeight = 80; + float stackWidth = 60; + float stackHeight = 60; + float stackBrotherWidth = 40; + float stackBrotherHeight = 40; + uint32_t stackParentBackgroundColor = 0xFF888888; + uint32_t stackBackgroundColor = 0xFFFF0000; + uint32_t stackBrotherBackgroundColor = 0xFF00FF00; + + // 创建容器组件 + auto stackParent = node_api->createNode(ARKUI_NODE_STACK); + auto stack = node_api->createNode(ARKUI_NODE_STACK); + auto stackBrother = node_api->createNode(ARKUI_NODE_STACK); + + // 设置容器ID + ArkUI_AttributeItem id_item = {}; + id_item.string = onTouchTestStackParent; + node_api->setAttribute(stackParent, NODE_ID, &id_item); + + // 设置容器大小 + ArkUI_NumberValue stack_parent_width_value[] = {{.f32 = stackParentWidth}}; + ArkUI_AttributeItem stack_parent_width_item = {stack_parent_width_value, + sizeof(stack_parent_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stackParent, NODE_WIDTH, &stack_parent_width_item); + + ArkUI_NumberValue stack_parent_height_value[] = {{.f32 = stackParentHeight}}; + ArkUI_AttributeItem stack_parent_height_item = {stack_parent_height_value, + sizeof(stack_parent_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stackParent, NODE_HEIGHT, &stack_parent_height_item); + + // 设置容器组件背景色 + ArkUI_NumberValue stack_parent_background_color_value[] = {{.u32 = stackParentBackgroundColor}}; + ArkUI_AttributeItem stack_parent_background_color_item = { + stack_parent_background_color_value, sizeof(stack_parent_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stackParent, NODE_BACKGROUND_COLOR, &stack_parent_background_color_item); + + // 设置第一个子容器ID + ArkUI_AttributeItem stack_id_item = {}; + stack_id_item.string = onTouchTestStack; + node_api->setAttribute(stack, NODE_ID, &stack_id_item); + + // 设置第一个子容器大小 + ArkUI_NumberValue stack_width_value[] = {{.f32 = stackWidth}}; + ArkUI_AttributeItem stack_width_item = {stack_width_value, sizeof(stack_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &stack_width_item); + + ArkUI_NumberValue stack_height_value[] = {{.f32 = stackHeight}}; + ArkUI_AttributeItem stack_height_item = {stack_height_value, + sizeof(stack_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &stack_height_item); + + // 设置第一个子容器组件背景色 + ArkUI_NumberValue stack_background_color_value[] = {{.u32 = stackBackgroundColor}}; + ArkUI_AttributeItem stack_background_color_item = { + stack_background_color_value, sizeof(stack_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &stack_background_color_item); + + node_api->registerNodeEvent(stack, NODE_TOUCH_EVENT, STACK_ON_TOUCH_EVENT_ID, nullptr); + + // 添加到父容器 + node_api->addChild(stackParent, stack); + + // 设置第二个子容器ID + ArkUI_AttributeItem stack_brother_id_item = {}; + stack_brother_id_item.string = onTouchTestStackBrother; + node_api->setAttribute(stackBrother, NODE_ID, &stack_brother_id_item); + + // 设置第二个子容器大小 + ArkUI_NumberValue stack_brother_width_value[] = {{.f32 = stackBrotherWidth}}; + ArkUI_AttributeItem stack_brother_width_item = {stack_brother_width_value, + sizeof(stack_brother_width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stackBrother, NODE_WIDTH, &stack_brother_width_item); + + ArkUI_NumberValue stack_brother_height_value[] = {{.f32 = stackBrotherHeight}}; + ArkUI_AttributeItem stack_brother_height_item = {stack_brother_height_value, + sizeof(stack_brother_height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stackBrother, NODE_HEIGHT, &stack_brother_height_item); + + // 设置第二个子容器组件背景色 + ArkUI_NumberValue stack_brother_background_color_value[] = {{.u32 = stackBrotherBackgroundColor}}; + ArkUI_AttributeItem stack_brother_background_color_item = { + stack_brother_background_color_value, sizeof(stack_brother_background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stackBrother, NODE_BACKGROUND_COLOR, &stack_brother_background_color_item); + + // 设置触摸测试属性 + ArkUI_NumberValue stack_brother_hittestbehavior_value[] = {{.i32 = hitTestBehavior}}; + ArkUI_AttributeItem stack_brother_hittestbehavior_item = { + stack_brother_hittestbehavior_value, sizeof(stack_brother_hittestbehavior_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stackBrother, NODE_HIT_TEST_BEHAVIOR, &stack_brother_hittestbehavior_item); + + node_api->registerNodeEvent(stackBrother, NODE_TOUCH_EVENT, STACK_BROTHER_ON_TOUCH_EVENT_ID, nullptr); + + node_api->addChild(stackParent, stackBrother); + + return stackParent; +} + +napi_value StackHitTestBehaviorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackHitTestBehaviorTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackHitTestBehaviorTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 触摸测试控制值为ARKUI_HIT_TEST_MODE_DEFAULT + int32_t hitTestBehavior = PARAM_0; + string onTouchTestStackParent = "OnTouchTestStackParentDefault"; + string onTouchTestStack = "OnTouchTestStackDefault"; + string onTouchTestStackBrother = "OnTouchTestStackBrotherDefault"; + auto stackParent = CreateSubStackNode(nodeAPI, hitTestBehavior, onTouchTestStackParent.c_str(), + onTouchTestStack.c_str(), onTouchTestStackBrother.c_str()); + nodeAPI->addChild(column, stackParent); + + // 触摸测试控制值为ARKUI_HIT_TEST_MODE_BLOCK + hitTestBehavior = PARAM_1; + onTouchTestStackParent = "OnTouchTestStackParentBlock"; + onTouchTestStack = "OnTouchTestStackBlock"; + onTouchTestStackBrother = "OnTouchTestStackBrotherBlock"; + stackParent = CreateSubStackNode(nodeAPI, hitTestBehavior, onTouchTestStackParent.c_str(), onTouchTestStack.c_str(), + onTouchTestStackBrother.c_str()); + nodeAPI->addChild(column, stackParent); + + // 触摸测试控制值为ARKUI_HIT_TEST_MODE_TRANSPARENT + hitTestBehavior = PARAM_2; + onTouchTestStackParent = "OnTouchTestStackParentTransparent"; + onTouchTestStack = "OnTouchTestStackTransparent"; + onTouchTestStackBrother = "OnTouchTestStackBrotherTransparent"; + stackParent = CreateSubStackNode(nodeAPI, hitTestBehavior, onTouchTestStackParent.c_str(), onTouchTestStack.c_str(), + onTouchTestStackBrother.c_str()); + nodeAPI->addChild(column, stackParent); + + // 触摸测试控制值为ARKUI_HIT_TEST_MODE_NONE + hitTestBehavior = PARAM_3; + onTouchTestStackParent = "OnTouchTestStackParentNone"; + onTouchTestStack = "OnTouchTestStackNone"; + onTouchTestStackBrother = "OnTouchTestStackBrotherNone"; + stackParent = CreateSubStackNode(nodeAPI, hitTestBehavior, onTouchTestStackParent.c_str(), onTouchTestStack.c_str(), + onTouchTestStackBrother.c_str()); + nodeAPI->addChild(column, stackParent); + + // 触摸测试控制值为-1 + hitTestBehavior = -1; + onTouchTestStackParent = "OnTouchTestStackParentExceptBelow"; + onTouchTestStack = "OnTouchTestStackExceptBelow"; + onTouchTestStackBrother = "OnTouchTestStackBrotherExceptBelow"; + stackParent = CreateSubStackNode(nodeAPI, hitTestBehavior, onTouchTestStackParent.c_str(), onTouchTestStack.c_str(), + onTouchTestStackBrother.c_str()); + nodeAPI->addChild(column, stackParent); + + // 触摸测试控制值为4 + hitTestBehavior = PARAM_4; + onTouchTestStackParent = "OnTouchTestStackParentExceptAbove"; + onTouchTestStack = "OnTouchTestStackExceptAbove"; + onTouchTestStackBrother = "OnTouchTestStackBrotherExceptAbove"; + stackParent = CreateSubStackNode(nodeAPI, hitTestBehavior, onTouchTestStackParent.c_str(), onTouchTestStack.c_str(), + onTouchTestStackBrother.c_str()); + nodeAPI->addChild(column, stackParent); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackHitTestBehaviorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_hittestbehavior_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_hittestbehavior_test.h new file mode 100644 index 0000000000000000000000000000000000000000..95e14cbbdc07da5dc756513a775a97c185b91b67 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_hittestbehavior_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_HITTESTBEHAVIOR_TEST_H +#define ARKUI_CAPI_DEMO_STACK_HITTESTBEHAVIOR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +using namespace std; + +namespace ArkUICApiDemo { + +class StackHitTestBehaviorTest { +public: + ~StackHitTestBehaviorTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t hittestbehavior, + const char *ontouchteststackparent, const char *ontouchteststack, + const char *ontouchteststackbrother); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_HITTESTBEHAVIOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_id_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_id_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e3093e34997cd0d669f4ced718d70f55358b24ee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_id_test.cpp @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_id_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +#define ON_CLICK_EVENT_ID_SECOND 16001 +#define ON_CLICK_EVENT_ID_THIRD 16002 + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackIdTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackIdTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackIdTest", "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + uint32_t color = COLOR_PURPLE; + if (eventId == ON_CLICK_EVENT_ID) { + color = COLOR_RED; + } + if (eventId == ON_CLICK_EVENT_ID_SECOND) { + color = COLOR_GREEN; + } + if (eventId == ON_CLICK_EVENT_ID_THIRD) { + color = COLOR_BLUE; + } + // 设置stack背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; +} + +napi_value StackIdTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackIdTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackIdTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // stack宽度设置为200 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + // stack高度设置为100 + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + // 设置每行及每个stack边框为1 + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + + // first stack + auto stack_first = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_first, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_first, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_first, NODE_BORDER_WIDTH, &border_item); + ArkUI_AttributeItem stack_first_id_item = {}; + stack_first_id_item.string = "FirstStack"; + nodeAPI->setAttribute(stack_first, NODE_ID, &stack_first_id_item); + + // second stack + auto stack_second = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_second, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_second, NODE_BORDER_WIDTH, &border_item); + ArkUI_AttributeItem stack_second_id_item = {}; + stack_second_id_item.string = "SecondStack"; + nodeAPI->setAttribute(stack_second, NODE_ID, &stack_second_id_item); + + // third stack + auto stack_third = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_third, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_third, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_third, NODE_BORDER_WIDTH, &border_item); + ArkUI_AttributeItem stack_third_id_item = {}; + stack_third_id_item.string = "FirstStack"; + nodeAPI->setAttribute(stack_third, NODE_ID, &stack_third_id_item); + + // 绑定点击事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(stack_first, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(stack_second, NODE_ON_CLICK, ON_CLICK_EVENT_ID_SECOND, nullptr); + nodeAPI->registerNodeEvent(stack_third, NODE_ON_CLICK, ON_CLICK_EVENT_ID_THIRD, nullptr); + + // 创建一个parent node:column中包含3个row + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue row_width_value[] = {{.f32 = 400}}; + ArkUI_NumberValue row_height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + + // 设置每行宽高,边框,水平方向上的对齐格式 + nodeAPI->setAttribute(row_first, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_third, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + + // 子组件加入到父容器 + nodeAPI->addChild(row_first, stack_first); + nodeAPI->addChild(row_second, stack_second); + nodeAPI->addChild(row_third, stack_third); + + // 将3个行容器全部添加到父控件column + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackIdTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_id_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_id_test.h new file mode 100644 index 0000000000000000000000000000000000000000..56f5aab6d274f74f4a8ca3eadc5de97027090923 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_id_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_ID_TEST_H +#define ARKUI_CAPI_DEMO_STACK_ID_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackIdTest { +public: + ~StackIdTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_ID_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_lineargradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_lineargradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9416485890958ec377e1b94464b2114584a59ad3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_lineargradient_test.cpp @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_lineargradient_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle StackLinearGradientTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t direction) +{ + // stack宽度设置为70 + ArkUI_NumberValue width_value[] = {{.f32 = 70}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + // stack高度设置为50 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + // 设置每行及每个stack边框为1 + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + // 渐变颜色 + unsigned int colors[] = {0xFFFF0000, 0xFF0000FF}; + // 渐变位置 + float stops[] = {0.0, 1.0}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + // 渐变效果 + ArkUI_NumberValue linearGradient_value[] = {60, {.i32 = direction}, {.i32 = false}}; + ArkUI_AttributeItem linearGradient_item = {linearGradient_value, + sizeof(linearGradient_value) / sizeof(ArkUI_NumberValue)}; + linearGradient_item.object = &colorStop; + + auto stack = node_api->createNode(ARKUI_NODE_STACK); + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + node_api->setAttribute(stack, NODE_BORDER_WIDTH, &border_item); + node_api->setAttribute(stack, NODE_LINEAR_GRADIENT, &linearGradient_item); + + return stack; +} + +napi_value StackLinearGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置stack边框为1 + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + + // stack in the left of first row + auto stack_first = CreateSubStackNode(nodeAPI, ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT); + + // stack in the end of first row + auto stack_first_end = CreateSubStackNode(nodeAPI, ARKUI_LINEAR_GRADIENT_DIRECTION_TOP); + + // stack in the left of second row + auto stack_second = CreateSubStackNode(nodeAPI, ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT); + + // stack in the middle of second row + auto stack_second_middle = CreateSubStackNode(nodeAPI, ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM); + + // stack in the end of second row + auto stack_second_end = CreateSubStackNode(nodeAPI, ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP); + + // stack in the left of third row + auto stack_third = CreateSubStackNode(nodeAPI, ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM); + + // stack in the middle of third row + auto stack_third_middle = CreateSubStackNode(nodeAPI, ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP); + + // stack in the end of third row + auto stack_third_end = CreateSubStackNode(nodeAPI, ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM); + + // stack in the left of fourth row + auto stack_fourth = CreateSubStackNode(nodeAPI, ARKUI_LINEAR_GRADIENT_DIRECTION_NONE); + + // stack in the end of fourth row + auto stack_fourth_end = CreateSubStackNode(nodeAPI, ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM); + + // 创建一个parent node:column中包含4个row + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue row_width_value[] = {{.f32 = 400}}; + ArkUI_NumberValue row_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + + // 设置每行宽高,背景颜色,边框,水平方向上的对齐格式 + nodeAPI->setAttribute(row_first, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_third, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_fourth, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_fourth, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_fourth, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_fourth, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + + // 子组件加入到父容器 + nodeAPI->addChild(row_first, stack_first); + nodeAPI->insertChildAfter(row_first, stack_first_end, stack_first); + + nodeAPI->addChild(row_second, stack_second); + nodeAPI->insertChildAfter(row_second, stack_second_middle, stack_second); + nodeAPI->insertChildAfter(row_second, stack_second_end, stack_second_middle); + + nodeAPI->addChild(row_third, stack_third); + nodeAPI->insertChildAfter(row_third, stack_third_middle, stack_third); + nodeAPI->insertChildAfter(row_third, stack_third_end, stack_third_middle); + + nodeAPI->addChild(row_fourth, stack_fourth); + nodeAPI->insertChildAfter(row_fourth, stack_fourth_end, stack_fourth); + + // 将4个行容器全部添加到父控件column + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + nodeAPI->insertChildAfter(column, row_fourth, row_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_lineargradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_lineargradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a358cf0feeea3e73737b3fbf6018906dda7b23b5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_lineargradient_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_LINEARGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_STACK_LINEARGRADIENT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackLinearGradientTest { +public: + ~StackLinearGradientTest(); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, int32_t direction); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_LINEARGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_margin_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_margin_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a53bbbb5d4cf9fafce3c6a18020d42822c3c193c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_margin_test.cpp @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_margin_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value StackMarginTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackMarginTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // stack宽度设置为100 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + // stack高度设置为50 + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + // 设置每行及每个stack边框为1 + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + + // stack in the left of first row + auto stack_first = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_first, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_first, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_first, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue margin_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first, NODE_MARGIN, &margin_item); + + // stack in the left of second row + auto stack_second = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_second, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_second, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue margin_second_value[] = {{.f32 = -10}}; + ArkUI_AttributeItem margin_second_item = {margin_second_value, + sizeof(margin_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second, NODE_MARGIN, &margin_second_item); + + // stack in the left of third row + auto stack_third = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_third, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_third, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_third, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue margin_third_value[] = {{.f32 = 10}, {.f32 = 10}, {.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem margin_third_item = {margin_third_value, + sizeof(margin_third_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_third, NODE_MARGIN, &margin_third_item); + + // stack in the left of fourth row + auto stack_fourth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fourth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_fourth, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_fourth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue margin_fourth_value[] = {{.f32 = -10}, {.f32 = -10}, {.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem margin_fourth_item = {margin_fourth_value, + sizeof(margin_fourth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fourth, NODE_MARGIN, &margin_fourth_item); + + // 创建一个parent node:column中包含4个row + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue row_width_value[] = {{.f32 = 400}}; + ArkUI_NumberValue row_height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_VERTICAL_ALIGNMENT_TOP}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + + // 设置每行宽高,边框 + nodeAPI->setAttribute(row_first, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_first, NODE_ROW_ALIGN_ITEMS, &justify_content_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_second, NODE_ROW_ALIGN_ITEMS, &justify_content_item); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_third, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_third, NODE_ROW_ALIGN_ITEMS, &justify_content_item); + nodeAPI->setAttribute(row_fourth, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_fourth, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_fourth, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_fourth, NODE_ROW_ALIGN_ITEMS, &justify_content_item); + + // 子组件加入到父容器 + nodeAPI->addChild(row_first, stack_first); + nodeAPI->addChild(row_second, stack_second); + nodeAPI->addChild(row_third, stack_third); + nodeAPI->addChild(row_fourth, stack_fourth); + + // 将五个行容器全部添加到父控件column + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + nodeAPI->insertChildAfter(column, row_fourth, row_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_margin_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_margin_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0ce1249e3bc9e6a7e7687c4fd287e7c3d03493a3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_margin_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_MARGIN_TEST_H +#define ARKUI_CAPI_DEMO_STACK_MARGIN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackMarginTest { +public: + ~StackMarginTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_MARGIN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_onareachange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_onareachange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eae2273d5c495468f328d765186661e1ffce67f9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_onareachange_test.cpp @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_onareachange_test.h" +#include "../manager/plugin_manager.h" +#include + +#define ON_CLICK_EVENT_ID_OFFSET 16001 +#define ON_AREA_CHANGE_SIZE_EVENT_ID 7004 +#define ON_AREA_CHANGE_OFFSET_EVENT_ID 8004 + +namespace ArkUICApiDemo { + +bool changeFlag = false; + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, uint32_t initialColor, int32_t clickEventID) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_STACK); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = initialColor}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, clickEventID, nullptr); + + return nodeHandle; +} + +static void PrintOnAreaChangeBackData(ArkUI_NodeComponentEvent *result) +{ + for (int i = PARAM_0; i < PARAM_12; i++) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackOnAreaChangeTest", + "PrintOnAreaChangeBackData result->data[%{public}d].f32: %{public}f", i, result->data[i].f32); + } +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackOnAreaChangeTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackOnAreaChangeTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackOnAreaChangeTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_CLICK_EVENT_ID) { + changeFlag = true; + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_WIDTH, &width_item); + } + + if (eventId == ON_CLICK_EVENT_ID_OFFSET) { + changeFlag = true; + ArkUI_NumberValue offset_value[] = {{.f32 = SIZE_100}, {.f32 = SIZE_100}}; + ArkUI_AttributeItem offset_item = {offset_value, sizeof(offset_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_OFFSET, &offset_item); + } + + if (changeFlag && eventId == ON_AREA_CHANGE_SIZE_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + PrintOnAreaChangeBackData(result); + bool checkResult = false; + checkResult = (result->data[PARAM_0].f32 < result->data[PARAM_6].f32) && + (result->data[PARAM_1].f32 == result->data[PARAM_7].f32) && + (result->data[PARAM_2].f32 == result->data[PARAM_8].f32) && + (result->data[PARAM_3].f32 == result->data[PARAM_9].f32) && + (result->data[PARAM_4].f32 > result->data[PARAM_10].f32) && + (result->data[PARAM_5].f32 == result->data[PARAM_11].f32); + if (checkResult) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } + + if (changeFlag && eventId == ON_AREA_CHANGE_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + PrintOnAreaChangeBackData(result); + bool checkResult = false; + checkResult = (result->data[PARAM_0].f32 == result->data[PARAM_6].f32) && + (result->data[PARAM_1].f32 == result->data[PARAM_7].f32) && + (result->data[PARAM_2].f32 == result->data[PARAM_8].f32) && + (result->data[PARAM_3].f32 == result->data[PARAM_9].f32) && + (result->data[PARAM_4].f32 > result->data[PARAM_10].f32) && + (result->data[PARAM_5].f32 == result->data[PARAM_11].f32); + if (checkResult) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } + + if (changeFlag && eventId == ON_AREA_CHANGE_OFFSET_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +napi_value StackOnAreaChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackOnAreaChangeTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackOnAreaChangeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowSize = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowMove = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowOffset = nodeAPI->createNode(ARKUI_NODE_ROW); + auto stackSpanSize = createChildNode(nodeAPI, COLOR_RED, ON_CLICK_EVENT_ID); + auto stackSpanMove = createChildNode(nodeAPI, COLOR_RED, ON_CLICK_EVENT_ID); + auto stackSpanMoveCompare = createChildNode(nodeAPI, COLOR_LIGHT_BLUE, ON_CLICK_EVENT_ID); + auto stackSpanOffset = createChildNode(nodeAPI, COLOR_RED, ON_CLICK_EVENT_ID_OFFSET); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnAreaChangeTestStackSize"; + nodeAPI->setAttribute(stackSpanSize, NODE_ID, &id_item); + id_item.string = "OnAreaChangeTestStackMove"; + nodeAPI->setAttribute(stackSpanMove, NODE_ID, &id_item); + id_item.string = "OnAreaChangeTestStackMoveCompare"; + nodeAPI->setAttribute(stackSpanMoveCompare, NODE_ID, &id_item); + id_item.string = "OnAreaChangeTestStackOffset"; + nodeAPI->setAttribute(stackSpanOffset, NODE_ID, &id_item); + + nodeAPI->addChild(rowSize, stackSpanSize); + nodeAPI->addChild(rowMove, stackSpanMove); + nodeAPI->addChild(rowMove, stackSpanMoveCompare); + nodeAPI->addChild(rowOffset, stackSpanOffset); + + nodeAPI->registerNodeEvent(stackSpanSize, NODE_EVENT_ON_AREA_CHANGE, ON_AREA_CHANGE_SIZE_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(stackSpanMove, NODE_EVENT_ON_AREA_CHANGE, ON_AREA_CHANGE_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(stackSpanOffset, NODE_EVENT_ON_AREA_CHANGE, ON_AREA_CHANGE_OFFSET_EVENT_ID, nullptr); + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + nodeAPI->addChild(column, rowSize); + nodeAPI->addChild(column, rowMove); + nodeAPI->addChild(column, rowOffset); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackOnAreaChangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_onareachange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_onareachange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..15f891931bdd26341136d78559166224f087acd2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_onareachange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_ONAREACHANGE_TEST_H +#define ARKUI_CAPI_DEMO_STACK_ONAREACHANGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackOnAreaChangeTest { +public: + ~StackOnAreaChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_ONAREACHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_ontouch_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_ontouch_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6c253b2fa7aa3e531a049ee63337a87f619221e9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_ontouch_test.cpp @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_ontouch_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +using namespace std; +static ArkUI_NodeHandle text; + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_STACK); + + ArkUI_NumberValue enable_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enable_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enable_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_TOUCH_EVENT, ON_TOUCH_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackOnTouchTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackOnTouchTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackOnTouchTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_TOUCH_EVENT_ID) { + ArkUI_UIInputEvent *result = OH_ArkUI_NodeEvent_GetInputEvent(event); + if (text != nullptr && OH_ArkUI_UIInputEvent_GetEventTime(result) > 0) { + string str = "type:" + to_string(OH_ArkUI_UIInputEvent_GetType(result)) + "\n" + + "touches:" + to_string(OH_ArkUI_PointerEvent_GetPointerCount(result)) + "\n" + + "windowX:" + to_string(OH_ArkUI_PointerEvent_GetWindowX(result)) + "\n" + + "windowY:" + to_string(OH_ArkUI_PointerEvent_GetWindowY(result)) + "\n" + + "displayX:" + to_string(OH_ArkUI_PointerEvent_GetDisplayX(result)) + "\n" + + "displayY:" + to_string(OH_ArkUI_PointerEvent_GetDisplayY(result)) + "\n" + + "source:" + to_string(OH_ArkUI_UIInputEvent_GetSourceType(result)); + ArkUI_AttributeItem content_item = {}; + content_item.string = str.c_str(); + nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &content_item); + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +napi_value StackOnTouchTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackOnTouchTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackOnTouchTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto stackEnabled = createChildNode(nodeAPI, true); + auto stackDisabled = createChildNode(nodeAPI, false); + text = nodeAPI->createNode(ARKUI_NODE_TEXT); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnTouchTest"; + nodeAPI->setAttribute(stackEnabled, NODE_ID, &id_item); + id_item.string = "OnTouchTestDisable"; + nodeAPI->setAttribute(stackDisabled, NODE_ID, &id_item); + + nodeAPI->addChild(rowFirst, stackEnabled); + nodeAPI->addChild(rowSecond, stackDisabled); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, text); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackOnTouchTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_ontouch_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_ontouch_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fe2480758fb0ec4f35a5660d61758cad4921ae9a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_ontouch_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_ONTOUCH_TEST_H +#define ARKUI_CAPI_DEMO_STACK_ONTOUCH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackOnTouchTest { +public: + ~StackOnTouchTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_ONTOUCH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_opacity_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_opacity_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..63cbed3ab375144c7c7b0ad59c5b2560f6484981 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_opacity_test.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_opacity_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle StackOpacityTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float opacity) +{ + uint32_t background_color = 0xFFFF0000; + + auto stack = node_api->createNode(ARKUI_NODE_IMAGE); + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置组件透明度值 + ArkUI_NumberValue opacity_value[] = {{.f32 = opacity}}; + ArkUI_AttributeItem opacity_item = {opacity_value, sizeof(opacity_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_OPACITY, &opacity_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + + return stack; +} + +napi_value StackOpacityTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackOpacityTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float opacity = 0; + float width = 50; + float height = 50; + auto stack = CreateSubStackNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + opacity = 0.5; + stack = CreateSubStackNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + opacity = 0.6; + stack = CreateSubStackNode(nodeAPI, width, height, opacity); + auto subStack = CreateSubStackNode(nodeAPI, 30, 30, opacity); + // 设置子组件背景色为绿色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(subStack, NODE_BACKGROUND_COLOR, &background_color_item); + // 添加组件到容器 + nodeAPI->addChild(stack, subStack); + nodeAPI->addChild(column, stack); + + opacity = 1; + stack = CreateSubStackNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + opacity = -1; + stack = CreateSubStackNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + opacity = 2; + stack = CreateSubStackNode(nodeAPI, width, height, opacity); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为150vp,高度为500vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 500}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_opacity_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_opacity_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f5d96c09cc19b50d5b891736b78459821bcacb43 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_opacity_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_OPACITY_TEST_H +#define ARKUI_CAPI_DEMO_STACK_OPACITY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackOpacityTest { +public: + ~StackOpacityTest(); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float width, float height, + float opacity); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_OPACITY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_position_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_position_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ed8dc54728fa2ad5e03bf9ff289e92c8379bcfde --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_position_test.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_position_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value StackPositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackPositionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackPositionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置stack组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置stack组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // first stack,设置position为{10,10} + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue position_value[] = {{.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_POSITION, &position_item); + nodeAPI->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(stack, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(stack, NODE_HEIGHT, &default_height_item); + + // second stack,设置position为{-10,-10} + auto stack_second = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue position_second_value[] = {{.f32 = -10}, {.f32 = -10}}; + ArkUI_AttributeItem position_second_item = {position_second_value, + sizeof(position_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second, NODE_POSITION, &position_second_item); + nodeAPI->setAttribute(stack_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(stack_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(stack_second, NODE_HEIGHT, &default_height_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, stack); + nodeAPI->insertChildAfter(column, stack_second, stack); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackPositionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_position_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_position_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d1847846661108a48f09b1afecbad258b09947ff --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_position_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_POSITION_TEST_H +#define ARKUI_CAPI_DEMO_STACK_POSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackPositionTest { +public: + ~StackPositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_POSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_rotate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_rotate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..43fccbec23250ad3e3d8f330de8551b30c22b277 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_rotate_test.cpp @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_rotate_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle StackRotateTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y, float z, + float angle, float perspective) +{ + float width = 80; + float height = 80; + auto stack = node_api->createNode(ARKUI_NODE_STACK); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置组件背景图片 + const char *image_url = "./resources/base/media/icon.png"; + ArkUI_NumberValue background_image_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_NONE}}; + ArkUI_AttributeItem background_image_value_item = { + background_image_value, sizeof(background_image_value) / sizeof(ArkUI_NumberValue), image_url}; + node_api->setAttribute(stack, NODE_BACKGROUND_IMAGE, &background_image_value_item); + + // 设置组件旋转系数 + ArkUI_NumberValue rotate_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}, {.f32 = angle}, {.f32 = perspective}}; + ArkUI_AttributeItem rotate_item = {rotate_value, sizeof(rotate_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_ROTATE, &rotate_item); + + return stack; +} + +napi_value StackRotateTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackRotateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackRotateTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float x = 10; + float y = 0; + float z = 0; + float angle = 60; + float perspective = 0; + auto stack = CreateSubStackNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + x = 0; + y = 10; + z = 0; + angle = 60; + perspective = 0; + stack = CreateSubStackNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + x = 0; + y = 0; + z = 10; + angle = 60; + perspective = 0; + stack = CreateSubStackNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + x = -10; + y = 0; + z = 0; + angle = -60; + perspective = 0; + stack = CreateSubStackNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + x = 0; + y = -10; + z = 0; + angle = -60; + perspective = 0; + stack = CreateSubStackNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + x = 0; + y = 0; + z = -10; + angle = -60; + perspective = 0; + stack = CreateSubStackNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + x = 0; + y = 0; + z = 0; + angle = 0; + perspective = 100; + stack = CreateSubStackNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + x = 0; + y = 0; + z = 0; + angle = 0; + perspective = -100; + stack = CreateSubStackNode(nodeAPI, x, y, z, angle, perspective); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为150vp,高度为830vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 830}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackRotateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_rotate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_rotate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f388472716c22349ef1d06a6ea5aba3b782667f5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_rotate_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_ROTATE_TEST_H +#define ARKUI_CAPI_DEMO_STACK_ROTATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackRotateTest { +public: + ~StackRotateTest(); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y, float z, float angle, + float perspective); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_ROTATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_saturate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_saturate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..79e9681d6fa040acb481ee27573a8fee0963a102 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_saturate_test.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_saturate_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle StackSaturateTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float value) +{ + float width = 50; + float height = 50; + uint32_t background_color = 0xFFCC0000; + auto stack = node_api->createNode(ARKUI_NODE_STACK); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件饱和度效果系数 + ArkUI_NumberValue saturate_value[] = {{.f32 = value}}; + ArkUI_AttributeItem saturate_item = {saturate_value, sizeof(saturate_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_SATURATION, &saturate_item); + + return stack; +} + +napi_value StackSaturateTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackSaturateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackSaturateTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float value = 0; + auto stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = 0.5; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = 1; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = 49; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = 100; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + value = -1; + stack = CreateSubStackNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为150vp,高度为500vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 500}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackSaturateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_saturate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_saturate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..457b3a7eac91f40d374c77b9abedff53e6b87e9d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_saturate_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_SATURATIONE_TEST_H +#define ARKUI_CAPI_DEMO_STACK_SATURATIONE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackSaturateTest { +public: + ~StackSaturateTest(); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_SATURATIONE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_scale_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_scale_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..374e55bbe1c284a4dd52602e10432d9c7ef9da92 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_scale_test.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_scale_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle StackScaleTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y) +{ + float width = 50; + float height = 50; + uint32_t background_color = 0xFFFF0000; + auto stack = node_api->createNode(ARKUI_NODE_STACK); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + const char *image_url = "./resources/base/media/rectIcon.png"; + ArkUI_NumberValue background_image_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_XY}}; + ArkUI_AttributeItem background_image_value_item = { + background_image_value, sizeof(background_image_value) / sizeof(ArkUI_NumberValue), image_url}; + node_api->setAttribute(stack, NODE_BACKGROUND_IMAGE, &background_image_value_item); + + // 设置组件边框圆角值 + ArkUI_NumberValue border_radius_value[] = {{.f32 = 5}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BORDER_RADIUS, &border_radius_item); + + // 设置组件缩放系数 + ArkUI_NumberValue scale_value[] = {{.f32 = x}, {.f32 = y}}; + ArkUI_AttributeItem scale_item = {scale_value, sizeof(scale_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_SCALE, &scale_item); + + return stack; +} + +napi_value StackScaleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackScaleTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float x = 0.5; + float y = 0.5; + auto stack = CreateSubStackNode(nodeAPI, x, y); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + x = 2; + y = 2; + stack = CreateSubStackNode(nodeAPI, x, y); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + x = -2; + y = -2; + stack = CreateSubStackNode(nodeAPI, x, y); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 设置column子组件在竖直方向上的对齐格式为均匀分配,宽度为150vp,高度为500vp + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 500}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_scale_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_scale_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6cf5c550fffb5de27958ef659ecd89e63f630e3d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_scale_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_SCALE_TEST_H +#define ARKUI_CAPI_DEMO_STACK_SCALE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackScaleTest { +public: + ~StackScaleTest(); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_SCALE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_shadow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_shadow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..87db8a7c3afc2675bf8dabfc2e78bd248e27bf05 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_shadow_test.cpp @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_shadow_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value StackShadowTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // stack宽度设置为100 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + // stack高度设置为50 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + // 设置每行及每个stack边框为1 + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + + // stack in the left of first row + auto stack_first = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_first, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_first, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_first, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue shadow_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS}}; + ArkUI_AttributeItem shadow_item = {shadow_value, sizeof(shadow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first, NODE_SHADOW, &shadow_item); + + // stack in the end of first row + auto stack_first_end = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_first_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_first_end, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_first_end, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue shadow_first_end_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM}}; + ArkUI_AttributeItem shadow_first_end__item = {shadow_first_end_value, + sizeof(shadow_first_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_first_end, NODE_SHADOW, &shadow_first_end__item); + + // stack in the left of second row + auto stack_second = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_second, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_second, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue shadow_second_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD}}; + ArkUI_AttributeItem shadow_second_item = {shadow_second_value, + sizeof(shadow_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second, NODE_SHADOW, &shadow_second_item); + + // stack in the end of second row + auto stack_second_end = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_second_end, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_second_end, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue shadow_second_end_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG}}; + ArkUI_AttributeItem shadow_second_end_item = {shadow_second_end_value, + sizeof(shadow_second_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second_end, NODE_SHADOW, &shadow_second_end_item); + + // stack in the left of third row + auto stack_third = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_third, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_third, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_third, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue shadow_third_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM}}; + ArkUI_AttributeItem shadow_third_item = {shadow_third_value, + sizeof(shadow_third_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_third, NODE_SHADOW, &shadow_third_item); + + // stack in the end of third row + auto stack_third_end = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_third_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_third_end, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_third_end, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue shadow_third_end_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD}}; + ArkUI_AttributeItem shadow_third_end_item = {shadow_third_end_value, + sizeof(shadow_third_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_third_end, NODE_SHADOW, &shadow_third_end_item); + + // stack in the left of fourth row + auto stack_fourth = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_fourth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(stack_fourth, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(stack_fourth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue shadow_fourth_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem shadow_fourth_item = {shadow_fourth_value, + sizeof(shadow_fourth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_fourth, NODE_SHADOW, &shadow_fourth_item); + + // 创建一个parent node:column中包含4个row + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue row_width_value[] = {{.f32 = 400}}; + ArkUI_NumberValue row_height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + + // 设置每行宽高,边框,水平方向上的对齐格式 + nodeAPI->setAttribute(row_first, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_third, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->setAttribute(row_fourth, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_fourth, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_fourth, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_fourth, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + + // 子组件加入到父容器 + nodeAPI->addChild(row_first, stack_first); + nodeAPI->insertChildAfter(row_first, stack_first_end, stack_first); + + nodeAPI->addChild(row_second, stack_second); + nodeAPI->insertChildAfter(row_second, stack_second_end, stack_second); + + nodeAPI->addChild(row_third, stack_third); + nodeAPI->insertChildAfter(row_third, stack_third_end, stack_third); + + nodeAPI->addChild(row_fourth, stack_fourth); + + // 将五个行容器全部添加到父控件column + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + nodeAPI->insertChildAfter(column, row_fourth, row_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_shadow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_shadow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5c6777282ce9df3d0eceb9030bbc472e072fbad4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_shadow_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_SHADOW_TEST_H +#define ARKUI_CAPI_DEMO_STACK_SHADOW_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackShadowTest { +public: + ~StackShadowTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_SHADOW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transform_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transform_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2e8bfa13bbedb31f0bc25ca5df615e1ff23ae176 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transform_test.cpp @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_transform_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define PARAM_05 0.5 +#define PARAM_NEGATIVE_05 (-0.5) +#define PARAM_NEGATIVE_2 (-2) +#define PARAM_NEGATIVE_3 (-3) + +#define MARGIN 50 + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_STACK); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + return nodeHandle; +} + +napi_value StackTransformTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackTransformTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackTransformTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + + auto stackFirst = createChildNode(nodeAPI); + auto stackFirstEnd = createChildNode(nodeAPI); + auto stackSecond = createChildNode(nodeAPI); + auto stackSecondEnd = createChildNode(nodeAPI); + auto stackThird = createChildNode(nodeAPI); + auto stackThirdEnd = createChildNode(nodeAPI); + + // First stack + ArkUI_NumberValue transform_value[] = {{.f32 = PARAM_2}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, + {.f32 = PARAM_0}, {.f32 = PARAM_1}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, + {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_1}, {.f32 = PARAM_0}, + {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_1}}; + ArkUI_AttributeItem transform_item = {transform_value, sizeof(transform_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFirst, NODE_TRANSFORM, &transform_item); + + // FirstEnd stack + ArkUI_NumberValue transform_first_end_value[] = { + {.f32 = PARAM_1}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_2}, + {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_1}, {.f32 = PARAM_0}, + {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_1}}; + ArkUI_AttributeItem transform_first_end_item = {transform_first_end_value, + sizeof(transform_first_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFirstEnd, NODE_TRANSFORM, &transform_first_end_item); + + // Second stack + ArkUI_NumberValue transform_second_value[] = { + {.f32 = PARAM_1}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_1}, + {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_2}, {.f32 = PARAM_0}, + {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_1}}; + ArkUI_AttributeItem transform_second_item = {transform_second_value, + sizeof(transform_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackSecond, NODE_TRANSFORM, &transform_second_item); + + // SecondEnd stack + ArkUI_NumberValue transform_second_end_value[] = { + {.f32 = PARAM_1}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_1}, + {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_1}, {.f32 = PARAM_0}, + {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_0}, {.f32 = PARAM_2}}; + ArkUI_AttributeItem transform_second_end_item = {transform_second_end_value, + sizeof(transform_second_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackSecondEnd, NODE_TRANSFORM, &transform_second_end_item); + + // Third stack + ArkUI_NumberValue transform_third_value[] = { + {.f32 = PARAM_1}, {.f32 = PARAM_05}, {.f32 = PARAM_05}, {.f32 = PARAM_05}, + {.f32 = PARAM_05}, {.f32 = PARAM_1}, {.f32 = PARAM_05}, {.f32 = PARAM_05}, + {.f32 = PARAM_05}, {.f32 = PARAM_05}, {.f32 = PARAM_1}, {.f32 = PARAM_05}, + {.f32 = PARAM_05}, {.f32 = PARAM_05}, {.f32 = PARAM_05}, {.f32 = PARAM_1}}; + ArkUI_AttributeItem transform_third_item = {transform_third_value, + sizeof(transform_third_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackThird, NODE_TRANSFORM, &transform_third_item); + + // ThirdEnd stack + ArkUI_NumberValue transform_third_end_value[] = { + {.f32 = PARAM_NEGATIVE_1}, {.f32 = PARAM_NEGATIVE_05}, {.f32 = PARAM_NEGATIVE_05}, {.f32 = PARAM_NEGATIVE_05}, + {.f32 = PARAM_NEGATIVE_05}, {.f32 = PARAM_NEGATIVE_2}, {.f32 = PARAM_NEGATIVE_05}, {.f32 = PARAM_NEGATIVE_05}, + {.f32 = PARAM_NEGATIVE_05}, {.f32 = PARAM_NEGATIVE_05}, {.f32 = PARAM_NEGATIVE_3}, {.f32 = PARAM_NEGATIVE_05}, + {.f32 = PARAM_NEGATIVE_05}, {.f32 = PARAM_NEGATIVE_05}, {.f32 = PARAM_NEGATIVE_05}, {.f32 = PARAM_NEGATIVE_1}}; + ArkUI_AttributeItem transform_third_end_item = {transform_third_end_value, + sizeof(transform_third_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackThirdEnd, NODE_TRANSFORM, &transform_third_end_item); + + nodeAPI->addChild(rowFirst, stackFirst); + nodeAPI->addChild(rowFirst, stackFirstEnd); + nodeAPI->addChild(rowSecond, stackSecond); + nodeAPI->addChild(rowSecond, stackSecondEnd); + nodeAPI->addChild(rowThird, stackThird); + nodeAPI->addChild(rowThird, stackThirdEnd); + + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackTransformTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transform_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transform_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bfc43e767fe6dd62fbb00aa864518c642dbf9124 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transform_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_TRANSFORM_TEST_H +#define ARKUI_CAPI_DEMO_STACK_TRANSFORM_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackTransformTest { +public: + ~StackTransformTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_TRANSFORM_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transition_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transition_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2e6fed55049cf907b0947ce8bd4d8dd16d535626 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transition_test.cpp @@ -0,0 +1,450 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_transition_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto nodeAPI = reinterpret_cast( + OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_STACK); + + // 设置stack宽高为100vp + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + // 设置背景图 + const char *image_url = "./resources/base/media/icon.png"; + ArkUI_NumberValue background_image_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_XY}}; + ArkUI_AttributeItem background_image_value_item = { + background_image_value, sizeof(background_image_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &background_image_value_item); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackTransitionTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackTransitionTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackTransitionTest", "OnEventReceive eventId: %{public}d", + eventId); + + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 点击row容器时,移除row容器的最后一个stack,用于测试移除时动画效果 + if (eventId == ON_CLICK_EVENT_ID) { + nodeAPI->removeChild(nodeHandler, nodeAPI->getLastChild(nodeHandler)); + return; + } +} + +napi_value StackTransitionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "StackTransitionTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackTransitionTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建17个stack + auto stackFirstOne = createChildNode(nodeAPI); + auto stackFirstTwo = createChildNode(nodeAPI); + auto stackFirstThree = createChildNode(nodeAPI); + auto stackSecondOne = createChildNode(nodeAPI); + auto stackSecondTwo = createChildNode(nodeAPI); + auto stackSecondThree = createChildNode(nodeAPI); + auto stackThirdOne = createChildNode(nodeAPI); + auto stackThirdTwo = createChildNode(nodeAPI); + auto stackThirdThree = createChildNode(nodeAPI); + auto stackThirdFour = createChildNode(nodeAPI); + auto stackFourthOne = createChildNode(nodeAPI); + auto stackFourthTwo = createChildNode(nodeAPI); + auto stackFourthThree = createChildNode(nodeAPI); + auto stackFifthOne = createChildNode(nodeAPI); + auto stackFifthTwo = createChildNode(nodeAPI); + auto stackFifthThree = createChildNode(nodeAPI); + auto stackFifthFour = createChildNode(nodeAPI); + + // NODE_ROTATE_TRANSITION:设置z轴正向顺时针旋转60度 + float x = 0; + float y = 0; + float z = 10; + float angle = 60; + float perspective = 100; + int32_t duration = 3000; + int32_t curve = ARKUI_CURVE_LINEAR; + int32_t delay = 300; + int32_t iterations = 1; + int32_t playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + float tempo = 1; + + ArkUI_NumberValue rotate_z_transition_value[] = { + {.f32 = x}, {.f32 = y}, {.f32 = z}, {.f32 = angle}, {.f32 = perspective}, {.i32 = duration}, + {.i32 = curve}, {.i32 = delay}, {.i32 = iterations}, {.i32 = playMode}, {.f32 = tempo}}; + ArkUI_AttributeItem rotate_z_transition_item = {rotate_z_transition_value, + sizeof(rotate_z_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFirstOne, NODE_ROTATE_TRANSITION, &rotate_z_transition_item); + + // NODE_ROTATE_TRANSITION:设置y轴反向逆时针旋转60度 + x = 0; + y = -10; + z = 0; + angle = -60; + perspective = -100; + duration = 3000; + curve = ARKUI_CURVE_EASE; + delay = -300; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_REVERSE; + tempo = 1; + ArkUI_NumberValue rotate_y_transition_value[] = { + {.f32 = x}, {.f32 = y}, {.f32 = z}, {.f32 = angle}, {.f32 = perspective}, {.i32 = duration}, + {.i32 = curve}, {.i32 = delay}, {.i32 = iterations}, {.i32 = playMode}, {.f32 = tempo}}; + ArkUI_AttributeItem rotate_y_transition_item = {rotate_y_transition_value, + sizeof(rotate_y_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFirstTwo, NODE_ROTATE_TRANSITION, &rotate_y_transition_item); + + // NODE_ROTATE_TRANSITION:设置x轴正向逆时针旋转60度 + x = 10; + y = 0; + z = 0; + angle = -60; + perspective = 0; + duration = 3000; + curve = ARKUI_CURVE_EASE_IN; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + ArkUI_NumberValue rotate_x_transition_value[] = { + {.f32 = x}, {.f32 = y}, {.f32 = z}, {.f32 = angle}, {.f32 = perspective}, {.i32 = duration}, + {.i32 = curve}, {.i32 = delay}, {.i32 = iterations}, {.i32 = playMode}, {.f32 = tempo}}; + ArkUI_AttributeItem rotate_x_transition_item = {rotate_x_transition_value, + sizeof(rotate_x_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFirstThree, NODE_ROTATE_TRANSITION, &rotate_x_transition_item); + + // NODE_OPACITY_TRANSITION:透明度为全透明 + float opacity = 0; + duration = 3000; + curve = ARKUI_CURVE_EASE_OUT; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + + ArkUI_NumberValue opacity_zero_transition_value[] = {{.f32 = opacity}, {.i32 = duration}, {.i32 = curve}, + {.i32 = delay}, {.i32 = iterations}, {.i32 = playMode}, + {.f32 = tempo}}; + ArkUI_AttributeItem opacity_zero_transition_item = { + opacity_zero_transition_value, sizeof(opacity_zero_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackSecondOne, NODE_OPACITY_TRANSITION, &opacity_zero_transition_item); + + // NODE_OPACITY_TRANSITION:透明度为不透明 + opacity = 1; + duration = 3000; + curve = ARKUI_CURVE_EASE_IN_OUT; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + + ArkUI_NumberValue opacity_half_transition_value[] = {{.f32 = opacity}, {.i32 = duration}, {.i32 = curve}, + {.i32 = delay}, {.i32 = iterations}, {.i32 = playMode}, + {.f32 = tempo}}; + ArkUI_AttributeItem opacity_half_transition_item = { + opacity_half_transition_value, sizeof(opacity_half_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackSecondTwo, NODE_OPACITY_TRANSITION, &opacity_half_transition_item); + + // NODE_OPACITY_TRANSITION:透明度为半透明 + opacity = 0.5; + duration = 3000; + curve = ARKUI_CURVE_FAST_OUT_SLOW_IN; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + + ArkUI_NumberValue opacity_one_transition_value[] = {{.f32 = opacity}, {.i32 = duration}, {.i32 = curve}, + {.i32 = delay}, {.i32 = iterations}, {.i32 = playMode}, + {.f32 = tempo}}; + ArkUI_AttributeItem opacity_one_transition_item = { + opacity_one_transition_value, sizeof(opacity_one_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackSecondThree, NODE_OPACITY_TRANSITION, &opacity_one_transition_item); + + // NODE_SCALE_TRANSITION:缩小一倍 + x = 0.5; + y = 0.5; + z = 0.5; + duration = 3000; + curve = ARKUI_CURVE_LINEAR_OUT_SLOW_IN; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + + ArkUI_NumberValue scale_first_transition_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}, + {.i32 = duration}, {.i32 = curve}, {.i32 = delay}, + {.i32 = iterations}, {.i32 = playMode}, {.f32 = tempo}}; + ArkUI_AttributeItem scale_first_transition_item = { + scale_first_transition_value, sizeof(scale_first_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackThirdOne, NODE_SCALE_TRANSITION, &scale_first_transition_item); + + // NODE_SCALE_TRANSITION:放大一倍 + x = 2; + y = 2; + z = 2; + duration = 3000; + curve = ARKUI_CURVE_FAST_OUT_LINEAR_IN; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + + ArkUI_NumberValue scale_second_transition_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}, + {.i32 = duration}, {.i32 = curve}, {.i32 = delay}, + {.i32 = iterations}, {.i32 = playMode}, {.f32 = tempo}}; + ArkUI_AttributeItem scale_second_transition_item = { + scale_second_transition_value, sizeof(scale_second_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackThirdTwo, NODE_SCALE_TRANSITION, &scale_second_transition_item); + + // NODE_SCALE_TRANSITION:反向放大一倍 + x = -2; + y = -2; + z = -2; + duration = 3000; + curve = ARKUI_CURVE_EXTREME_DECELERATION; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + + ArkUI_NumberValue scale_third_transition_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}, + {.i32 = duration}, {.i32 = curve}, {.i32 = delay}, + {.i32 = iterations}, {.i32 = playMode}, {.f32 = tempo}}; + ArkUI_AttributeItem scale_third_transition_item = { + scale_third_transition_value, sizeof(scale_third_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackThirdThree, NODE_SCALE_TRANSITION, &scale_third_transition_item); + ArkUI_NumberValue border_radius_value[] = {{.f32 = 5}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem border_radius_item = {border_radius_value, + sizeof(border_radius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackThirdThree, NODE_BORDER_RADIUS, &border_radius_item); + + // NODE_SCALE_TRANSITION:反向缩小一倍 + x = -0.5; + y = -0.5; + z = -0.5; + duration = 3000; + curve = ARKUI_CURVE_SHARP; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + + ArkUI_NumberValue scale_fourth_transition_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}, + {.i32 = duration}, {.i32 = curve}, {.i32 = delay}, + {.i32 = iterations}, {.i32 = playMode}, {.f32 = tempo}}; + ArkUI_AttributeItem scale_fourth_transition_item = { + scale_fourth_transition_value, sizeof(scale_fourth_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackThirdFour, NODE_SCALE_TRANSITION, &scale_fourth_transition_item); + nodeAPI->setAttribute(stackThirdFour, NODE_BORDER_RADIUS, &border_radius_item); + + // NODE_TRANSLATE_TRANSITION:x、y、z轴平移-50vp + x = -50; + y = -50; + z = -50; + duration = 3000; + curve = ARKUI_CURVE_RHYTHM; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + + ArkUI_NumberValue translate_first_transition_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}, + {.i32 = duration}, {.i32 = curve}, {.i32 = delay}, + {.i32 = iterations}, {.i32 = playMode}, {.f32 = tempo}}; + ArkUI_AttributeItem translate_first_transition_item = { + translate_first_transition_value, sizeof(translate_first_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFourthOne, NODE_TRANSLATE_TRANSITION, &translate_first_transition_item); + + // NODE_TRANSLATE_TRANSITION:x、y、z轴平移50vp + x = 50; + y = 50; + z = 50; + duration = 3000; + curve = ARKUI_CURVE_SMOOTH; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + + ArkUI_NumberValue translate_second_transition_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}, + {.i32 = duration}, {.i32 = curve}, {.i32 = delay}, + {.i32 = iterations}, {.i32 = playMode}, {.f32 = tempo}}; + ArkUI_AttributeItem translate_second_transition_item = { + translate_second_transition_value, sizeof(translate_second_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFourthTwo, NODE_TRANSLATE_TRANSITION, &translate_second_transition_item); + + // NODE_TRANSLATE_TRANSITION:x、y、z轴平移50vp + x = 50; + y = 50; + z = 50; + duration = 3000; + curve = ARKUI_CURVE_FRICTION; + delay = 0; + iterations = 1; + playMode = ARKUI_ANIMATION_PLAY_MODE_NORMAL; + tempo = 1; + + ArkUI_NumberValue translate_third_transition_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}, + {.i32 = duration}, {.i32 = curve}, {.i32 = delay}, + {.i32 = iterations}, {.i32 = playMode}, {.f32 = tempo}}; + ArkUI_AttributeItem translate_third_transition_item = { + translate_third_transition_value, sizeof(translate_third_transition_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFourthThree, NODE_TRANSLATE_TRANSITION, &translate_third_transition_item); + + // 第五行的stack设置move动画 + ArkUI_NumberValue move_top_value[] = {{.i32 = ARKUI_TRANSITION_EDGE_TOP}, {.i32 = SIZE_600}, {.i32 = ARKUI_CURVE_LINEAR}}; + ArkUI_AttributeItem move_top_item = {move_top_value, sizeof(move_top_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFifthOne, NODE_MOVE_TRANSITION, &move_top_item); + ArkUI_NumberValue move_button_value[] = {{.i32 = ARKUI_TRANSITION_EDGE_BOTTOM}, {.i32 = SIZE_600}, {.i32 = ARKUI_CURVE_LINEAR}}; + ArkUI_AttributeItem move_button_item = {move_button_value, sizeof(move_button_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFifthTwo, NODE_MOVE_TRANSITION, &move_button_item); + ArkUI_NumberValue move_start_value[] = {{.i32 = ARKUI_TRANSITION_EDGE_START}, {.i32 = SIZE_600}, {.i32 = ARKUI_CURVE_LINEAR}}; + ArkUI_AttributeItem move_start_item = {move_start_value, sizeof(move_start_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFifthThree, NODE_MOVE_TRANSITION, &move_start_item); + ArkUI_NumberValue move_end_value[] = {{.i32 = ARKUI_TRANSITION_EDGE_END}, {.i32 = SIZE_600}, {.i32 = ARKUI_CURVE_LINEAR}}; + ArkUI_AttributeItem move_end_item = {move_end_value, sizeof(move_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stackFifthFour, NODE_MOVE_TRANSITION, &move_end_item); + + // 设置column的宽为460vp,高为150vp,边框宽度为1,水平方向上子组件保持间隔 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue col_height_value[] = {{.f32 = 150}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 460}}; + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_first, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_third, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_fourth, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_fourth, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_fourth, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_fourth, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + auto row_fifth = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_fifth, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_fifth, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_fifth, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_fifth, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + + // row容器命名,并注册点击事件 + ArkUI_AttributeItem id_item = {}; + id_item.string = "FirstRow"; + nodeAPI->setAttribute(row_first, NODE_ID, &id_item); + id_item.string = "SecondRow"; + nodeAPI->setAttribute(row_second, NODE_ID, &id_item); + id_item.string = "ThirdRow"; + nodeAPI->setAttribute(row_third, NODE_ID, &id_item); + id_item.string = "FourthRow"; + nodeAPI->setAttribute(row_fourth, NODE_ID, &id_item); + id_item.string = "FifthRow"; + nodeAPI->setAttribute(row_fifth, NODE_ID, &id_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(row_first, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(row_second, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(row_third, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(row_fourth, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(row_fifth, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // 子组件添加到父容器 + nodeAPI->addChild(row_first, stackFirstOne); + nodeAPI->addChild(row_first, stackFirstTwo); + nodeAPI->addChild(row_first, stackFirstThree); + nodeAPI->addChild(row_second, stackSecondOne); + nodeAPI->addChild(row_second, stackSecondTwo); + nodeAPI->addChild(row_second, stackSecondThree); + nodeAPI->addChild(row_third, stackThirdOne); + nodeAPI->addChild(row_third, stackThirdTwo); + nodeAPI->addChild(row_third, stackThirdThree); + nodeAPI->addChild(row_third, stackThirdFour); + nodeAPI->addChild(row_fourth, stackFourthOne); + nodeAPI->addChild(row_fourth, stackFourthTwo); + nodeAPI->addChild(row_fourth, stackFourthThree); + nodeAPI->addChild(row_fifth, stackFifthOne); + nodeAPI->addChild(row_fifth, stackFifthTwo); + nodeAPI->addChild(row_fifth, stackFifthThree); + nodeAPI->addChild(row_fifth, stackFifthFour); + nodeAPI->addChild(column, row_first); + nodeAPI->addChild(column, row_second); + nodeAPI->addChild(column, row_third); + nodeAPI->addChild(column, row_fourth); + nodeAPI->addChild(column, row_fifth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackTransitionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transition_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transition_test.h new file mode 100644 index 0000000000000000000000000000000000000000..39eb54f6922465b110807f957765c853c9548ae7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_transition_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_TRANSITION_TEST_H +#define ARKUI_CAPI_DEMO_STACK_TRANSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackTransitionTest { +public: + ~StackTransitionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_TRANSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_translate_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_translate_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7271631e466f1402bf5619d698643f6d7727b13f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_translate_test.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_translate_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle StackTranslateTest::CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y, float z) +{ + float width = 50; + float height = 50; + uint32_t background_color = 0xFFFF0000; + auto stack = node_api->createNode(ARKUI_NODE_STACK); + + // 设置组件大小 + ArkUI_NumberValue width_value[] = {{.f32 = width}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_HEIGHT, &height_item); + + // 设置组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置组件平移距离 + ArkUI_NumberValue translate_value[] = {{.f32 = x}, {.f32 = y}, {.f32 = z}}; + ArkUI_AttributeItem translate_item = {translate_value, sizeof(translate_value) / sizeof(ArkUI_NumberValue)}; + node_api->setAttribute(stack, NODE_TRANSLATE, &translate_item); + + return stack; +} + +napi_value StackTranslateTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackTranslateTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackTranslateTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float x = 50; + float y = 50; + float z = 50; + auto stack = CreateSubStackNode(nodeAPI, x, y, z); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + x = -50; + y = -50; + z = -50; + stack = CreateSubStackNode(nodeAPI, x, y, z); + // 添加组件到容器 + nodeAPI->addChild(column, stack); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackTranslateTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_translate_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_translate_test.h new file mode 100644 index 0000000000000000000000000000000000000000..31e7c451f0dbe7f5ce013bd6e43fc533d194f102 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_translate_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_TRANSLATE_TEST_H +#define ARKUI_CAPI_DEMO_STACK_TRANSLATE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackTranslateTest { +public: + ~StackTranslateTest(); + static ArkUI_NodeHandle CreateSubStackNode(ArkUI_NativeNodeAPI_1 *node_api, float x, float y, float z); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_TRANSLATE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5286b907ec57eb63bd028882bb026f50a1bd826f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_width_test.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "stack_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value StackWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置stack组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置stack组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置stack组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first stack,设置宽度为300 + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(stack, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(stack, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(stack, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_WIDTH, &width_item); + + // second stack,设置宽度为异常值 + auto stack_second = nodeAPI->createNode(ARKUI_NODE_STACK); + nodeAPI->setAttribute(stack_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(stack_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(stack_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(stack_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, stack); + nodeAPI->insertChildAfter(column, stack_second, stack); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value StackWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackWidthTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为超大值500 + auto stack = nodeAPI->createNode(ARKUI_NODE_STACK); + ArkUI_NumberValue width_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_WIDTH, &width_item); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置image组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(stack, NODE_HEIGHT, &default_height_item); + + nodeAPI->addChild(column, stack); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "StackWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f804d4a3db70adb211edc42bb4fef326a29717ee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/stack/stack_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_STACK_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_STACK_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class StackWidthTest { +public: + ~StackWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_STACK_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_autoplay_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_autoplay_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e8843cd908ef4c8453abbbd2113645d273a20fe7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_autoplay_test.cpp @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_autoplay_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperAutoPlayTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAutoPlayTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAutoPlayTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // 设置所有swiper的displayCount属性为1 + ArkUI_NumberValue displayCount_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem displayCount_item = {displayCount_value, + sizeof(displayCount_value) / sizeof(ArkUI_NumberValue)}; + + // 设置所有swiper的loop属性为0 + ArkUI_NumberValue loop_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem loop_item = {loop_value, sizeof(loop_value) / sizeof(ArkUI_NumberValue)}; + + // first swiper,autoplay为1 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue autoplay_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem autoplay_item = {autoplay_value, sizeof(autoplay_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_LOOP, &loop_item); + + // second swiper,autoplay为0 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_autoplay_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem swiper_autoplay_item = {swiper_autoplay_value, + sizeof(swiper_autoplay_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_AUTO_PLAY, &swiper_autoplay_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_LOOP, &loop_item); + + // third swiper,autoplay为-1 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_third_autoplay_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem swiper_third_autoplay_item = {swiper_third_autoplay_value, + sizeof(swiper_third_autoplay_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_AUTO_PLAY, &swiper_third_autoplay_item); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_LOOP, &loop_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAutoPlayTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperAutoPlayTest::CreateNativeAutoPlayToEndNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAutoPlayTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAutoPlayTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // 设置所有swiper的displayCount属性为1 + ArkUI_NumberValue displayCount_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem displayCount_item = {displayCount_value, + sizeof(displayCount_value) / sizeof(ArkUI_NumberValue)}; + + // 设置所有swiper的loop属性为0 + ArkUI_NumberValue loop_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem loop_item = {loop_value, sizeof(loop_value) / sizeof(ArkUI_NumberValue)}; + + // first swiper + auto swiper = SwiperCommon::CreateSwiper(init_flags); + + // 设置node id + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnFlingSwiper"; + nodeAPI->setAttribute(swiper, NODE_ID, &id_item); + + // 设置autoplay为1 + ArkUI_NumberValue autoplay_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem autoplay_item = {autoplay_value, sizeof(autoplay_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_LOOP, &loop_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperAutoPlayTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_autoplay_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_autoplay_test.h new file mode 100644 index 0000000000000000000000000000000000000000..baecca06601f5fcde695af428ebd7cd84da1560f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_autoplay_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_AUTOPLAY_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_AUTOPLAY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperAutoPlayTest { +public: + ~SwiperAutoPlayTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeAutoPlayToEndNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_AUTOPLAY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..754f067a30181bd4376d1803beb33341b37bbcfb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundcolor_test.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_backgroundcolor_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, false, false}; + + // first swiper,设置背景颜色为0xFFFF0000 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_value_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_value_item); + + // second swiper,设置背景颜色为0xFFFFFFFF + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue background_color_second_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_second_value_item = { + background_color_second_value, sizeof(background_color_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_BACKGROUND_COLOR, &background_color_second_value_item); + + // third swiper,设置背景颜色为0x00000000 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue background_color_third_value[] = {{.u32 = 0x00000000}}; + ArkUI_AttributeItem background_color_third_value_item = { + background_color_third_value, sizeof(background_color_third_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_BACKGROUND_COLOR, &background_color_third_value_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7c55ee121c14ba687694ace69ad1c93ad040faae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperBackgroundColorTest { +public: + ~SwiperBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundimage_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundimage_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f92ce3036efd777ba6d5ad8d00de21f547e29f60 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundimage_test.cpp @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_backgroundimage_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperBackgroundImageTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperBackgroundImageTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperBackgroundImageTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, false, false}; + // 背景图片路径 + const char *image_url = "./resources/base/media/icon.png"; + // 背景图片(底色透明)路径 + const char *image_transparent_url = "./resources/base/media/icon_transparent.png"; + // 边框宽度设置为1 + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + + // first swiper,设置背景图片为image_url,图片不重复铺设 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_NONE}}; + ArkUI_AttributeItem background_image_value_item = { + background_image_value, sizeof(background_image_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_IMAGE, &background_image_value_item); + + // second swiper,设置背景图片为image_url,图片在X轴方向重复铺设 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_second, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_second_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_X}}; + ArkUI_AttributeItem background_image_second_value_item = { + background_image_second_value, sizeof(background_image_second_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(swiper_second, NODE_BACKGROUND_IMAGE, &background_image_second_value_item); + + // third swiper,设置背景图片为image_url,图片在Y轴方向重复铺设 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_third, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_third_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_Y}}; + ArkUI_AttributeItem background_image_third_value_item = { + background_image_third_value, sizeof(background_image_third_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(swiper_third, NODE_BACKGROUND_IMAGE, &background_image_third_value_item); + + // fourth swiper,设置背景图片为image_url,图片在X轴和Y轴方向重复铺设 + auto swiper_fourth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_fourth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_fourth_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_XY}}; + ArkUI_AttributeItem background_image_fourth_value_item = { + background_image_fourth_value, sizeof(background_image_fourth_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(swiper_fourth, NODE_BACKGROUND_IMAGE, &background_image_fourth_value_item); + + // fifth swiper,设置背景图片为异常值,图片在X轴方向重复铺设 + auto swiper_fifth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_fifth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_fifth_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_X}}; + ArkUI_AttributeItem background_image_fifth_value_item = { + background_image_fifth_value, sizeof(background_image_fifth_value) / sizeof(ArkUI_NumberValue), "abcdefg"}; + nodeAPI->setAttribute(swiper_fifth, NODE_BACKGROUND_IMAGE, &background_image_fifth_value_item); + + // sixth swiper,设置背景图片为image_url,图片重复铺设为异常值 + auto swiper_sixth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_sixth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_sixth_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem background_image_sixth_value_item = { + background_image_sixth_value, sizeof(background_image_sixth_value) / sizeof(ArkUI_NumberValue), image_url}; + nodeAPI->setAttribute(swiper_sixth, NODE_BACKGROUND_IMAGE, &background_image_sixth_value_item); + + // seventh swiper,设置背景图片为异常值,图片重复铺设为异常值 + auto swiper_seventh = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_seventh, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_image_seventh_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem background_image_seventh_value_item = { + background_image_seventh_value, sizeof(background_image_seventh_value) / sizeof(ArkUI_NumberValue), "abcdefg"}; + nodeAPI->setAttribute(swiper_seventh, NODE_BACKGROUND_IMAGE, &background_image_seventh_value_item); + + // eighth swiper,设置背景图片为image_transparent_url,不主动设置图片重复铺设类型,并且设置背景颜色为0xFF00FF00 + auto swiper_eighth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_eighth, NODE_BORDER_WIDTH, &border_item); + ArkUI_NumberValue background_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem background_item = {background_value, sizeof(background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_eighth, NODE_BACKGROUND_COLOR, &background_item); + ArkUI_AttributeItem background_image_eighth_value_item = {}; + background_image_eighth_value_item.string = image_transparent_url; + nodeAPI->setAttribute(swiper_eighth, NODE_BACKGROUND_IMAGE, &background_image_eighth_value_item); + + // parent node + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + + nodeAPI->addChild(row_first, swiper); + nodeAPI->insertChildAfter(row_first, swiper_second, swiper); + + nodeAPI->addChild(row_second, swiper_third); + nodeAPI->insertChildAfter(row_second, swiper_fourth, swiper_third); + + nodeAPI->addChild(row_third, swiper_fifth); + nodeAPI->insertChildAfter(row_third, swiper_sixth, swiper_fifth); + + nodeAPI->addChild(row_fourth, swiper_seventh); + nodeAPI->insertChildAfter(row_fourth, swiper_eighth, swiper_seventh); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + nodeAPI->insertChildAfter(column, row_fourth, row_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperBackgroundImageTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundimage_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundimage_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bdebcb010d566af03ff61a7ad2be89a1faeea300 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_backgroundimage_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_BACKGROUNDIMAGE_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_BACKGROUNDIMAGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperBackgroundImageTest { +public: + ~SwiperBackgroundImageTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_BACKGROUNDIMAGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_cachedcount_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_cachedcount_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..af7e8402896c17418633d966a0af8d9e0ddc8442 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_cachedcount_test.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_cachedcount_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperCachedCountTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperCachedCountTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperCachedCountTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // first swiper displayCount为2 cachedCount为1 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue displayCount_value[] = {{.i32 = 2}}; + ArkUI_AttributeItem displayCount_item = {displayCount_value, + sizeof(displayCount_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + // adapter + auto adapter = OH_ArkUI_NodeAdapter_Create(); + ArkUI_AttributeItem adapter_item = {}; + adapter_item.object = adapter; + nodeAPI->setAttribute(swiper, NODE_SWIPER_NODE_ADAPTER, &adapter_item); + // cachedCount + ArkUI_NumberValue cachedCount_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem cachedCount_item = {cachedCount_value, sizeof(cachedCount_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_CACHED_COUNT, &cachedCount_item); + // auto play + ArkUI_NumberValue autoplay_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem autoplay_item = {autoplay_value, sizeof(autoplay_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + + // second swiper displayCount为2 cachedCount为2 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue displayCount_second_value[] = {{.i32 = 2}}; + ArkUI_AttributeItem displayCount_second_item = {displayCount_second_value, + sizeof(displayCount_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DISPLAY_COUNT, &displayCount_second_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_NODE_ADAPTER, &adapter_item); + // adapter + auto adapter_second = OH_ArkUI_NodeAdapter_Create(); + ArkUI_AttributeItem adapter_second_item = {}; + adapter_second_item.object = adapter_second; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_NODE_ADAPTER, &adapter_second_item); + // cachedCount + ArkUI_NumberValue cachedCount_second_value[] = {{.i32 = 2}}; + ArkUI_AttributeItem cachedCount_second_item = {cachedCount_second_value, + sizeof(cachedCount_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_CACHED_COUNT, &cachedCount_second_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperCachedCountTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_cachedcount_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_cachedcount_test.h new file mode 100644 index 0000000000000000000000000000000000000000..55b9eda40e33f386efcc1796ef1283358b604fac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_cachedcount_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_CACHEDCOUNT_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_CACHEDCOUNT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperCachedCountTest { +public: + ~SwiperCachedCountTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_CACHEDCOUNT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..245c6e414600acb4944469b0c3db1ebb7ccd9ff8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_clip_test.cpp @@ -0,0 +1,300 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_clip_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperClipTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperClipTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {false, false, true, true}; + // 宽度设置为50 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + // 高度设置为50 + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + + // swiper in the left of first row + auto swiper_first = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_first, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_first, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_rect_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 20}, {.f32 = 20}, {.f32 = 3}, {.f32 = 3}}; + ArkUI_AttributeItem clip_rect_item = {clip_rect_value, sizeof(clip_rect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_first, NODE_CLIP_SHAPE, &clip_rect_item); + + // swiper in the middle of first row + auto swiper_first_middle = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_first_middle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_first_middle, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_rect_abnormal_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = -20}, {.f32 = -20}, {.f32 = -3}, {.f32 = -3}}; + ArkUI_AttributeItem clip_rect_abnormal_item = {clip_rect_abnormal_value, + sizeof(clip_rect_abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_first_middle, NODE_CLIP_SHAPE, &clip_rect_abnormal_item); + + // swiper in the end of first row + auto swiper_first_end = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_first_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_first_end, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_rect_large_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 30000}, {.f32 = 30000}, {.f32 = 10000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_rect_large_item = {clip_rect_large_value, + sizeof(clip_rect_large_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_first_end, NODE_CLIP_SHAPE, &clip_rect_large_item); + + // swiper in the left of second row + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_second, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_second, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_circle_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem clip_circle_item = {clip_circle_value, sizeof(clip_circle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_CLIP_SHAPE, &clip_circle_item); + + // swiper in the middle of second row + auto swiper_second_middle = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_second_middle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_second_middle, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_circle_middle_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = -20}, {.f32 = -20}}; + ArkUI_AttributeItem clip_circle_middle_item = {clip_circle_middle_value, + sizeof(clip_circle_middle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second_middle, NODE_CLIP_SHAPE, &clip_circle_middle_item); + + // swiper in the end of second row + auto swiper_second_end = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_second_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_second_end, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_circle_end_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 10000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_circle_end_item = {clip_circle_end_value, + sizeof(clip_circle_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second_end, NODE_CLIP_SHAPE, &clip_circle_end_item); + + // swiper in the left of third row + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_third, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_third, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_ellipse_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 35}, {.f32 = 20}}; + ArkUI_AttributeItem clip_ellipse_item = {clip_ellipse_value, + sizeof(clip_ellipse_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_CLIP_SHAPE, &clip_ellipse_item); + + // swiper in the middle of third row + auto swiper_third_middle = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_third_middle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_third_middle, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_ellipse_middle_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = -35}, {.f32 = -20}}; + ArkUI_AttributeItem clip_ellipse_middle_item = {clip_ellipse_middle_value, + sizeof(clip_ellipse_middle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third_middle, NODE_CLIP_SHAPE, &clip_ellipse_middle_item); + + // swiper in the end of third row + auto swiper_third_end = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_third_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_third_end, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_ellipse_end_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 20000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_ellipse_end_item = {clip_ellipse_end_value, + sizeof(clip_ellipse_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third_end, NODE_CLIP_SHAPE, &clip_ellipse_end_item); + + // swiper in the left of fourth row + auto swiper_fourth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_fourth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_fourth, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_path_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 35}, {.f32 = 20}}; + std::string path = "M0 0 H20 V20 H0 Z"; + ArkUI_AttributeItem clip_path_item = {clip_path_value, sizeof(clip_path_value) / sizeof(ArkUI_NumberValue), + path.c_str()}; + nodeAPI->setAttribute(swiper_fourth, NODE_CLIP_SHAPE, &clip_path_item); + + // swiper in the middle of fourth row + auto swiper_fourth_middle = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_fourth_middle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_fourth_middle, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_path_abnormal_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = -35}, {.f32 = -20}}; + std::string null_path = ""; + ArkUI_AttributeItem clip_path_abnormal_item = { + clip_path_abnormal_value, sizeof(clip_path_abnormal_value) / sizeof(ArkUI_NumberValue), null_path.c_str()}; + nodeAPI->setAttribute(swiper_fourth_middle, NODE_CLIP_SHAPE, &clip_path_abnormal_item); + + // swiper in the end of fourth row + auto swiper_fourth_end = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_fourth_end, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_fourth_end, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_path_large_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 10000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_path_large_item = { + clip_path_large_value, sizeof(clip_path_large_value) / sizeof(ArkUI_NumberValue), path.c_str()}; + nodeAPI->setAttribute(swiper_fourth_end, NODE_CLIP_SHAPE, &clip_path_large_item); + + SwiperCommon::SwiperPropertiesInit fifth_init_flags = {false, false, true, false}; + // swiper in the left of fifth row + auto swiper_fifth = SwiperCommon::CreateSwiper(fifth_init_flags); + nodeAPI->setAttribute(swiper_fifth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_fifth, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem clip_item = {clip_value, sizeof(clip_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fifth, NODE_CLIP, &clip_item); + + // swiper in the middle of fifth row + auto swiper_fifth_middle = SwiperCommon::CreateSwiper(fifth_init_flags); + nodeAPI->setAttribute(swiper_fifth_middle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_fifth_middle, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_false_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem clip_false_item = {clip_false_value, sizeof(clip_false_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fifth_middle, NODE_CLIP, &clip_false_item); + + // swiper in the end of fifth row + auto swiper_fifth_third = SwiperCommon::CreateSwiper(fifth_init_flags); + nodeAPI->setAttribute(swiper_fifth_third, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_fifth_third, NODE_HEIGHT, &height_item); + ArkUI_NumberValue clip_abnormal_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem clip_abnormal_item = {clip_abnormal_value, + sizeof(clip_abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fifth_third, NODE_CLIP, &clip_abnormal_item); + + // 第五行的每个swiper中添加一个Text子组件,宽为100vp,高为50vp,背景色为浅蓝色 + auto text_fifth = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text_fifth_middle = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text_fifth_third = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text_fifth_end = nodeAPI->createNode(ARKUI_NODE_TEXT); + ArkUI_NumberValue fif_col_height_value[] = {{.f32 = 100}}; + ArkUI_NumberValue fif_col_width_value[] = {{.f32 = 50}}; + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem fif_col_height_item = {fif_col_height_value, + sizeof(fif_col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem fif_col_width_item = {fif_col_width_value, + sizeof(fif_col_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFAFEEEE}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text_fifth, NODE_HEIGHT, &fif_col_height_item); + nodeAPI->setAttribute(text_fifth, NODE_WIDTH, &fif_col_width_item); + nodeAPI->setAttribute(text_fifth, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(text_fifth_middle, NODE_HEIGHT, &fif_col_height_item); + nodeAPI->setAttribute(text_fifth_middle, NODE_WIDTH, &fif_col_width_item); + nodeAPI->setAttribute(text_fifth_middle, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(text_fifth_third, NODE_HEIGHT, &fif_col_height_item); + nodeAPI->setAttribute(text_fifth_third, NODE_WIDTH, &fif_col_width_item); + nodeAPI->setAttribute(text_fifth_third, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(text_fifth_end, NODE_HEIGHT, &fif_col_height_item); + nodeAPI->setAttribute(text_fifth_end, NODE_WIDTH, &fif_col_width_item); + nodeAPI->setAttribute(text_fifth_end, NODE_BACKGROUND_COLOR, &background_color_item); + + // 创建一个parent node:column中包含5个row + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fifth = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue row_width_value[] = {{.f32 = 350}}; + ArkUI_NumberValue row_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + // 设置每行边框 + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_third, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_fourth, NODE_BORDER_WIDTH, &border_item); + nodeAPI->setAttribute(row_fifth, NODE_BORDER_WIDTH, &border_item); + // 设置每行宽高 + nodeAPI->setAttribute(row_first, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_fourth, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_fourth, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_fifth, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_fifth, NODE_HEIGHT, &row_height_item); + + // 将列容器放入swiper中 + nodeAPI->addChild(swiper_fifth, text_fifth); + nodeAPI->addChild(swiper_fifth_middle, text_fifth_middle); + nodeAPI->addChild(swiper_fifth_third, text_fifth_third); + + // 设置row_fifth子组件在水平方向上的对齐格式 + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row_fifth, NODE_ROW_JUSTIFY_CONTENT, &justify_content_item); + + // 子组件加入到父容器 + nodeAPI->addChild(row_first, swiper_first); + nodeAPI->insertChildAfter(row_first, swiper_first_middle, swiper_first); + nodeAPI->insertChildAfter(row_first, swiper_first_end, swiper_first_middle); + + nodeAPI->addChild(row_second, swiper_second); + nodeAPI->insertChildAfter(row_second, swiper_second_middle, swiper_second); + nodeAPI->insertChildAfter(row_second, swiper_second_end, swiper_second_middle); + + nodeAPI->addChild(row_third, swiper_third); + nodeAPI->insertChildAfter(row_third, swiper_third_middle, swiper_third); + nodeAPI->insertChildAfter(row_third, swiper_third_end, swiper_third_middle); + + nodeAPI->addChild(row_fourth, swiper_fourth); + nodeAPI->insertChildAfter(row_fourth, swiper_fourth_middle, swiper_fourth); + nodeAPI->insertChildAfter(row_fourth, swiper_fourth_end, swiper_fourth_middle); + + nodeAPI->addChild(row_fifth, swiper_fifth); + nodeAPI->insertChildAfter(row_fifth, swiper_fifth_middle, swiper_fifth); + nodeAPI->insertChildAfter(row_fifth, swiper_fifth_third, swiper_fifth_middle); + + // 将五个行容器全部添加到父控件column + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + nodeAPI->insertChildAfter(column, row_fourth, row_third); + nodeAPI->insertChildAfter(column, row_fifth, row_fourth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..864874cd0620a343303bfa8bc22b48dbf9d662f4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_clip_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_CLIP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperClipTest { +public: + ~SwiperClipTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_common.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_common.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dc4eea2a603c9069de141b560b76bdd006c0bb31 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_common.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle SwiperCommon::CreateSwiper(SwiperPropertiesInit flags) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperCommon", "CreateSwiper"); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto swiper = nodeAPI->createNode(ARKUI_NODE_SWIPER); + + // width + if (flags.initWidthFlag) { + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + } + + // height + if (flags.initHeightFlag) { + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + } + + // margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_MARGIN, &margin_item); + + // background + if (flags.initBackgroundColorFlag) { + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_color_value_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_BACKGROUND_COLOR, &background_color_value_item); + } + + // child node + if (flags.initChildNodeFlag) { + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + // 浅蓝 + ArkUI_NumberValue text_background_value[] = {{.u32 = 0xFFAFEEEE}}; + ArkUI_AttributeItem text_background_item = {text_background_value, + sizeof(text_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &text_background_item); + + auto text_second = nodeAPI->createNode(ARKUI_NODE_TEXT); + // 绿 + ArkUI_NumberValue text_second_background_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem text_second_background_item = { + text_second_background_value, sizeof(text_second_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text_second, NODE_BACKGROUND_COLOR, &text_second_background_item); + + auto text_third = nodeAPI->createNode(ARKUI_NODE_TEXT); + // 红 + ArkUI_NumberValue text_third_background_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem text_third_background_item = { + text_third_background_value, sizeof(text_third_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text_third, NODE_BACKGROUND_COLOR, &text_third_background_item); + + auto text_fourth = nodeAPI->createNode(ARKUI_NODE_TEXT); + // 蓝 + ArkUI_NumberValue text_fourth_background_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem text_fourth_background_item = { + text_fourth_background_value, sizeof(text_fourth_background_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text_fourth, NODE_BACKGROUND_COLOR, &text_fourth_background_item); + + nodeAPI->addChild(swiper, text); + nodeAPI->addChild(swiper, text_second); + nodeAPI->addChild(swiper, text_third); + nodeAPI->addChild(swiper, text_fourth); + } + + return swiper; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_common.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_common.h new file mode 100644 index 0000000000000000000000000000000000000000..2f987be0ad269ce2ee4176b6d8f6f9fc42a1400a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_common.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_COMMON_H +#define ARKUI_CAPI_DEMO_SWIPER_COMMON_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperCommon { +public: + ~SwiperCommon(); + struct SwiperPropertiesInit { + bool initWidthFlag; + bool initHeightFlag; + bool initBackgroundColorFlag; + bool initChildNodeFlag; + }; + + static ArkUI_NodeHandle CreateSwiper(SwiperPropertiesInit flags); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_COMMON_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_curve_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_curve_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7e83edf9d1ea3d3ecb30d132da7e5e3fabc7a4da --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_curve_test.cpp @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "swiper_common.h" +#include "swiper_curve_test.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperCurveTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperCurveTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperCurveTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {false, true, true, true}; + // 宽度设置为100 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + // 设置swiper为自动播 + ArkUI_NumberValue autoPlay_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem autoPlay_item = {autoPlay_value, sizeof(autoPlay_value) / sizeof(ArkUI_NumberValue)}; + // 设置swiper子组件切换的动画时长5000ms + ArkUI_NumberValue duration_value[] = {{.f32 = 5000}}; + ArkUI_AttributeItem duration_value_item = {duration_value, sizeof(duration_value) / sizeof(ArkUI_NumberValue)}; + + // first swiper,设置动画从头到尾的速度都相同 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value[] = {{.i32 = ARKUI_CURVE_LINEAR}}; + ArkUI_AttributeItem curve_value_item = {curve_value, sizeof(curve_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_CURVE, &curve_value_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_DURATION, &duration_value_item); + + // second swiper,设置动画以低速开始,然后加快,在结束前变慢 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_second, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_second[] = {{.i32 = ARKUI_CURVE_EASE}}; + ArkUI_AttributeItem curve_value_second_item = {curve_value_second, + sizeof(curve_value_second) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_CURVE, &curve_value_second_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DURATION, &duration_value_item); + + // third swiper,设置动画以低速开始 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_third, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_third[] = {{.i32 = ARKUI_CURVE_EASE_IN}}; + ArkUI_AttributeItem curve_value_third_item = {curve_value_third, + sizeof(curve_value_third) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_CURVE, &curve_value_third_item); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_DURATION, &duration_value_item); + + // fourth swiper,设置动画以低速结束 + auto swiper_fourth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_fourth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_fourth[] = {{.i32 = ARKUI_CURVE_EASE_OUT}}; + ArkUI_AttributeItem curve_value_fourth_item = {curve_value_fourth, + sizeof(curve_value_fourth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_CURVE, &curve_value_fourth_item); + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_DURATION, &duration_value_item); + + // fifth swiper,设置动画以低速开始和结束 + auto swiper_fifth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_fifth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_fifth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_fifth[] = {{.i32 = ARKUI_CURVE_EASE_IN_OUT}}; + ArkUI_AttributeItem curve_value_fifth_item = {curve_value_fifth, + sizeof(curve_value_fifth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fifth, NODE_SWIPER_CURVE, &curve_value_third_item); + nodeAPI->setAttribute(swiper_fifth, NODE_SWIPER_DURATION, &duration_value_item); + + // sixth swiper,设置动画标准曲线 + auto swiper_sixth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_sixth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_sixth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_sixth[] = {{.i32 = ARKUI_CURVE_FAST_OUT_SLOW_IN}}; + ArkUI_AttributeItem curve_value_sixth_item = {curve_value_sixth, + sizeof(curve_value_sixth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_sixth, NODE_SWIPER_CURVE, &curve_value_sixth_item); + nodeAPI->setAttribute(swiper_sixth, NODE_SWIPER_DURATION, &duration_value_item); + + // seventh swiper,设置动画减速曲线 + auto swiper_seventh = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_seventh, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_seventh, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_seventh[] = {{.i32 = ARKUI_CURVE_LINEAR_OUT_SLOW_IN}}; + ArkUI_AttributeItem curve_value_seventh_item = {curve_value_seventh, + sizeof(curve_value_seventh) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_seventh, NODE_SWIPER_CURVE, &curve_value_seventh_item); + nodeAPI->setAttribute(swiper_seventh, NODE_SWIPER_DURATION, &duration_value_item); + + // eighth swiper,设置动画加速曲线 + auto swiper_eighth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_eighth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_eighth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_eighth[] = {{.i32 = ARKUI_CURVE_FAST_OUT_LINEAR_IN}}; + ArkUI_AttributeItem curve_value_eighth_item = {curve_value_eighth, + sizeof(curve_value_eighth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_eighth, NODE_SWIPER_CURVE, &curve_value_eighth_item); + nodeAPI->setAttribute(swiper_eighth, NODE_SWIPER_DURATION, &duration_value_item); + + // ninth swiper,设置动画急缓曲线 + auto swiper_ninth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_ninth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_ninth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_ninth[] = {{.i32 = ARKUI_CURVE_EXTREME_DECELERATION}}; + ArkUI_AttributeItem curve_value_ninth_item = {curve_value_ninth, + sizeof(curve_value_ninth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_ninth, NODE_SWIPER_CURVE, &curve_value_ninth_item); + nodeAPI->setAttribute(swiper_ninth, NODE_SWIPER_DURATION, &duration_value_item); + + // tenth swiper,设置动画锐利曲线 + auto swiper_tenth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_tenth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_tenth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_tenth[] = {{.i32 = ARKUI_CURVE_SHARP}}; + ArkUI_AttributeItem curve_value_tenth_item = {curve_value_tenth, + sizeof(curve_value_tenth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_tenth, NODE_SWIPER_CURVE, &curve_value_tenth_item); + nodeAPI->setAttribute(swiper_tenth, NODE_SWIPER_DURATION, &duration_value_item); + + // eleventh swiper,设置动画节奏曲线 + auto swiper_eleventh = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_eleventh, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_eleventh, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_eleventh[] = {{.i32 = ARKUI_CURVE_RHYTHM}}; + ArkUI_AttributeItem curve_value_eleventh_item = {curve_value_eleventh, + sizeof(curve_value_eleventh) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_eleventh, NODE_SWIPER_CURVE, &curve_value_eleventh_item); + nodeAPI->setAttribute(swiper_eleventh, NODE_SWIPER_DURATION, &duration_value_item); + + // twelfth swiper,设置动画平滑曲线 + auto swiper_twelfth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_twelfth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_twelfth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_twelfth[] = {{.i32 = ARKUI_CURVE_SMOOTH}}; + ArkUI_AttributeItem curve_value_twelfth_item = {curve_value_twelfth, + sizeof(curve_value_twelfth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_twelfth, NODE_SWIPER_CURVE, &curve_value_twelfth_item); + nodeAPI->setAttribute(swiper_twelfth, NODE_SWIPER_DURATION, &duration_value_item); + + // thirteenth swiper,设置动画阻尼曲线 + auto swiper_thirteenth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_thirteenth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_thirteenth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_thirteenth[] = {{.i32 = ARKUI_CURVE_FRICTION}}; + ArkUI_AttributeItem curve_value_thirteenth_item = {curve_value_thirteenth, + sizeof(curve_value_thirteenth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_thirteenth, NODE_SWIPER_CURVE, &curve_value_thirteenth_item); + nodeAPI->setAttribute(swiper_thirteenth, NODE_SWIPER_DURATION, &duration_value_item); + + // fourteenth swiper,设置动画曲线为异常值 + auto swiper_fourteenth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_fourteenth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_fourteenth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue curve_value_fourteenth[] = {{.i32 = -1}}; + ArkUI_AttributeItem curve_value_fourteenth_item = {curve_value_fourteenth, + sizeof(curve_value_fourteenth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fourteenth, NODE_SWIPER_CURVE, &curve_value_fourteenth_item); + nodeAPI->setAttribute(swiper_fourteenth, NODE_SWIPER_DURATION, &duration_value_item); + + // fifteenth swiper,不主动设置动画曲线类型 + auto swiper_fifteenth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_fifteenth, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(swiper_fifteenth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + nodeAPI->setAttribute(swiper_fifteenth, NODE_SWIPER_DURATION, &duration_value_item); + + // parent node + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row_fifth = nodeAPI->createNode(ARKUI_NODE_ROW); + + nodeAPI->addChild(row_first, swiper); + nodeAPI->insertChildAfter(row_first, swiper_second, swiper); + nodeAPI->insertChildAfter(row_first, swiper_third, swiper_second); + + nodeAPI->addChild(row_second, swiper_fourth); + nodeAPI->insertChildAfter(row_second, swiper_fifth, swiper_fourth); + nodeAPI->insertChildAfter(row_second, swiper_sixth, swiper_fifth); + + nodeAPI->addChild(row_third, swiper_seventh); + nodeAPI->insertChildAfter(row_third, swiper_eighth, swiper_seventh); + nodeAPI->insertChildAfter(row_third, swiper_ninth, swiper_eighth); + + nodeAPI->addChild(row_fourth, swiper_tenth); + nodeAPI->insertChildAfter(row_fourth, swiper_eleventh, swiper_tenth); + nodeAPI->insertChildAfter(row_fourth, swiper_twelfth, swiper_eleventh); + + nodeAPI->addChild(row_fifth, swiper_thirteenth); + nodeAPI->insertChildAfter(row_fifth, swiper_fourteenth, swiper_thirteenth); + nodeAPI->insertChildAfter(row_fifth, swiper_fifteenth, swiper_fourteenth); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + nodeAPI->insertChildAfter(column, row_fourth, row_third); + nodeAPI->insertChildAfter(column, row_fifth, row_fourth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperCurveTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_curve_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_curve_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ed31ad69e3a8480be2ffd7fe8d3261d2394f2f51 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_curve_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_CURVE_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_CURVE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperCurveTest { + public: + ~SwiperCurveTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_CURVE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_disableswipe_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_disableswipe_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e1ec21f0a278f5033c49a4814fb9f0cda3dc3aa5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_disableswipe_test.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_disableswipe_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperDisableSwipeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDisableSwipeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDisableSwipeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // first swiper,设置不禁用滑动功能 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_AttributeItem id_item = {}; + id_item.string = "DisableSwipe_Swiper1"; + nodeAPI->setAttribute(swiper, NODE_ID, &id_item); + ArkUI_NumberValue disableSwipe_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem disableSwipe_value_item = {disableSwipe_value, + sizeof(disableSwipe_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_DISABLE_SWIPE, &disableSwipe_value_item); + + // second swiper,设置禁用滑动功能 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_AttributeItem id_second_item = {}; + id_second_item.string = "DisableSwipe_Swiper2"; + nodeAPI->setAttribute(swiper_second, NODE_ID, &id_second_item); + ArkUI_NumberValue disableSwipe_value_second[] = {{.i32 = 1}}; + ArkUI_AttributeItem disableSwipe_value_second_item = {disableSwipe_value_second, sizeof(disableSwipe_value_second) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DISABLE_SWIPE, &disableSwipe_value_second_item); + + // third swiper,设置是否禁用滑动功能为异常值 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + ArkUI_AttributeItem id_third_item = {}; + id_third_item.string = "DisableSwipe_Swiper3"; + nodeAPI->setAttribute(swiper_third, NODE_ID, &id_third_item); + ArkUI_NumberValue disableSwipe_value_third[] = {{.i32 = -1}}; + ArkUI_AttributeItem disableSwipe_value_third_item = {disableSwipe_value_third, + sizeof(disableSwipe_value_third) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_DISABLE_SWIPE, &disableSwipe_value_third_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDisableSwipeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_disableswipe_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_disableswipe_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3af6058ca16e92fc648fdc43d3679b3b9ae1dc57 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_disableswipe_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_DISABLESWIPE_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_DISABLESWIPE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperDisableSwipeTest { +public: + ~SwiperDisableSwipeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_DISABLESWIPE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displayarrow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displayarrow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3ac17d94a0529e7cb2a93a7767137c684e53788d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displayarrow_test.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_displayarrow_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperDisplayArrowTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDisplayArrowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDisplayArrowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // first swiper,设置不显示swiper中导航点箭头 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue displayArrow_value[] = {{.i32 = ARKUI_SWIPER_ARROW_HIDE}}; + ArkUI_AttributeItem displayArrow_value_item = {displayArrow_value, + sizeof(displayArrow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_SHOW_DISPLAY_ARROW, &displayArrow_value_item); + + // second swiper,设置显示swiper中导航点箭头 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue displayArrow_value_second[] = {{.i32 = ARKUI_SWIPER_ARROW_SHOW}}; + ArkUI_AttributeItem displayArrow_value_second_item = {displayArrow_value_second, sizeof(displayArrow_value_second) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_SHOW_DISPLAY_ARROW, &displayArrow_value_second_item); + + // third swiper,设置在hover状态下显示swiper中导航点箭头 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnHoverSwiper"; + nodeAPI->setAttribute(swiper_third, NODE_ID, &id_item); + ArkUI_NumberValue displayArrow_value_third[] = {{.i32 = ARKUI_SWIPER_ARROW_SHOW_ON_HOVER}}; + ArkUI_AttributeItem displayArrow_value_third_item = {displayArrow_value_third, + sizeof(displayArrow_value_third) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_SHOW_DISPLAY_ARROW, &displayArrow_value_third_item); + + // fourth swiper,设置Swiper是否显示导航点箭头为异常值 + auto swiper_fourth = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue displayArrow_value_fourth[] = {{.i32 = -1}}; + ArkUI_AttributeItem displayArrow_value_fourth_item = {displayArrow_value_fourth, sizeof(displayArrow_value_fourth) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_SHOW_DISPLAY_ARROW, &displayArrow_value_fourth_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + nodeAPI->insertChildAfter(column, swiper_fourth, swiper_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDisplayArrowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displayarrow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displayarrow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d93b27da4436db151217668e476753857f03e728 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displayarrow_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_DISPLAYARROW_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_DISPLAYARROW_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperDisplayArrowTest { +public: + ~SwiperDisplayArrowTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_DISPLAYARROW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displaycount_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displaycount_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3e28201f2ea075cf88ccb0aae82b93a765833e72 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displaycount_test.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_displaycount_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperDisplayCountTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDisplayCountTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDisplayCountTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // first swiper,displayCount为3 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue displayCount_value[] = {{.i32 = 3}}; + ArkUI_AttributeItem displayCount_item = {displayCount_value, + sizeof(displayCount_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // second swiper,displayCount为-1 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_displayCount_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem swiper_displayCount_item = {swiper_displayCount_value, + sizeof(swiper_displayCount_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DISPLAY_COUNT, &swiper_displayCount_item); + + // third swiper,displayCount为100 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_third_displayCount_value[] = {{.i32 = 100}}; + ArkUI_AttributeItem swiper_third_displayCount_item = { + swiper_third_displayCount_value, sizeof(swiper_third_displayCount_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_DISPLAY_COUNT, &swiper_third_displayCount_item); + + // fourth swiper,displayCount为10000 + auto swiper_fourth = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_fourth_displayCount_value[] = {{.i32 = 10000}}; + ArkUI_AttributeItem swiper_fourth_displayCount_item = { + swiper_fourth_displayCount_value, sizeof(swiper_fourth_displayCount_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_DISPLAY_COUNT, &swiper_fourth_displayCount_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + nodeAPI->insertChildAfter(column, swiper_fourth, swiper_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDisplayCountTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displaycount_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displaycount_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6e5da829046410dffde8616e0c4402e62b447ef4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_displaycount_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_DISPLAYCOUNT_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_DISPLAYCOUNT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperDisplayCountTest { +public: + ~SwiperDisplayCountTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_DISPLAYCOUNT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_duration_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_duration_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b345670129d8c30d7a00b17579002f3381cbb689 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_duration_test.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "swiper_common.h" +#include "swiper_duration_test.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperDurationTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDurationTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDurationTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + // 设置swiper为自动播 + ArkUI_NumberValue autoPlay_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem autoPlay_item = {autoPlay_value, sizeof(autoPlay_value) / sizeof(ArkUI_NumberValue)}; + + // first swiper,设置子组件切换的动画时长1000ms + auto swiper = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue duration_value[] = {{.f32 = 1000}}; + ArkUI_AttributeItem duration_value_item = {duration_value, sizeof(duration_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_DURATION, &duration_value_item); + + // second swiper,设置子组件切换的动画时长10000ms + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue duration_value_second[] = {{.f32 = 10000}}; + ArkUI_AttributeItem duration_value_second_item = {duration_value_second, + sizeof(duration_value_second) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DURATION, &duration_value_second_item); + + // third swiper,不主动设置子组件切换的动画时长属性 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + + // fourth swiper,设置子组件切换的动画时长异常值 + auto swiper_fourth = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_AUTO_PLAY, &autoPlay_item); + ArkUI_NumberValue duration_value_fourth[] = {{.f32 = -600}}; + ArkUI_AttributeItem duration_value_fourth_item = {duration_value_fourth, + sizeof(duration_value_fourth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_DURATION, &duration_value_fourth_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + nodeAPI->insertChildAfter(column, swiper_fourth, swiper_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperDurationTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_duration_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_duration_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d85c02391a69a4e4baa88f51373d1d263fed4e59 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_duration_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_DURATION_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_DURATION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperDurationTest { + public: + ~SwiperDurationTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_DURATION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f9a672e2709ecace9c9b52da46ae8a511acb7d8c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_height_test.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_height_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, false}; + + // first swiper,设置高度为200 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + // second swiper,设置高度为异常值 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, false, true, false}; + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置高度为超大值10000 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue height_value[] = {{.f32 = 10000}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, swiper); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..116d8851e5a8cb26ea24b123044aeab6bf93edeb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperHeightTest { +public: + ~SwiperHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_index_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_index_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4be9bf51608af5beaeac23aa32abd48af84d74ff --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_index_test.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_index_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperIndexTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperIndexTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperIndexTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // 设置所有swiper的displayCount属性为1 + ArkUI_NumberValue displayCount_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem displayCount_item = {displayCount_value, + sizeof(displayCount_value) / sizeof(ArkUI_NumberValue)}; + + // first swiper,index为2 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue index_value[] = {{.i32 = 2}}; + ArkUI_AttributeItem index_item = {index_value, sizeof(index_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_INDEX, &index_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // second swiper,index为-1 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_index_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem swiper_index_item = {swiper_index_value, + sizeof(swiper_index_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_INDEX, &swiper_index_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // third swiper,index为5 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_third_index_value[] = {{.i32 = 5}}; + ArkUI_AttributeItem swiper_third_index_item = {swiper_third_index_value, + sizeof(swiper_third_index_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_INDEX, &swiper_third_index_item); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // fifth swiper,index为3 + auto swiper_fourth = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_fifth_index_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem swiper_fifth_index_item = {swiper_fifth_index_value, + sizeof(swiper_fifth_index_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_INDEX, &swiper_fifth_index_item); + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + nodeAPI->insertChildAfter(column, swiper_fourth, swiper_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperIndexTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_index_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_index_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e69f3e657ef8c2181feb8739a69b1bb33730d198 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_index_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_INDEX_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_INDEX_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperIndexTest { +public: + ~SwiperIndexTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_INDEX_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_indicator_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_indicator_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4b1458012feebace64832a8d58a62e3e8f6dc1e4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_indicator_test.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_indicator_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperIndicatorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperIndicatorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperIndicatorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // 设置所有swiper的displayCount属性为1 + ArkUI_NumberValue displayCount_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem displayCount_item = {displayCount_value, + sizeof(displayCount_value) / sizeof(ArkUI_NumberValue)}; + + // first swiper,indicator为1 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue indicator_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem indicator_item = {indicator_value, sizeof(indicator_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_SHOW_INDICATOR, &indicator_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // second swiper,indicator为0 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_indicator_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem swiper_indicator_item = {swiper_indicator_value, + sizeof(swiper_indicator_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_SHOW_INDICATOR, &swiper_indicator_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // third swiper,indicator为-1 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_third_vertical_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem swiper_third_vertical_item = {swiper_third_vertical_value, + sizeof(swiper_third_vertical_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_VERTICAL, &swiper_third_vertical_item); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperIndicatorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_indicator_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_indicator_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d1e4f1c77430e6d89e5ba2b237dcc27a870720ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_indicator_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_INDICATOR_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_INDICATOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperIndicatorTest { +public: + ~SwiperIndicatorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_INDICATOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_interval_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_interval_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..45f203612b99fb8dedb71355c833a7bfc8e49e12 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_interval_test.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "swiper_common.h" +#include "swiper_interval_test.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperIntervalTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperIntervalTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperIntervalTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // 设置所有swiper的autoplay属性为1 + ArkUI_NumberValue autoplay_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem autoplay_item = {autoplay_value, sizeof(autoplay_value) / sizeof(ArkUI_NumberValue)}; + + // 设置所有swiper的displayCount属性为1 + ArkUI_NumberValue displayCount_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem displayCount_item = {displayCount_value, + sizeof(displayCount_value) / sizeof(ArkUI_NumberValue)}; + + // first swiper,interval为1000 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue interval_value[] = {{.f32 = 1000}}; + ArkUI_AttributeItem interval_item = {interval_value, sizeof(interval_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_INTERVAL, &interval_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // second swiper,interval为10000 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_interval_value[] = {{.f32 = 10000}}; + ArkUI_AttributeItem swiper_interval_item = {swiper_interval_value, + sizeof(swiper_interval_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_INTERVAL, &swiper_interval_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // third swiper,不设置interval + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // fourth swiper,interval为-600 + auto swiper_fourth = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_fourth_interval_value[] = {{.f32 = -600}}; + ArkUI_AttributeItem swiper_fourth_interval_item = { + swiper_fourth_interval_value, sizeof(swiper_fourth_interval_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_INTERVAL, &swiper_fourth_interval_item); + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + nodeAPI->setAttribute(swiper_fourth, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + nodeAPI->insertChildAfter(column, swiper_fourth, swiper_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperIntervalTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_interval_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_interval_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fd708cd1d270645ca98e921b0d945492ba4786d7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_interval_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_INTERVAL_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_INTERVAL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperIntervalTest { + public: + ~SwiperIntervalTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_INTERVAL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_itemspace_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_itemspace_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1b639b09f15d93ee337dfe73a02dd18ad846910d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_itemspace_test.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_itemspace_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperItemSpaceTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperItemSpaceTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperItemSpaceTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + // 设置 + ArkUI_NumberValue displayCount_value[] = {{.i32 = 2}}; + ArkUI_AttributeItem displayCount_item = {displayCount_value, + sizeof(displayCount_value) / sizeof(ArkUI_NumberValue)}; + + // first swiper,设置一页内子组件显示个数为2个,子组件与子组件之间间隙为5 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + ArkUI_NumberValue itemSpace_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem itemSpace_item = {itemSpace_value, sizeof(itemSpace_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_ITEM_SPACE, &itemSpace_item); + + // second swiper,设置一页内子组件显示个数为2个,子组件与子组件之间间隙为10000 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + ArkUI_NumberValue swiper_second_itemSpace_value[] = {{.f32 = 10000}}; + ArkUI_AttributeItem swiper_second_itemSpace_item = { + swiper_second_itemSpace_value, sizeof(swiper_second_itemSpace_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_ITEM_SPACE, &swiper_second_itemSpace_item); + + // third swiper,设置一页内子组件显示个数为2个,子组件与子组件之间间隙为异常值 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + ArkUI_NumberValue swiper_third_itemSpace_value[] = {{.f32 = -20}}; + ArkUI_AttributeItem swiper_third_itemSpace_item = { + swiper_third_itemSpace_value, sizeof(swiper_third_itemSpace_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_ITEM_SPACE, &swiper_third_itemSpace_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperItemSpaceTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_itemspace_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_itemspace_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7b715de7d2bf9a4fc548c994b6b52dd586437cec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_itemspace_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_ITEMSPACE_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_ITEMSPACE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperItemSpaceTest { +public: + ~SwiperItemSpaceTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_ITEMSPACE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_loop_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_loop_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..25a8dd1132b75eb26a1b2847a5c21a829f9fdb9d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_loop_test.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "swiper_common.h" +#include "swiper_loop_test.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperLoopTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperLoopTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperLoopTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // 设置所有swiper的displayCount属性为1 + ArkUI_NumberValue displayCount_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem displayCount_item = {displayCount_value, + sizeof(displayCount_value) / sizeof(ArkUI_NumberValue)}; + + // 设置所有swiper的autoplay属性为1 + ArkUI_NumberValue autoplay_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem autoplay_item = {autoplay_value, sizeof(autoplay_value) / sizeof(ArkUI_NumberValue)}; + + // 设置所有swiper的interval属性为1000 + ArkUI_NumberValue interval_value[] = {{.f32 = 1000}}; + ArkUI_AttributeItem interval_item = {interval_value, sizeof(interval_value) / sizeof(ArkUI_NumberValue)}; + + // first swiper,loop为0 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue loop_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem loop_item = {loop_value, sizeof(loop_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_LOOP, &loop_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + nodeAPI->setAttribute(swiper, NODE_SWIPER_INTERVAL, &interval_item); + + // second swiper,loop为1 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_loop_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem swiper_loop_item = {swiper_loop_value, sizeof(swiper_loop_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_LOOP, &swiper_loop_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_INTERVAL, &interval_item); + + // third swiper,不设置loop + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_INTERVAL, &interval_item); + + // fourth swiper,loop为-1 + auto swiper_fourth = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_fourth_vertical_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem swiper_fourth_vertical_item = { + swiper_fourth_vertical_value, sizeof(swiper_fourth_vertical_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_LOOP, &swiper_fourth_vertical_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_DISPLAY_COUNT, &displayCount_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_AUTO_PLAY, &autoplay_item); + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_INTERVAL, &interval_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + nodeAPI->insertChildAfter(column, swiper_fourth, swiper_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + 401) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperLoopTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_loop_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_loop_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1f75585c33be8eb8a6460d626f8ab6b77809bfd5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_loop_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_LOOP_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_LOOP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperLoopTest { + public: + ~SwiperLoopTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_LOOP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_position_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_position_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..49fac8c34ac579beaa440162b7b86183688c9cbf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_position_test.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_position_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperPositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperPositionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperPositionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, false}; + + // first swiper,设置position为{10,10} + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue position_value[] = {{.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_POSITION, &position_item); + + // second swiper,设置position为{-10,-10} + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue position_second_value[] = {{.f32 = -10}, {.f32 = -10}}; + ArkUI_AttributeItem position_second_item = {position_second_value, + sizeof(position_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_POSITION, &position_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperPositionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_position_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_position_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d7c34d865cc9b21c3e1b098f48d93377e3cf92ec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_position_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_POSITION_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_POSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperPositionTest { +public: + ~SwiperPositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_POSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_vertical_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_vertical_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e7c76894c99ef8295ae805e717959bf9d788488c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_vertical_test.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_vertical_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperVerticalTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperVerticalTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperVerticalTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, true}; + + // first swiper,设置swiper横向滑动 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue vertical_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem vertical_item = {vertical_value, sizeof(vertical_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_SWIPER_VERTICAL, &vertical_item); + + // second swiper,设置swiper纵向滑动 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_vertical_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem swiper_vertical_item = {swiper_vertical_value, + sizeof(swiper_vertical_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_SWIPER_VERTICAL, &swiper_vertical_item); + + // fourth swiper,设置横/纵向滑动属性为异常值 + auto swiper_third = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue swiper_third_vertical_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem swiper_third_vertical_item = {swiper_third_vertical_value, + sizeof(swiper_third_vertical_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_third, NODE_SWIPER_VERTICAL, &swiper_third_vertical_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + nodeAPI->insertChildAfter(column, swiper_third, swiper_second); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperVerticalTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_vertical_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_vertical_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e61492dfc2ec6a547cd35f62ca824500fe1728c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_vertical_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_VERTICAL_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_VERTICAL_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperVerticalTest { +public: + ~SwiperVerticalTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_VERTICAL_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4733445eb6610b8707b60f4b1b27b6535e2242b7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_width_test.cpp @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "swiper_width_test.h" +#include "swiper_common.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value SwiperWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {true, true, true, false}; + + // first swiper,设置宽度为300 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + // second swiper,设置宽度为异常值 + auto swiper_second = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue width_second_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, swiper); + nodeAPI->insertChildAfter(column, swiper_second, swiper); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value SwiperWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperWidthTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + SwiperCommon::SwiperPropertiesInit init_flags = {false, true, true, false}; + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为超大值10000 + auto swiper = SwiperCommon::CreateSwiper(init_flags); + ArkUI_NumberValue width_value[] = {{.f32 = 10000}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(swiper, NODE_WIDTH, &width_item); + + nodeAPI->addChild(column, swiper); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "SwiperWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..74b1a6fb550b9f6257eae5fce422746820abee5a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/swiper/swiper_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_SWIPER_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_SWIPER_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class SwiperWidthTest { +public: + ~SwiperWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_SWIPER_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_align_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_align_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..893c2ff958fec145a800c298f3b4693071a15d40 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_align_test.cpp @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_align_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAlignTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAlignTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAlignTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue size_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem size_value_item = {size_value, sizeof(size_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &size_value_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &size_value_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &size_value_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &size_value_item); + + // 创建row节点组件 + auto topRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto centerRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto bottomRow = nodeAPI->createNode(ARKUI_NODE_ROW); + auto defaultRow = nodeAPI->createNode(ARKUI_NODE_ROW); + + // 设置row组件宽度和高度 + ArkUI_NumberValue rowWidth_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem rowWidth_value_item = {rowWidth_value, sizeof(rowWidth_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue rowHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem rowHeight_value_item = {rowHeight_value, sizeof(rowHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(topRow, NODE_WIDTH, &rowWidth_value_item); + nodeAPI->setAttribute(centerRow, NODE_WIDTH, &rowWidth_value_item); + nodeAPI->setAttribute(bottomRow, NODE_WIDTH, &rowWidth_value_item); + nodeAPI->setAttribute(defaultRow, NODE_WIDTH, &rowWidth_value_item); + nodeAPI->setAttribute(topRow, NODE_HEIGHT, &rowHeight_value_item); + nodeAPI->setAttribute(centerRow, NODE_HEIGHT, &rowHeight_value_item); + nodeAPI->setAttribute(bottomRow, NODE_HEIGHT, &rowHeight_value_item); + nodeAPI->setAttribute(defaultRow, NODE_HEIGHT, &rowHeight_value_item); + + // 创建三个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text7 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text8 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text9 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text10 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text11 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue textSize_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem textSize_value_item = {textSize_value, sizeof(textSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text6, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text7, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text8, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text9, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text10, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text11, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text7, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text8, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text9, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text10, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text11, NODE_WIDTH, &textSize_value_item); + + // text组件放置父容器column中 + nodeAPI->addChild(topRow, text1); + nodeAPI->addChild(topRow, text2); + nodeAPI->addChild(topRow, text3); + nodeAPI->addChild(centerRow, text4); + nodeAPI->addChild(centerRow, text5); + nodeAPI->addChild(centerRow, text6); + nodeAPI->addChild(bottomRow, text7); + nodeAPI->addChild(bottomRow, text8); + nodeAPI->addChild(bottomRow, text9); + nodeAPI->addChild(defaultRow, text10); + nodeAPI->addChild(defaultRow, text11); + nodeAPI->addChild(column, topRow); + nodeAPI->addChild(column, centerRow); + nodeAPI->addChild(column, bottomRow); + nodeAPI->addChild(column, defaultRow); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "A"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text5, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text6, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text7, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text8, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text9, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text10, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text11, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text6, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text7, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text8, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text9, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text10, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text11, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue top_start_value[] = {{.i32 = ARKUI_ALIGNMENT_TOP_START}}; + ArkUI_AttributeItem top_start_value_item = {top_start_value, sizeof(top_start_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_ALIGNMENT, &top_start_value_item); + + ArkUI_NumberValue top_value[] = {{.i32 = ARKUI_ALIGNMENT_TOP}}; + ArkUI_AttributeItem top_value_item = {top_value, sizeof(top_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_ALIGNMENT, &top_value_item); + + ArkUI_NumberValue top_end_value[] = {{.i32 = ARKUI_ALIGNMENT_TOP_END}}; + ArkUI_AttributeItem top_end_value_item = {top_end_value, sizeof(top_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_ALIGNMENT, &top_end_value_item); + + ArkUI_NumberValue start_value[] = {{.i32 = ARKUI_ALIGNMENT_START}}; + ArkUI_AttributeItem start_value_item = {start_value, sizeof(start_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_ALIGNMENT, &start_value_item); + + ArkUI_NumberValue center_value[] = {{.i32 = ARKUI_ALIGNMENT_CENTER}}; + ArkUI_AttributeItem center_value_item = {center_value, sizeof(center_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text5, NODE_ALIGNMENT, ¢er_value_item); + + ArkUI_NumberValue end_value[] = {{.i32 = ARKUI_ALIGNMENT_END}}; + ArkUI_AttributeItem end_value_item = {end_value, sizeof(end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text6, NODE_ALIGNMENT, &end_value_item); + + ArkUI_NumberValue bottom_start_value[] = {{.i32 = ARKUI_ALIGNMENT_BOTTOM_START}}; + ArkUI_AttributeItem bottom_start_value_item = {bottom_start_value, + sizeof(bottom_start_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text7, NODE_ALIGNMENT, &bottom_start_value_item); + + ArkUI_NumberValue bottom_value[] = {{.i32 = ARKUI_ALIGNMENT_BOTTOM}}; + ArkUI_AttributeItem bottom_value_item = {bottom_value, sizeof(bottom_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text8, NODE_ALIGNMENT, &bottom_value_item); + + ArkUI_NumberValue bottom_end_value[] = {{.i32 = ARKUI_ALIGNMENT_BOTTOM_END}}; + ArkUI_AttributeItem bottom_end_value_item = {bottom_end_value, + sizeof(bottom_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text9, NODE_ALIGNMENT, &bottom_end_value_item); + + ArkUI_NumberValue exception_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text10, NODE_ALIGNMENT, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager ::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAlignTest", + "OH_NativeXComponent_AttachNativeRootNode column failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_align_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_align_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a3115ecdd872531eaabdb17125df4e72f1f19703 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_align_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_ALIGN_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_ALIGN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAlignTest { +public: + ~TextAlignTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_ALIGN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_alignrules_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_alignrules_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7bf3b8b22230278ee5c00aa99d52606fecbd6a2c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_alignrules_test.cpp @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_alignrules_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &color_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &borderWidth_value_item); + + return nodeHandle; +} + +napi_value TextAlignRulesTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAlignRulesTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAlignRulesTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建RelativeContainer节点组件 + auto RelativeContainer = nodeAPI->createNode(ARKUI_NODE_RELATIVE_CONTAINER); + // 设置RelativeContainer组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(RelativeContainer, NODE_WIDTH, &width_item); + + // 设置RelativeContainer组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_400}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(RelativeContainer, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_GRAY}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(RelativeContainer, NODE_BACKGROUND_COLOR, &color_item); + + ArkUI_AttributeItem id_item = {.string = "__container__"}; + nodeAPI->setAttribute(RelativeContainer, NODE_ID, &id_item); + + auto text1 = createChildNode(nodeAPI); + auto text2 = createChildNode(nodeAPI); + auto text3 = createChildNode(nodeAPI); + auto text4 = createChildNode(nodeAPI); + auto text5 = createChildNode(nodeAPI); + auto text6 = createChildNode(nodeAPI); + auto text7 = createChildNode(nodeAPI); + auto text8 = createChildNode(nodeAPI); + auto text9 = createChildNode(nodeAPI); + + nodeAPI->addChild(RelativeContainer, text1); + nodeAPI->addChild(RelativeContainer, text2); + nodeAPI->addChild(RelativeContainer, text3); + nodeAPI->addChild(RelativeContainer, text4); + nodeAPI->addChild(RelativeContainer, text5); + nodeAPI->addChild(RelativeContainer, text6); + nodeAPI->addChild(RelativeContainer, text7); + nodeAPI->addChild(RelativeContainer, text8); + nodeAPI->addChild(RelativeContainer, text9); + + auto topStart = OH_ArkUI_AlignmentRuleOption_Create(); + OH_ArkUI_AlignmentRuleOption_SetTop(topStart, "__container__", ARKUI_VERTICAL_ALIGNMENT_TOP); + OH_ArkUI_AlignmentRuleOption_SetStart(topStart, "__container__", ARKUI_HORIZONTAL_ALIGNMENT_START); + float offset = -50; + OH_ArkUI_AlignmentRuleOption_SetBiasHorizontal(topStart, offset); + OH_ArkUI_AlignmentRuleOption_SetBiasVertical(topStart, offset); + ArkUI_AttributeItem topStart_item = {.object = topStart}; + nodeAPI->setAttribute(text1, NODE_ALIGN_RULES, &topStart_item); + + auto topCenter = OH_ArkUI_AlignmentRuleOption_Create(); + OH_ArkUI_AlignmentRuleOption_SetTop(topCenter, "__container__", ARKUI_VERTICAL_ALIGNMENT_TOP); + OH_ArkUI_AlignmentRuleOption_SetCenterHorizontal(topCenter, "__container__", ARKUI_HORIZONTAL_ALIGNMENT_CENTER); + ArkUI_AttributeItem topCenter_item = {.object = topCenter}; + nodeAPI->setAttribute(text2, NODE_ALIGN_RULES, &topCenter_item); + + auto topEnd = OH_ArkUI_AlignmentRuleOption_Create(); + OH_ArkUI_AlignmentRuleOption_SetTop(topEnd, "__container__", ARKUI_VERTICAL_ALIGNMENT_TOP); + OH_ArkUI_AlignmentRuleOption_SetEnd(topEnd, "__container__", ARKUI_HORIZONTAL_ALIGNMENT_END); + ArkUI_AttributeItem NODE_ALIGN_RULES_Item1 = {.object = topEnd}; + nodeAPI->setAttribute(text3, NODE_ALIGN_RULES, &NODE_ALIGN_RULES_Item1); + + auto centerVerticalStart = OH_ArkUI_AlignmentRuleOption_Create(); + OH_ArkUI_AlignmentRuleOption_SetCenterVertical(centerVerticalStart, "__container__", + ARKUI_VERTICAL_ALIGNMENT_CENTER); + OH_ArkUI_AlignmentRuleOption_SetStart(centerVerticalStart, "__container__", ARKUI_HORIZONTAL_ALIGNMENT_START); + ArkUI_AttributeItem centerVerticalStart_item = {.object = centerVerticalStart}; + nodeAPI->setAttribute(text4, NODE_ALIGN_RULES, ¢erVerticalStart_item); + + auto centerVerticalCenter = OH_ArkUI_AlignmentRuleOption_Create(); + OH_ArkUI_AlignmentRuleOption_SetCenterVertical(centerVerticalCenter, "__container__", + ARKUI_VERTICAL_ALIGNMENT_CENTER); + OH_ArkUI_AlignmentRuleOption_SetCenterHorizontal(centerVerticalCenter, "__container__", + ARKUI_HORIZONTAL_ALIGNMENT_CENTER); + ArkUI_AttributeItem centerVerticalCenter_item = {.object = centerVerticalCenter}; + nodeAPI->setAttribute(text5, NODE_ALIGN_RULES, ¢erVerticalCenter_item); + + auto centerVerticalEnd = OH_ArkUI_AlignmentRuleOption_Create(); + OH_ArkUI_AlignmentRuleOption_SetCenterVertical(centerVerticalEnd, "__container__", ARKUI_VERTICAL_ALIGNMENT_CENTER); + OH_ArkUI_AlignmentRuleOption_SetEnd(centerVerticalEnd, "__container__", ARKUI_HORIZONTAL_ALIGNMENT_END); + ArkUI_AttributeItem centerVerticalEnd_item = {.object = centerVerticalEnd}; + nodeAPI->setAttribute(text6, NODE_ALIGN_RULES, ¢erVerticalEnd_item); + + auto bottomStart = OH_ArkUI_AlignmentRuleOption_Create(); + OH_ArkUI_AlignmentRuleOption_SetBottom(bottomStart, "__container__", ARKUI_VERTICAL_ALIGNMENT_BOTTOM); + OH_ArkUI_AlignmentRuleOption_SetStart(bottomStart, "__container__", ARKUI_HORIZONTAL_ALIGNMENT_START); + ArkUI_AttributeItem bottomStart_item = {.object = bottomStart}; + nodeAPI->setAttribute(text7, NODE_ALIGN_RULES, &bottomStart_item); + + auto bottomCenter = OH_ArkUI_AlignmentRuleOption_Create(); + OH_ArkUI_AlignmentRuleOption_SetBottom(bottomCenter, "__container__", ARKUI_VERTICAL_ALIGNMENT_BOTTOM); + OH_ArkUI_AlignmentRuleOption_SetCenterHorizontal(bottomCenter, "__container__", ARKUI_HORIZONTAL_ALIGNMENT_CENTER); + ArkUI_AttributeItem bottomCenter_item = {.object = bottomCenter}; + nodeAPI->setAttribute(text8, NODE_ALIGN_RULES, &bottomCenter_item); + + auto bottomEnd = OH_ArkUI_AlignmentRuleOption_Create(); + OH_ArkUI_AlignmentRuleOption_SetBottom(bottomEnd, "__container__", ARKUI_VERTICAL_ALIGNMENT_BOTTOM); + OH_ArkUI_AlignmentRuleOption_SetEnd(bottomEnd, "__container__", ARKUI_HORIZONTAL_ALIGNMENT_END); + OH_ArkUI_AlignmentRuleOption_SetBiasHorizontal(bottomEnd, SIZE_50); + OH_ArkUI_AlignmentRuleOption_SetBiasVertical(bottomEnd, SIZE_50); + ArkUI_AttributeItem bottomEnd_item = {.object = bottomEnd}; + nodeAPI->setAttribute(text9, NODE_ALIGN_RULES, &bottomEnd_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager ::GetInstance()->GetNativeXComponent(id), + RelativeContainer) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAlignRulesTest", + "OH_NativeXComponent_AttachNativeRootNode column failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_alignrules_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_alignrules_test.h new file mode 100644 index 0000000000000000000000000000000000000000..11de72c7e3c96d619e3a3e37e82f09e9deabd8c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_alignrules_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_ALIGNRULES_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_ALIGNRULES_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAlignRulesTest { +public: + ~TextAlignRulesTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_ALIGNRULES_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ec611aa2f15537dfe4310017d68bd248eedf13a6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundcolor_test.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_backgroundcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBackgroundColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建三个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置三个text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置三个text组件背景色 + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue white_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_NumberValue black_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem white_color_item = {white_color_value, sizeof(white_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem black_color_item = {black_color_value, sizeof(black_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text2, NODE_BACKGROUND_COLOR, &white_color_item); + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &black_color_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager ::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode column failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a30e77125b57c226797bd469a3814b4625d246c3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextBackgroundColorTest { +public: + ~TextBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundimage_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundimage_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..baf004067da3f97fa3643e5ab1260d7fb614bf58 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundimage_test.cpp @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_backgroundimage_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextBackgroundImageTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBackgroundImageTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBackgroundImageTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建column节点组件 + auto column1 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto column2 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column1, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column1, NODE_HEIGHT, &column_height_item); + nodeAPI->setAttribute(column2, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column2, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text7 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text8 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text6, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text7, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text8, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text7, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text8, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column1, text1); + nodeAPI->addChild(column1, text2); + nodeAPI->addChild(column1, text3); + nodeAPI->addChild(column1, text4); + + nodeAPI->addChild(column2, text5); + nodeAPI->addChild(column2, text6); + nodeAPI->addChild(column2, text7); + nodeAPI->addChild(column2, text8); + + nodeAPI->addChild(row, column1); + nodeAPI->addChild(row, column2); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text6, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text7, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text8, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件背景图片 + + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + nodeAPI->setAttribute(text1, NODE_BACKGROUND_IMAGE, &src_item); + + ArkUI_NumberValue repeat_none_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_NONE}}; + ArkUI_AttributeItem repeat_none_value_item = {repeat_none_value, + sizeof(repeat_none_value) / sizeof(ArkUI_NumberValue)}; + repeat_none_value_item.string = "resource://media/icon.png"; + nodeAPI->setAttribute(text2, NODE_BACKGROUND_IMAGE, &repeat_none_value_item); + + ArkUI_NumberValue repeat_x_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_X}}; + ArkUI_AttributeItem repeat_x_value_item = {repeat_x_value, sizeof(repeat_x_value) / sizeof(ArkUI_NumberValue)}; + repeat_x_value_item.string = "resource://media/icon.png"; + nodeAPI->setAttribute(text3, NODE_BACKGROUND_IMAGE, &repeat_x_value_item); + + ArkUI_NumberValue repeat_y_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_Y}}; + ArkUI_AttributeItem repeat_y_value_item = {repeat_y_value, sizeof(repeat_y_value) / sizeof(ArkUI_NumberValue)}; + repeat_y_value_item.string = "resource://media/icon.png"; + nodeAPI->setAttribute(text4, NODE_BACKGROUND_IMAGE, &repeat_y_value_item); + + ArkUI_NumberValue repeat_xy_value[] = {{.i32 = ARKUI_IMAGE_REPEAT_XY}}; + ArkUI_AttributeItem repeat_xy_value_item = {repeat_xy_value, sizeof(repeat_xy_value) / sizeof(ArkUI_NumberValue)}; + repeat_xy_value_item.string = "resource://media/icon.png"; + nodeAPI->setAttribute(text5, NODE_BACKGROUND_IMAGE, &repeat_xy_value_item); + + ArkUI_AttributeItem image_item = {}; + image_item.string = "resource://media/icon.png"; + nodeAPI->setAttribute(text6, NODE_BACKGROUND_IMAGE, &image_item); + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text6, NODE_BACKGROUND_COLOR, &red_color_item); + + ArkUI_AttributeItem null_item = {}; + null_item.string = ""; + + ArkUI_NumberValue exception_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + exception_value_item.string = "resource://media/icon.png"; + nodeAPI->setAttribute(text8, NODE_BACKGROUND_IMAGE, &exception_value_item); + + // text组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundimage_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundimage_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3cb2886f8d5aa1e0494f68402fe2821efdb545b3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_backgroundimage_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_BACKGROUNDIMAGE_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_BACKGROUNDIMAGE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextBackgroundImageTest { +public: + ~TextBackgroundImageTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_BACKGROUNDIMAGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_baselineoffset_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_baselineoffset_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a2d4b7f2b030575bab56c5ed962beb27d876654c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_baselineoffset_test.cpp @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_baselineoffset_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextBaselineOffsetTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBaselineOffsetTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBaselineOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本基线的偏移量 + ArkUI_NumberValue top_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem top_value_item = {top_value, sizeof(top_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_BASELINE_OFFSET, &top_value_item); + + ArkUI_NumberValue down_value[] = {{.f32 = -30}}; + ArkUI_AttributeItem down_value_item = {down_value, sizeof(down_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_BASELINE_OFFSET, &down_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBaselineOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_baselineoffset_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_baselineoffset_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e7f4062ad57dfd911ebab911e93aba2405681c21 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_baselineoffset_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_BASELINEOFFSET_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_BASELINEOFFSET_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextBaselineOffsetTest { +public: + ~TextBaselineOffsetTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_BASELINEOFFSET_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_bordercolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_bordercolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4d836763712febf0a52ca581c32bc8a2ce2feac1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_bordercolor_test.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_bordercolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextBorderColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBorderColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBorderColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建4个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置四个text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + + // 设置text组件边框颜色 + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_COLOR, &red_color_item); + + ArkUI_NumberValue color_value[4] = { + {.u32 = 0xFFFF0000}, {.u32 = 0xFF00FF00}, {.u32 = 0xFF0000FF}, {.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem color_value_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_BORDER_COLOR, &color_value_item); + + ArkUI_NumberValue exception_value[4] = {{.u32 = 0}, {.u32 = 0xFF00FF00}, {.u32 = 0xFF0000FF}, {.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_BORDER_COLOR, &exception_value_item); + + // 设置text组件边框宽度 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBorderColorTest", + "OH_NativeXComponent_AttachNativeRootNode column failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_bordercolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_bordercolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b1dbd1e9acc6688fbdcd5089c2a7c773057a3d2d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_bordercolor_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_BORDERCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_BORDERCOLOR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextBorderColorTest { +public: + ~TextBorderColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_BORDERCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderradius_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderradius_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..487edf105535b75177f2773b5e35ad8ac7a31345 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderradius_test.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_borderradius_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextBorderRadiusTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBorderRadiusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBorderRadiusTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue column_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + // 设置column组件宽度和高度 + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建三个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置三个text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置text边框圆角 + ArkUI_NumberValue borderRadius_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem borderRadius_value_item = {borderRadius_value, + sizeof(borderRadius_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_RADIUS, &borderRadius_value_item); + + ArkUI_NumberValue array_value[4] = {{.f32 = 0}, {.f32 = 20}, {.f32 = 40}, {.f32 = 200}}; + ArkUI_AttributeItem array_value_item = {array_value, sizeof(array_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_BORDER_RADIUS, &array_value_item); + + ArkUI_NumberValue exception_value[4] = {{.f32 = 0}, {.f32 = 20}, {.f32 = 40}, {.f32 = -10}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_BORDER_RADIUS, &exception_value_item); + + // 设置text组件背景色 + ArkUI_NumberValue blue_color_value[] = {{.u32 = 0xFF0000FF}}; + + ArkUI_AttributeItem blue_color_item = {blue_color_value, sizeof(blue_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BACKGROUND_COLOR, &blue_color_item); + nodeAPI->setAttribute(text2, NODE_BACKGROUND_COLOR, &blue_color_item); + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &blue_color_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBorderRadiusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderradius_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderradius_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3e2a4fa54ff8bfcece1146a98242e07ec4df598f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderradius_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_BORDERRADIUS_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_BORDERRADIUS_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextBorderRadiusTest { +public: + ~TextBorderRadiusTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_BORDERRADIUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderwidth_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderwidth_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f7397cd9f4b6a9d7de522bac7057ebb92e9e52bb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderwidth_test.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_borderwidth_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextBorderWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBorderWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBorderWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue column_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + // 设置column组件宽度和高度 + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建三个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置三个text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置text组件边框宽度 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue borderWidth_arrayValue[4] = {{.f32 = 0.5}, {.f32 = 2.5}, {.f32 = 4.5}, {.f32 = 6.5}}; + ArkUI_AttributeItem borderWidth_arrayValue_item = {borderWidth_arrayValue, + sizeof(borderWidth_arrayValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_arrayValue_item); + + // 设置text组件边框宽度异常参数 + ArkUI_NumberValue exception_arrayValue[4] = {{.f32 = 2}, {.f32 = 2}, {.f32 = 2}, {.f32 = -10}}; + ArkUI_AttributeItem exception_arrayValue_item = {exception_arrayValue, + sizeof(exception_arrayValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &exception_arrayValue_item); + + // 设置text3组件背景色 + ArkUI_NumberValue blue_color_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem blue_color_item = {blue_color_value, sizeof(blue_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &blue_color_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextBorderWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderwidth_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderwidth_test.h new file mode 100644 index 0000000000000000000000000000000000000000..67c3507550ec6cfca2d6ad1a3359f38d8c28a8bf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_borderwidth_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_BORDERWIDTH_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_BORDERWIDTH_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextBorderWidthTest { +public: + ~TextBorderWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_BORDERWIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..722226ff4bbdbd88aa2aa89297ec5c5d017a4c06 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_clip_test.cpp @@ -0,0 +1,269 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_clip_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value TextClipTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextClipTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column1 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto column2 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column1, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column1, NODE_HEIGHT, &column_height_item); + nodeAPI->setAttribute(column2, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column2, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件和imageSpan参考组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text7 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text8 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text9 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text10 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text11 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + auto imageSpan1 = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + auto imageSpan2 = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + auto imageSpan3 = nodeAPI->createNode(ARKUI_NODE_IMAGE_SPAN); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text6, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text7, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text8, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text9, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text10, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text11, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text8, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text7, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text9, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text10, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text11, NODE_WIDTH, &width_item); + + ArkUI_NumberValue imageSpan_width_value[] = {{.f32 = 60}}; + ArkUI_AttributeItem imageSpan_width_item = {imageSpan_width_value, + sizeof(imageSpan_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue imageSpan_height_value[] = {{.f32 = 60}}; + ArkUI_AttributeItem imageSpan_height_item = {imageSpan_height_value, + sizeof(imageSpan_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(imageSpan1, NODE_WIDTH, &imageSpan_width_item); + nodeAPI->setAttribute(imageSpan1, NODE_HEIGHT, &imageSpan_height_item); + nodeAPI->setAttribute(imageSpan2, NODE_WIDTH, &imageSpan_width_item); + nodeAPI->setAttribute(imageSpan2, NODE_HEIGHT, &imageSpan_height_item); + nodeAPI->setAttribute(imageSpan3, NODE_WIDTH, &imageSpan_width_item); + nodeAPI->setAttribute(imageSpan3, NODE_HEIGHT, &imageSpan_height_item); + + ArkUI_AttributeItem src_item = {}; + src_item.string = "resource://media/icon.png"; + nodeAPI->setAttribute(imageSpan1, NODE_BACKGROUND_IMAGE, &src_item); + nodeAPI->setAttribute(imageSpan2, NODE_BACKGROUND_IMAGE, &src_item); + nodeAPI->setAttribute(imageSpan3, NODE_BACKGROUND_IMAGE, &src_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column1, text1); + nodeAPI->addChild(column1, text2); + nodeAPI->addChild(column1, text3); + nodeAPI->addChild(column1, text4); + nodeAPI->addChild(column1, text5); + nodeAPI->addChild(column1, text6); + + nodeAPI->addChild(column2, text7); + nodeAPI->addChild(column2, text8); + nodeAPI->addChild(column2, text9); + nodeAPI->addChild(column2, text10); + nodeAPI->addChild(column2, text11); + + nodeAPI->addChild(row, column1); + nodeAPI->addChild(row, column2); + // text组件放置子组件 + nodeAPI->addChild(text1, imageSpan1); + nodeAPI->addChild(text2, imageSpan2); + nodeAPI->addChild(text3, imageSpan3); + + // 设置colum组件外边距 + ArkUI_NumberValue right_value[4] = {{.f32 = 0}, {.f32 = 50}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_NumberValue left_value[4] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 50}}; + ArkUI_AttributeItem right_value_item = {right_value, sizeof(right_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem left_value_item = {left_value, sizeof(left_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column1, NODE_MARGIN, &right_value_item); + nodeAPI->setAttribute(column2, NODE_MARGIN, &left_value_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text6, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text7, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text8, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text9, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text10, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text11, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text2, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text4, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text5, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text6, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text7, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text8, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text9, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text10, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text11, NODE_BACKGROUND_COLOR, &red_color_item); + + // 设置text组件裁剪 + ArkUI_NumberValue not_cropped[] = {{.i32 = 0}}; + ArkUI_AttributeItem not_cropped_item = {not_cropped, sizeof(not_cropped) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_CLIP, ¬_cropped_item); + + ArkUI_NumberValue cropped[] = {{.i32 = 1}}; + ArkUI_AttributeItem cropped_item = {cropped, sizeof(cropped) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_CLIP, &cropped_item); + + ArkUI_NumberValue exception_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_CLIP, &exception_value_item); + + ArkUI_NumberValue rect_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 40}, {.f32 = 40}, {.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem rect_value_item = {rect_value, sizeof(rect_value) / sizeof(ArkUI_NumberValue)}; + auto ret = nodeAPI->setAttribute(text4, NODE_CLIP_SHAPE, &rect_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_CLIP_SHAPE", + "text4 NODE_CLIP_SHAPE return value is %{public}d", ret); + + ArkUI_NumberValue circle_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 40}, {.f32 = 40}}; + ArkUI_AttributeItem circle_value_item = {circle_value, sizeof(circle_value) / sizeof(ArkUI_NumberValue)}; + auto circle_ret = nodeAPI->setAttribute(text5, NODE_CLIP_SHAPE, &circle_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_CLIP_SHAPE", + "text5 NODE_CLIP_SHAPE return value is %{public}d", circle_ret); + + ArkUI_NumberValue ellipse_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 40}, {.f32 = 40}}; + ArkUI_AttributeItem ellipse_value_item = {ellipse_value, sizeof(ellipse_value) / sizeof(ArkUI_NumberValue)}; + auto ellipse_ret = nodeAPI->setAttribute(text6, NODE_CLIP_SHAPE, &ellipse_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_CLIP_SHAPE", + "text6 NODE_CLIP_SHAPE return value is %{public}d", ellipse_ret); + + ArkUI_NumberValue path_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 40}, {.f32 = 40}}; + ArkUI_AttributeItem path_value_item = {path_value, sizeof(path_value) / sizeof(ArkUI_NumberValue)}; + path_value_item.string = "M0 20 L50 50 L50 100 Z"; + auto path_string_ret = nodeAPI->setAttribute(text7, NODE_CLIP_SHAPE, &path_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_CLIP_SHAPE", + "text7 NODE_CLIP_SHAPE return value is %{public}d", path_string_ret); + + ArkUI_NumberValue rect_exceptionValue[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = -40}, {.f32 = -40}, {.f32 = -20}, {.f32 = -20}}; + ArkUI_AttributeItem rect_exceptionValue_item = {rect_exceptionValue, + sizeof(rect_exceptionValue) / sizeof(ArkUI_NumberValue)}; + auto rect_exceptionRet = nodeAPI->setAttribute(text8, NODE_CLIP_SHAPE, &rect_exceptionValue_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_CLIP_SHAPE", + "text9 NODE_CLIP_SHAPE return value is %{public}d", rect_exceptionRet); + + ArkUI_NumberValue circle_exceptionValue[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = -30}, {.f32 = -30}}; + ArkUI_AttributeItem circle_exceptionValue_item = {circle_exceptionValue, + sizeof(circle_exceptionValue) / sizeof(ArkUI_NumberValue)}; + auto circle_exception_ret = nodeAPI->setAttribute(text9, NODE_CLIP_SHAPE, &circle_exceptionValue_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_CLIP_SHAPE", + "text10 NODE_CLIP_SHAPE return value is %{public}d", circle_exception_ret); + + ArkUI_NumberValue ellipse_exceptionValue[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = -40}, {.f32 = -40}}; + ArkUI_AttributeItem ellipse_exceptionValue_item = {ellipse_exceptionValue, + sizeof(ellipse_exceptionValue) / sizeof(ArkUI_NumberValue)}; + auto ellipseException_ret = nodeAPI->setAttribute(text10, NODE_CLIP_SHAPE, &ellipse_exceptionValue_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_CLIP_SHAPE", + "text11 NODE_CLIP_SHAPE return value is %{public}d", ellipseException_ret); + + ArkUI_NumberValue path_exceptionValue[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = -40}, {.f32 = -40}}; + ArkUI_AttributeItem path_exceptionValue_item = {path_exceptionValue, + sizeof(path_exceptionValue) / sizeof(ArkUI_NumberValue)}; + path_exceptionValue_item.string = "M0 20 L50 50 L50 100 Z"; + auto pathException_string_ret = nodeAPI->setAttribute(text11, NODE_CLIP_SHAPE, &path_exceptionValue_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_CLIP_SHAPE", + "text12 NODE_CLIP_SHAPE return value is %{public}d", pathException_string_ret); + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..876f2f11b3863dfb745808dc4d0d3b2d19968b91 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_clip_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_CLIP_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextClipTest { +public: + ~TextClipTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_copyoption_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_copyoption_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c1937c9a21cf1d0e9c712c9843af74d1e0eaff80 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_copyoption_test.cpp @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_copyoption_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextCopyOptionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextCopyOptionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextCopyOptionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue size_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem size_value_item = {size_value, sizeof(size_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &size_value_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &size_value_item); + nodeAPI->setAttribute(column, NODE_WIDTH, &size_value_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &size_value_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue textSize_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem textSize_value_item = {textSize_value, sizeof(textSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &textSize_value_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &textSize_value_item); + + nodeAPI->setAttribute(text1, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &textSize_value_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &textSize_value_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "A"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text5, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue none_value[] = {{.i32 = ARKUI_COPY_OPTIONS_NONE}}; + ArkUI_AttributeItem none_value_item = {none_value, sizeof(none_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_COPY_OPTION, &none_value_item); + + ArkUI_NumberValue app_value[] = {{.i32 = ARKUI_COPY_OPTIONS_IN_APP}}; + ArkUI_AttributeItem app_value_item = {app_value, sizeof(app_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_COPY_OPTION, &app_value_item); + + ArkUI_NumberValue local_device_value[] = {{.i32 = ARKUI_COPY_OPTIONS_LOCAL_DEVICE}}; + ArkUI_AttributeItem local_device_value_item = {local_device_value, + sizeof(local_device_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_COPY_OPTION, &local_device_value_item); + + ArkUI_NumberValue cross_device_value[] = {{.i32 = ARKUI_COPY_OPTIONS_CROSS_DEVICE}}; + ArkUI_AttributeItem cross_device_value_item = {cross_device_value, + sizeof(cross_device_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_TEXT_COPY_OPTION, &cross_device_value_item); + + ArkUI_NumberValue abnormal_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem abnormal_value_item = {abnormal_value, sizeof(abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text5, NODE_TEXT_COPY_OPTION, &abnormal_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager ::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextCopyOptionTest", + "OH_NativeXComponent_AttachNativeRootNode column failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_copyoption_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_copyoption_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d70ce690909bf8aedf81d6b6e73d0eef20e86e0c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_copyoption_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_COPYOPTION_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_COPYOPTION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextCopyOptionTest { +public: + ~TextCopyOptionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_COPYOPTION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_decoration_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_decoration_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..884d5851d9318a9e8a9ee228db8e3d40b6202dd8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_decoration_test.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_decoration_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextDecorationTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextDecorationTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextDecorationTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建4个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置三个text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text5, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本装饰线 + ArkUI_NumberValue decoration_underline_value[2] = {{.i32 = ARKUI_TEXT_DECORATION_TYPE_UNDERLINE}, + {.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem decoration_underline_value_item = { + decoration_underline_value, sizeof(decoration_underline_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_DECORATION, &decoration_underline_value_item); + + ArkUI_NumberValue decoration_overline_value[2] = {{.i32 = ARKUI_TEXT_DECORATION_TYPE_OVERLINE}, + {.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem decoration_overline_value_item = {decoration_overline_value, sizeof(decoration_overline_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_DECORATION, &decoration_overline_value_item); + + ArkUI_NumberValue decoration_line_through_value[2] = {{.i32 = ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH}, + {.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem decoration_line_through_value_item = { + decoration_line_through_value, sizeof(decoration_line_through_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_TEXT_DECORATION, &decoration_line_through_value_item); + + ArkUI_NumberValue exception_value[2] = {{.i32 = 1234}, {.u32 = 1234}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text5, NODE_TEXT_DECORATION, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextDecorationTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_decoration_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_decoration_test.h new file mode 100644 index 0000000000000000000000000000000000000000..045a22d3199b638eb976c21afd74e82133c67f82 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_decoration_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_DECORATION_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_DECORATION_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextDecorationTest { +public: + ~TextDecorationTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_DECORATION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_enabled_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_enabled_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d91a42d9c4de74431a9007fd35e09904b6dddd48 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_enabled_test.cpp @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_enabled_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int enabled, const char *id) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT); + + if (enabled != SIZE_100) { + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + } + + // set id + ArkUI_AttributeItem id_item = {}; + id_item.string = id; + nodeAPI->setAttribute(nodeHandle, NODE_ID, &id_item); + + // set background color + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + // set width + ArkUI_NumberValue width_value[] = {{.f32 = TEXT_WIDTH_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // set height + ArkUI_NumberValue height_value[] = {{.f32 = TEXT_HEIGHT_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + // set focusable + ArkUI_NumberValue focusable_value[] = {{.i32 = FOCUSABLE_TRUE}}; + ArkUI_AttributeItem focusable_item = {focusable_value, sizeof(focusable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FOCUSABLE, &focusable_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextEnabledTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextEnabledTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextEnabledTest", "OnEventReceive eventId: %{public}d", eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + uint32_t color = COLOR_PURPLE; + switch (eventId) { + case ON_CLICK_EVENT_ID: + color = COLOR_GREEN; + break; + case ON_FOCUS_EVENT_ID: + color = COLOR_BLUE; + break; + case ON_BLUR_EVENT_ID: + color = COLOR_YELLOW; + break; + default: + break; + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); +} + +napi_value TextEnabledTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextEnabledTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextEnabledTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // enabled text + auto text_click = createChildNode(nodeAPI, PARAM_1, "OnClickEnabledText"); + auto text_focus = createChildNode(nodeAPI, PARAM_1, "OnFocusEnabledText"); + auto text_blur = createChildNode(nodeAPI, PARAM_1, "OnBlurEnabledText"); + + // disabled text + auto text_disabled_click = createChildNode(nodeAPI, PARAM_0, "OnClickDisabledText"); + auto text_disabled_focus = createChildNode(nodeAPI, PARAM_0, "OnFocusDisabledText"); + auto text_disabled_blur = createChildNode(nodeAPI, PARAM_0, "OnBlurDisabledText"); + + // abnormal text + auto text_abnormal_click = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnClickAbnormalText"); + auto text_abnormal_focus = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnFocusAbnormalText"); + auto text_abnormal_blur = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnBlurAbnormalText"); + + // set row height + ArkUI_NumberValue row_height_value[] = {{.f32 = ROW_HEIGHT_110}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + + // set row width + ArkUI_NumberValue row_width_value[] = {{.f32 = ROW_WIDTH_350}}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + + // set row alignment + ArkUI_NumberValue row_justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem row_justify_content_item = {row_justify_content_value, + sizeof(row_justify_content_value) / sizeof(ArkUI_NumberValue)}; + + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_first, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + nodeAPI->addChild(row_first, text_click); + nodeAPI->insertChildAfter(row_first, text_focus, text_click); + nodeAPI->insertChildAfter(row_first, text_blur, text_focus); + + nodeAPI->addChild(row_second, text_disabled_click); + nodeAPI->insertChildAfter(row_second, text_disabled_focus, text_disabled_click); + nodeAPI->insertChildAfter(row_second, text_disabled_blur, text_disabled_focus); + + nodeAPI->addChild(row_third, text_abnormal_click); + nodeAPI->insertChildAfter(row_third, text_abnormal_focus, text_abnormal_click); + nodeAPI->insertChildAfter(row_third, text_abnormal_blur, text_abnormal_focus); + + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + + // Bind click event + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_enabled_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_enabled_test.h new file mode 100644 index 0000000000000000000000000000000000000000..847581b4809031242b873f557c83b9bf213c6aba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_enabled_test.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_XTS_CB_TEXT_ENABLED_TEST_H +#define ARKUI_CAPI_XTS_CB_TEXT_ENABLED_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +#define COLUMN_HEIGHT_700 700 +#define COLUMN_WIDTH_200 200 + +#define ROW_HEIGHT_110 110 +#define ROW_WIDTH_350 350 + +#define TEXT_HEIGHT_100 100 +#define TEXT_WIDTH_100 100 + +#define FOCUSABLE_TRUE 1 + +class TextEnabledTest { +public: + ~TextEnabledTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_XTS_CB_TEXT_ENABLED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_font_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_font_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f2c1f3f62de730223a752a6a15b305012a2b0278 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_font_test.cpp @@ -0,0 +1,264 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_font_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextFontTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 600}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建16个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text7 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text8 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text9 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text10 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text11 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text12 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text13 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text14 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text15 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text16 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text17 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 40}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text6, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text7, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text8, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text9, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text10, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text11, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text12, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text13, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text14, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text15, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text16, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text17, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text7, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text8, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text9, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text10, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text11, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text12, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text13, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text14, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text15, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text16, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text17, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + nodeAPI->addChild(column, text6); + nodeAPI->addChild(column, text7); + nodeAPI->addChild(column, text8); + nodeAPI->addChild(column, text9); + nodeAPI->addChild(column, text10); + nodeAPI->addChild(column, text11); + nodeAPI->addChild(column, text12); + nodeAPI->addChild(column, text13); + nodeAPI->addChild(column, text14); + nodeAPI->addChild(column, text15); + nodeAPI->addChild(column, text16); + nodeAPI->addChild(column, text17); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text5, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text6, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text7, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text8, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text9, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text10, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text11, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text12, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text13, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text14, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text15, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text16, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text17, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text6, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text7, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text8, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text9, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text10, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text11, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text12, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text13, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text14, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text15, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text16, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text17, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本字体 + + ArkUI_NumberValue text1_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_W100}, {.i32 = ARKUI_FONT_STYLE_NORMAL}}; + ArkUI_AttributeItem text1_value_item = {text1_value, sizeof(text1_value) / sizeof(ArkUI_NumberValue)}; + text1_value_item.string = "HarmonyOS Sans"; + nodeAPI->setAttribute(text1, NODE_TEXT_FONT, &text1_value_item); + + ArkUI_NumberValue text2_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_W200}, {.i32 = ARKUI_FONT_STYLE_ITALIC}}; + ArkUI_AttributeItem text2_value_item = {text2_value, sizeof(text2_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_FONT, &text2_value_item); + + ArkUI_NumberValue text3_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_W300}}; + ArkUI_AttributeItem text3_value_item = {text3_value, sizeof(text3_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_FONT, &text3_value_item); + + ArkUI_NumberValue text4_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_W400}}; + ArkUI_AttributeItem text4_value_item = {text4_value, sizeof(text4_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_TEXT_FONT, &text4_value_item); + + ArkUI_NumberValue text5_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_W500}}; + ArkUI_AttributeItem text5_value_item = {text5_value, sizeof(text5_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text5, NODE_TEXT_FONT, &text5_value_item); + + ArkUI_NumberValue text6_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_W600}}; + ArkUI_AttributeItem text6_value_item = {text6_value, sizeof(text6_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text6, NODE_TEXT_FONT, &text6_value_item); + + ArkUI_NumberValue text7_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_W700}}; + ArkUI_AttributeItem text7_value_item = {text7_value, sizeof(text7_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text7, NODE_TEXT_FONT, &text7_value_item); + + ArkUI_NumberValue text8_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_W800}}; + ArkUI_AttributeItem text8_value_item = {text8_value, sizeof(text8_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text8, NODE_TEXT_FONT, &text8_value_item); + + ArkUI_NumberValue text9_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_W900}}; + ArkUI_AttributeItem text9_value_item = {text9_value, sizeof(text9_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text9, NODE_TEXT_FONT, &text9_value_item); + + ArkUI_NumberValue text10_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_BOLD}}; + ArkUI_AttributeItem text10_value_item = {text10_value, sizeof(text10_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text10, NODE_TEXT_FONT, &text10_value_item); + + ArkUI_NumberValue text11_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_NORMAL}}; + ArkUI_AttributeItem text11_value_item = {text11_value, sizeof(text11_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text11, NODE_TEXT_FONT, &text11_value_item); + + ArkUI_NumberValue text12_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_BOLDER}}; + ArkUI_AttributeItem text12_value_item = {text12_value, sizeof(text12_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text12, NODE_TEXT_FONT, &text12_value_item); + + ArkUI_NumberValue text13_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_LIGHTER}}; + ArkUI_AttributeItem text13_value_item = {text13_value, sizeof(text13_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text13, NODE_TEXT_FONT, &text13_value_item); + + ArkUI_NumberValue text14_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_MEDIUM}}; + ArkUI_AttributeItem text14_value_item = {text14_value, sizeof(text14_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text14, NODE_TEXT_FONT, &text14_value_item); + + ArkUI_NumberValue text15_value[] = {{.f32 = 20}, {.i32 = ARKUI_FONT_WEIGHT_REGULAR}}; + ArkUI_AttributeItem text15_value_item = {text15_value, sizeof(text15_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text15, NODE_TEXT_FONT, &text15_value_item); + + ArkUI_NumberValue text16_value[] = {{.f32 = -20}, {.i32 = -1}, {.i32 = -1}}; + ArkUI_AttributeItem text16_value_item = {text16_value, sizeof(text16_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text16, NODE_TEXT_FONT, &text16_value_item); + + ArkUI_NumberValue text17_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem text17_value_item = {text17_value, sizeof(text17_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text17, NODE_TEXT_FONT, &text17_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_font_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_font_test.h new file mode 100644 index 0000000000000000000000000000000000000000..392e899a9b1a423214f091d30e7a5b25f50c3bfe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_font_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_FONT_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_FONT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextFontTest { +public: + ~TextFontTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_FONT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6a0f9365e3b224845d5ccbf3f3b2f485719662e2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontcolor_test.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_fontcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextFontColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建三个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置三个text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件文本颜色 + ArkUI_NumberValue color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem color_value_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_FONT_COLOR, &color_value_item); + + ArkUI_NumberValue boundary_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem boundary_value_item = {boundary_value, sizeof(boundary_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_FONT_COLOR, &boundary_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..ef074db4205144fe8cc3076efc3c71b9cb49b18c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontcolor_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_FONTCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_FONTCOLOR_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextFontColorTest { +public: + ~TextFontColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_FONTCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontfamily_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontfamily_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1c03e73dd4456c398ec18dd641fdca745ebc2e0e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontfamily_test.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_fontfamily_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextFontFamilyTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontFamilyTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontFamilyTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件文本字体 + ArkUI_AttributeItem valueItem = {}; + valueItem.string = "HarmonyOS Sans"; + nodeAPI->setAttribute(text2, NODE_FONT_FAMILY, &valueItem); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontFamilyTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontfamily_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontfamily_test.h new file mode 100644 index 0000000000000000000000000000000000000000..41692c376a2473ccb78150c558153c216fda0388 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontfamily_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_FONTFAMILY_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_FONTFAMILY_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextFontFamilyTest { +public: + ~TextFontFamilyTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_FONTFAMILY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontsize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontsize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ae430ebaed030514a037fd73f1355817a4a50246 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontsize_test.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_fontsize_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextFontSizeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontSizeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建三个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置三个text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件文本大小 + ArkUI_NumberValue fontSize_value[] = {{.f32 = 25}}; + ArkUI_AttributeItem fontSize_value_item = {fontSize_value, sizeof(fontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_FONT_SIZE, &fontSize_value_item); + + ArkUI_NumberValue boundary_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem boundary_value_item = {boundary_value, sizeof(boundary_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_FONT_SIZE, &boundary_value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_FONT_SIZE, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontsize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontsize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3353702bab8b4a43cd6ef72e53af8433604e4e0a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontsize_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_FONTSIZE_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_FONTSIZE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextFontSizeTest { +public: + ~TextFontSizeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_FONTSIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..040ed60c5bfdf1586d959e3cb86d963c6d68a645 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontstyle_test.cpp @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_fontstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextFontStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontStyleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontStyleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本字体样式 + ArkUI_NumberValue exception_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_FONT_STYLE, &exception_value_item); + + ArkUI_NumberValue fontStyle_normal_value[] = {{.i32 = ARKUI_FONT_STYLE_NORMAL}}; + ArkUI_AttributeItem fontStyle_normal_value_item = {fontStyle_normal_value, + sizeof(fontStyle_normal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_FONT_STYLE, &fontStyle_normal_value_item); + + ArkUI_NumberValue fontStyle_italic_value[] = {{.i32 = ARKUI_FONT_STYLE_ITALIC}}; + ArkUI_AttributeItem fontStyle_italic_value_item = {fontStyle_italic_value, + sizeof(fontStyle_italic_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_FONT_STYLE, &fontStyle_italic_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1c77107d90ed93be17982045082bf364ea3859ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontstyle_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_FONTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_FONTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextFontStyleTest { +public: + ~TextFontStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_FONTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontweight_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontweight_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d70d75ac31ab55cb79c4971f18916e56015d52c0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontweight_test.cpp @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_fontweight_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextFontWeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontWeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontWeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 600}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建15个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text7 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text8 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text9 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text10 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text11 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text12 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text13 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text14 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text15 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置15个text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text6, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text7, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text8, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text9, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text10, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text11, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text12, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text13, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text14, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text15, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text7, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text8, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text9, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text10, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text11, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text12, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text13, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text14, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text15, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + nodeAPI->addChild(column, text6); + nodeAPI->addChild(column, text7); + nodeAPI->addChild(column, text8); + nodeAPI->addChild(column, text9); + nodeAPI->addChild(column, text10); + nodeAPI->addChild(column, text11); + nodeAPI->addChild(column, text12); + nodeAPI->addChild(column, text13); + nodeAPI->addChild(column, text14); + nodeAPI->addChild(column, text15); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text5, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text6, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text7, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text8, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text9, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text10, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text11, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text12, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text13, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text14, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text15, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text6, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text7, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text8, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text9, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text10, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text11, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text12, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text13, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text14, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text15, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本字体 + + ArkUI_NumberValue text1_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem text1_value_item = {text1_value, sizeof(text1_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_FONT_WEIGHT, &text1_value_item); + + ArkUI_NumberValue text2_value[] = {{.i32 = ARKUI_FONT_WEIGHT_W100}}; + ArkUI_AttributeItem text2_value_item = {text2_value, sizeof(text2_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_FONT_WEIGHT, &text2_value_item); + + ArkUI_NumberValue text3_value[] = {{.i32 = ARKUI_FONT_WEIGHT_W200}}; + ArkUI_AttributeItem text3_value_item = {text3_value, sizeof(text3_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_FONT_WEIGHT, &text3_value_item); + + ArkUI_NumberValue text4_value[] = {{.i32 = ARKUI_FONT_WEIGHT_W300}}; + ArkUI_AttributeItem text4_value_item = {text4_value, sizeof(text4_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_FONT_WEIGHT, &text4_value_item); + + ArkUI_NumberValue text5_value[] = {{.i32 = ARKUI_FONT_WEIGHT_W400}}; + ArkUI_AttributeItem text5_value_item = {text5_value, sizeof(text5_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text5, NODE_FONT_WEIGHT, &text5_value_item); + + ArkUI_NumberValue text6_value[] = {{.i32 = ARKUI_FONT_WEIGHT_W500}}; + ArkUI_AttributeItem text6_value_item = {text6_value, sizeof(text6_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text6, NODE_FONT_WEIGHT, &text6_value_item); + + ArkUI_NumberValue text7_value[] = {{.i32 = ARKUI_FONT_WEIGHT_W600}}; + ArkUI_AttributeItem text7_value_item = {text7_value, sizeof(text7_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text7, NODE_FONT_WEIGHT, &text7_value_item); + + ArkUI_NumberValue text8_value[] = {{.i32 = ARKUI_FONT_WEIGHT_W700}}; + ArkUI_AttributeItem text8_value_item = {text8_value, sizeof(text8_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text8, NODE_FONT_WEIGHT, &text8_value_item); + + ArkUI_NumberValue text9_value[] = {{.i32 = ARKUI_FONT_WEIGHT_W800}}; + ArkUI_AttributeItem text9_value_item = {text9_value, sizeof(text9_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text9, NODE_FONT_WEIGHT, &text9_value_item); + + ArkUI_NumberValue text10_value[] = {{.i32 = ARKUI_FONT_WEIGHT_W900}}; + ArkUI_AttributeItem text10_value_item = {text10_value, sizeof(text10_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text10, NODE_FONT_WEIGHT, &text10_value_item); + + ArkUI_NumberValue text11_value[] = {{.i32 = ARKUI_FONT_WEIGHT_BOLD}}; + ArkUI_AttributeItem text11value_item = {text11_value, sizeof(text11_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text11, NODE_FONT_WEIGHT, &text11value_item); + + ArkUI_NumberValue text12_value[] = {{.i32 = ARKUI_FONT_WEIGHT_BOLDER}}; + ArkUI_AttributeItem text12_value_item = {text12_value, sizeof(text12_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text12, NODE_FONT_WEIGHT, &text12_value_item); + + ArkUI_NumberValue text13_value[] = {{.i32 = ARKUI_FONT_WEIGHT_LIGHTER}}; + ArkUI_AttributeItem text13_value_item = {text13_value, sizeof(text13_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text13, NODE_FONT_WEIGHT, &text13_value_item); + + ArkUI_NumberValue text14_value[] = {{.i32 = ARKUI_FONT_WEIGHT_MEDIUM}}; + ArkUI_AttributeItem text14_value_item = {text14_value, sizeof(text14_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text14, NODE_FONT_WEIGHT, &text14_value_item); + + ArkUI_NumberValue text15_value[] = {{.i32 = ARKUI_FONT_WEIGHT_REGULAR}}; + ArkUI_AttributeItem text15_value_item = {text15_value, sizeof(text15_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text15, NODE_FONT_WEIGHT, &text15_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextFontWeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontweight_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontweight_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b1a4cd6e61569dc0cee68eef8e4fa202066086cb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_fontweight_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_FONTWEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_FONTWEIGHT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextFontWeightTest { +public: + ~TextFontWeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_FONTWEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3eb8ae2d780a632caa5abc91ebda9f701a44154d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_height_test.cpp @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置text组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first text + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->setAttribute(text, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(text, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(text, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // second text + auto text_second = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->setAttribute(text_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(text_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(text_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(text_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, text); + nodeAPI->insertChildAfter(column, text_second, text); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置高度为500 + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + ArkUI_NumberValue height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // 设置text组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置宽度为200 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + nodeAPI->addChild(column, text); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..091cee9f38432157612feff6aa33fff9aa612148 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextHeightTest { +public: + ~TextHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_heightadaptivepolicy_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_heightadaptivepolicy_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..869641a2ba1597548d0f635e11b8f7b98a77d6c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_heightadaptivepolicy_test.cpp @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_heightadaptivepolicy_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextHeightAdaptivePolicyTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextHeightAdaptivePolicyTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextHeightAdaptivePolicyTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text7 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text8 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text7, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text8, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text7, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text8, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + nodeAPI->addChild(column, text6); + nodeAPI->addChild(column, text7); + nodeAPI->addChild(column, text8); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "HeightAdaptivePolicy Test"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text5, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text6, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text7, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text8, NODE_TEXT_CONTENT, &content_item); + + // 设置字体大小 + ArkUI_NumberValue font_size_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem font_size_value_item = {font_size_value, sizeof(font_size_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text2, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text3, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text4, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text5, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text6, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text7, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text8, NODE_FONT_SIZE, &font_size_value_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text6, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text7, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text8, NODE_BORDER_WIDTH, &borderWidth_value_item); + // 设置text组件文本最大行数 + ArkUI_NumberValue lines_value[] = {{.i32 = 3}}; + ArkUI_AttributeItem lines_value_value_item = {lines_value, sizeof(lines_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(text3, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(text4, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(text5, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(text6, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(text7, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(text8, NODE_TEXT_MAX_LINES, &lines_value_value_item); + // 设置text组件文本最小显示字号 + ArkUI_NumberValue minFontSize_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem minFontSize_value_item = {minFontSize_value, + sizeof(minFontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + nodeAPI->setAttribute(text2, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + nodeAPI->setAttribute(text4, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + nodeAPI->setAttribute(text5, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + nodeAPI->setAttribute(text6, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + nodeAPI->setAttribute(text8, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + + // 设置text组件文本最大显示字号 + ArkUI_NumberValue maxFontSize_value[] = {{.f32 = 40}}; + ArkUI_AttributeItem maxFontSize_value_item = {maxFontSize_value, + sizeof(maxFontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(text2, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(text3, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(text4, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(text5, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(text6, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(text7, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(text8, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + + // 设置text组件文本自适应高度的方式 + ArkUI_NumberValue text1_lines_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem text1_lines_value_item = {text1_lines_value, + sizeof(text1_lines_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MAX_LINES, &text1_lines_value_item); + ArkUI_NumberValue max_lines_first_value[] = {{.i32 = ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST}}; + ArkUI_AttributeItem max_lines_first_value_item = {max_lines_first_value, + sizeof(max_lines_first_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &max_lines_first_value_item); + nodeAPI->setAttribute(text2, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &max_lines_first_value_item); + + ArkUI_NumberValue text3_minFontSize_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem text3_minFontSize_value_item = {text3_minFontSize_value, + sizeof(text3_minFontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_MIN_FONT_SIZE, &text3_minFontSize_value_item); + ArkUI_NumberValue min_font_size_first_value[] = {{.i32 = ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MIN_FONT_SIZE_FIRST}}; + ArkUI_AttributeItem min_font_size_first_value_item = {min_font_size_first_value, sizeof(min_font_size_first_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &min_font_size_first_value_item); + nodeAPI->setAttribute(text4, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &min_font_size_first_value_item); + + ArkUI_NumberValue layout_constraint_first_value[] = { + {.i32 = ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_LAYOUT_CONSTRAINT_FIRST}}; + ArkUI_AttributeItem layout_constraint_first_value_item = { + layout_constraint_first_value, sizeof(layout_constraint_first_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text5, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &layout_constraint_first_value_item); + + ArkUI_NumberValue text6_height_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem text6_height_value_item = {text6_height_value, + sizeof(text6_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text6, NODE_HEIGHT, &text6_height_value_item); + nodeAPI->setAttribute(text6, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &layout_constraint_first_value_item); + + ArkUI_NumberValue text7_minFontSize_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem text7_minFontSize_value_item = {text7_minFontSize_value, + sizeof(text7_minFontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text7, NODE_TEXT_MIN_FONT_SIZE, &text7_minFontSize_value_item); + nodeAPI->setAttribute(text7, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &layout_constraint_first_value_item); + + ArkUI_NumberValue exception_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text8, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextHeightAdaptivePolicyTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_heightadaptivepolicy_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_heightadaptivepolicy_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3cb5000eb990b86e459e3a856bfb8cc4ec52e5e7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_heightadaptivepolicy_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_HEIGHTADAPTIVEPOLICY_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_HEIGHTADAPTIVEPOLICY_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextHeightAdaptivePolicyTest { +public: + ~TextHeightAdaptivePolicyTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_HEIGHTADAPTIVEPOLICY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_letterspacing_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_letterspacing_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ac3dfee1005de393eb19aba254173e13bce3e8b8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_letterspacing_test.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_letterspacing_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextLetterSpacingTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLetterSpacingTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLetterSpacingTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "letterSpacing test"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本字符间距 + ArkUI_NumberValue default_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem spacing_value_item = {default_value, sizeof(default_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_LETTER_SPACING, &spacing_value_item); + + ArkUI_NumberValue normal_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem normal_value_item = {normal_value, sizeof(normal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_LETTER_SPACING, &normal_value_item); + + ArkUI_NumberValue less_value[] = {{.f32 = -2}}; + ArkUI_AttributeItem less_value_item = {less_value, sizeof(less_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_LETTER_SPACING, &less_value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_TEXT_LETTER_SPACING, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLetterSpacingTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_letterspacing_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_letterspacing_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0e341f02a17c6aff8741be71d81b5cd1b9381e7c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_letterspacing_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_LETTERSPACING_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_LETTERSPACING_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextLetterSpacingTest { +public: + ~TextLetterSpacingTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_LETTERSPACING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineargradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineargradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1ff79bd84b1920de86728f553f2f188c2f182aec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineargradient_test.cpp @@ -0,0 +1,244 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_lineargradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value TextLinearGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLinearGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLinearGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建column节点组件 + auto column1 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto column2 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column1, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column1, NODE_HEIGHT, &column_height_item); + nodeAPI->setAttribute(column2, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column2, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text7 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text8 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text9 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text10 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text11 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text12 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text6, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text7, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text8, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text9, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text10, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text11, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text12, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text7, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text8, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text9, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text10, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text11, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text12, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column1, text1); + nodeAPI->addChild(column1, text2); + nodeAPI->addChild(column1, text3); + nodeAPI->addChild(column1, text4); + nodeAPI->addChild(column1, text5); + nodeAPI->addChild(column1, text6); + + nodeAPI->addChild(column2, text7); + nodeAPI->addChild(column2, text8); + nodeAPI->addChild(column2, text9); + nodeAPI->addChild(column2, text10); + nodeAPI->addChild(column2, text11); + nodeAPI->addChild(column2, text12); + + nodeAPI->addChild(row, column1); + nodeAPI->addChild(row, column2); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text6, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text7, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text8, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text9, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text10, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text11, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text12, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件颜色渐变 + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.3, 1}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue direction_left_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT}, {.i32 = false}}; + ArkUI_AttributeItem direction_left_value_item = {direction_left_value, + sizeof(direction_left_value) / sizeof(ArkUI_NumberValue)}; + direction_left_value_item.object = &colorStop; + nodeAPI->setAttribute(text1, NODE_LINEAR_GRADIENT, &direction_left_value_item); + + ArkUI_NumberValue direction_top_value[] = { + {.f32 = 180}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_TOP}, {.i32 = false}}; + ArkUI_AttributeItem direction_top_value_item = {direction_top_value, + sizeof(direction_top_value) / sizeof(ArkUI_NumberValue)}; + direction_top_value_item.object = &colorStop; + nodeAPI->setAttribute(text2, NODE_LINEAR_GRADIENT, &direction_top_value_item); + + ArkUI_NumberValue direction_right_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT}, {.i32 = true}}; + ArkUI_AttributeItem direction_right_value_item = {direction_right_value, + sizeof(direction_right_value) / sizeof(ArkUI_NumberValue)}; + direction_right_value_item.object = &colorStop; + nodeAPI->setAttribute(text3, NODE_LINEAR_GRADIENT, &direction_right_value_item); + + unsigned int colors_object[] = {0xFFFFFFFF, 0xFF0000FF, 0xFF000000}; + float stops_object[] = {0.2, 0.5, 1}; + ArkUI_ColorStop colorStop_object = {colors_object, stops_object, 3}; + ArkUI_NumberValue direction_bottom_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem direction_bottom_value_item = {direction_bottom_value, + sizeof(direction_bottom_value) / sizeof(ArkUI_NumberValue)}; + direction_bottom_value_item.object = &colorStop_object; + nodeAPI->setAttribute(text4, NODE_LINEAR_GRADIENT, &direction_bottom_value_item); + + ArkUI_NumberValue direction_left_top_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP}, {.i32 = false}}; + ArkUI_AttributeItem direction_left_top_value_item = {direction_left_top_value, + sizeof(direction_left_top_value) / sizeof(ArkUI_NumberValue)}; + direction_left_top_value_item.object = &colorStop; + nodeAPI->setAttribute(text5, NODE_LINEAR_GRADIENT, &direction_left_top_value_item); + + ArkUI_NumberValue direction_left_bottom_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem direction_left_bottom_value_item = { + direction_left_bottom_value, sizeof(direction_left_bottom_value) / sizeof(ArkUI_NumberValue)}; + direction_left_bottom_value_item.object = &colorStop; + nodeAPI->setAttribute(text6, NODE_LINEAR_GRADIENT, &direction_left_bottom_value_item); + + ArkUI_NumberValue direction_right_top_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP}, {.i32 = false}}; + ArkUI_AttributeItem direction_right_top_value_item = {direction_right_top_value, sizeof(direction_right_top_value) / + sizeof(ArkUI_NumberValue)}; + direction_right_top_value_item.object = &colorStop; + nodeAPI->setAttribute(text7, NODE_LINEAR_GRADIENT, &direction_right_top_value_item); + + ArkUI_NumberValue direction_right_bottom_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM}, {.i32 = false}}; + ArkUI_AttributeItem direction_right_bottom_value_item = { + direction_right_bottom_value, sizeof(direction_right_bottom_value) / sizeof(ArkUI_NumberValue)}; + direction_right_bottom_value_item.object = &colorStop; + nodeAPI->setAttribute(text8, NODE_LINEAR_GRADIENT, &direction_right_bottom_value_item); + + ArkUI_NumberValue direction_none_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_NONE}, {.i32 = false}}; + ArkUI_AttributeItem direction_none_value_item = {direction_none_value, + sizeof(direction_none_value) / sizeof(ArkUI_NumberValue)}; + direction_none_value_item.object = &colorStop; + nodeAPI->setAttribute(text9, NODE_LINEAR_GRADIENT, &direction_none_value_item); + + ArkUI_NumberValue direction_custom_value[] = { + {.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM}, {.i32 = false}}; + ArkUI_AttributeItem direction_custom_value_item = {direction_custom_value, + sizeof(direction_custom_value) / sizeof(ArkUI_NumberValue)}; + direction_custom_value_item.object = &colorStop; + nodeAPI->setAttribute(text10, NODE_LINEAR_GRADIENT, &direction_custom_value_item); + + unsigned int colors_exception[] = {1234, 1234}; + ArkUI_ColorStop exception_colorStop = {colors_exception, stops, 2}; + ArkUI_NumberValue value[] = {{.f32 = 90}, {.i32 = ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT}, {.i32 = false}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.object = &exception_colorStop; + nodeAPI->setAttribute(text11, NODE_LINEAR_GRADIENT, &value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = 90}, {.i32 = -1}, {.i32 = false}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + exception_value_item.object = &colorStop; + nodeAPI->setAttribute(text12, NODE_LINEAR_GRADIENT, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLinearGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineargradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineargradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..dd5b020d61b0e95b3d88d5db1ecd32cab63f1929 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineargradient_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_LINEARGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_LINEARGRADIENT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextLinearGradientTest { +public: + ~TextLinearGradientTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_LINEARGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_linebreakstrategy_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_linebreakstrategy_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cc268dc1e2b1bee02af3f29ae54079cf23fd1a34 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_linebreakstrategy_test.cpp @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_linebreakstrategy_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t wordBreak) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // 设置组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + // 设置组件边距 + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem content_item = {}; + content_item.string = "This is set WordBreakToWordBreakTextContentThisIsSetWordBreakToWordBreakTextContent."; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_CONTENT, &content_item); + + ArkUI_NumberValue fontSize_value[] = {{.f32 = 12}}; + ArkUI_AttributeItem fontSize_item = {fontSize_value, sizeof(fontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_FONT_SIZE, &fontSize_item); + + ArkUI_NumberValue lineHeight_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem lineHeight_item = {lineHeight_value, sizeof(lineHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT, &lineHeight_item); + + ArkUI_NumberValue maxLines_value[] = {{.i32 = 2}}; + ArkUI_AttributeItem maxLines_item = {maxLines_value, sizeof(maxLines_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_MAX_LINES, &maxLines_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue wordBreak_value[] = {{.i32 = wordBreak}}; + ArkUI_AttributeItem none_value_item = {wordBreak_value, sizeof(wordBreak_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_WORD_BREAK, &none_value_item); + + return nodeHandle; +} + +napi_value TextLineBreakStrategyTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLineBreakStrategyTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLineBreakStrategyTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto text1 = createChildNode(nodeAPI, ARKUI_WORD_BREAK_NORMAL); + auto text2 = createChildNode(nodeAPI, ARKUI_WORD_BREAK_BREAK_ALL); + auto text3 = createChildNode(nodeAPI, ARKUI_WORD_BREAK_BREAK_WORD); + auto text4 = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager ::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLineBreakStrategyTest", + "OH_NativeXComponent_AttachNativeRootNode column failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_linebreakstrategy_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_linebreakstrategy_test.h new file mode 100644 index 0000000000000000000000000000000000000000..eb8c899198c6f45882b43d6919e80f04ad49c4c1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_linebreakstrategy_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_LINEBREAKSTRATEGY_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_LINEBREAKSTRATEGY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextLineBreakStrategyTest { +public: + ~TextLineBreakStrategyTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_LINEBREAKSTRATEGY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineheight_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineheight_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4f8ccd837f9498ca85e0d2dbc693d696479b0e64 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineheight_test.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_lineheight_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextLineHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLineHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLineHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建三个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置三个text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本行高 + ArkUI_NumberValue lineHeight_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem lineHeight_value_item = {lineHeight_value, + sizeof(lineHeight_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_LINE_HEIGHT, &lineHeight_value_item); + + ArkUI_NumberValue boundary_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem boundary_value_item = {boundary_value, sizeof(boundary_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_LINE_HEIGHT, &boundary_value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_LINE_HEIGHT, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextLineHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineheight_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineheight_test.h new file mode 100644 index 0000000000000000000000000000000000000000..57d3ba19f0eda6a300a2de1daf9d40fde38caccd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_lineheight_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_LINEHEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_LINEHEIGHT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextLineHeightTest { +public: + ~TextLineHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_LINEHEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_mask_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_mask_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bd50a474b9b20e8ec7cf0949d764a704dee041e6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_mask_test.cpp @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_mask_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextMaskTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMaskTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMaskTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 80}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 80}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text6, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + nodeAPI->addChild(column, text6); + + // 设置text组件背景色 + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue white_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_NumberValue black_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_NumberValue yellow_color_value[] = {{.u32 = 0XFFFFFF00}}; + ArkUI_NumberValue blue_color_value[] = {{.u32 = 0XFF0000FF}}; + ArkUI_NumberValue cyan_color_value[] = {{.u32 = 0XFF00FFFF}}; + + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem white_color_item = {white_color_value, sizeof(white_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem black_color_item = {black_color_value, sizeof(black_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem yellow_color_item = {yellow_color_value, + sizeof(yellow_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem blue_color_item = {blue_color_value, sizeof(blue_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem cyan_color_item = {cyan_color_value, sizeof(cyan_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text2, NODE_BACKGROUND_COLOR, &white_color_item); + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &black_color_item); + nodeAPI->setAttribute(text4, NODE_BACKGROUND_COLOR, &yellow_color_item); + nodeAPI->setAttribute(text5, NODE_BACKGROUND_COLOR, &blue_color_item); + nodeAPI->setAttribute(text6, NODE_BACKGROUND_COLOR, &cyan_color_item); + + // 设置text组件指定形状的遮罩 + ArkUI_NumberValue rect_value[] = { + {.u32 = 0xFF000000}, {.u32 = 0xFF000000}, {.f32 = 5}, {.i32 = ARKUI_MASK_TYPE_RECTANGLE}, + {.f32 = 40}, {.f32 = 40}, {.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem rect_value_item = {rect_value, sizeof(rect_value) / sizeof(ArkUI_NumberValue)}; + auto ret = nodeAPI->setAttribute(text1, NODE_MASK, &rect_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_MASK", "NODE_MASK return value is %{public}d", ret); + + ArkUI_NumberValue circle_value[] = {{.u32 = 0xFFFF0000}, {.u32 = 0xFFFF0000}, + {.f32 = 5}, {.i32 = ARKUI_MASK_TYPE_CIRCLE}, + {.f32 = 90}, {.f32 = 90}}; + ArkUI_AttributeItem circle_value_item = {circle_value, sizeof(circle_value) / sizeof(ArkUI_NumberValue)}; + auto circle_ret = nodeAPI->setAttribute(text2, NODE_MASK, &circle_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_MASK", "NODE_MASK return value is %{public}d", circle_ret); + + ArkUI_NumberValue ellipse_value[] = {{.u32 = 0xFFFFFFFF}, {.u32 = 0xFFFFFFFF}, + {.f32 = 5}, {.i32 = ARKUI_MASK_TYPE_ELLIPSE}, + {.f32 = 50}, {.f32 = 20}}; + ArkUI_AttributeItem ellipse_value_item = {ellipse_value, sizeof(ellipse_value) / sizeof(ArkUI_NumberValue)}; + auto ellipse_ret = nodeAPI->setAttribute(text3, NODE_MASK, &ellipse_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_MASK", "NODE_MASK return value is %{public}d", + ellipse_ret); + + ArkUI_NumberValue path_value[] = {{.u32 = 0xFF000000}, {.u32 = 0xFF000000}, {.f32 = 10}, + {.i32 = ARKUI_MASK_TYPE_PATH}, {.f32 = 40}, {.f32 = 40}}; + ArkUI_AttributeItem path_value_item = {path_value, sizeof(path_value) / sizeof(ArkUI_NumberValue)}; + path_value_item.string = "M0 20 L50 50 L50 100 Z"; + auto path_string_ret = nodeAPI->setAttribute(text4, NODE_MASK, &path_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_MASK", "NODE_MASK return value is %{public}d", + path_string_ret); + + ArkUI_NumberValue progress_value[] = { + {.i32 = ARKUI_MASK_TYPE_PROGRESS}, + {.f32 = 40}, {.f32 = 60}, {.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem progress_value_item = {progress_value, sizeof(progress_value) / sizeof(ArkUI_NumberValue)}; + auto progress_ret = nodeAPI->setAttribute(text5, NODE_MASK, &progress_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_MASK", "NODE_MASK return value is %{public}d", + progress_ret); + + ArkUI_NumberValue exception_value[] = {{.u32 = 1234}, {.u32 = 1234}, {.f32 = -5}, + {.i32 = -1}, {.f32 = -40}, {.f32 = -40}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + auto exception_ret = nodeAPI->setAttribute(text6, NODE_MASK, &exception_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NODE_MASK", "NODE_MASK return value is %{public}d", + exception_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMaskTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_mask_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_mask_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bcdd07e124d3a2661a925f875e1d8e7a7c0475cc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_mask_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_MASK_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_MASK_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextMaskTest { +public: + ~TextMaskTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_MASK_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxfontsize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxfontsize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f5fa3f51b94bab137c3154429150fc63962bae13 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxfontsize_test.cpp @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_maxfontsize_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextMaxFontSizeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMaxFontSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMaxFontSizeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto span = nodeAPI->createNode(ARKUI_NODE_SPAN); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(text2, span); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "Test"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(span, NODE_SPAN_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置字体大小 + ArkUI_NumberValue font_size_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem font_size_value_item = {font_size_value, sizeof(font_size_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(span, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text3, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text4, NODE_FONT_SIZE, &font_size_value_item); + + // 设置text组件文本最大显示字号 + ArkUI_NumberValue maxFontSize_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem maxFontSize_value_item = {maxFontSize_value, + sizeof(maxFontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(span, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(text3, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + + ArkUI_NumberValue lines_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem lines_value_value_item = {lines_value, sizeof(lines_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(span, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(text4, NODE_TEXT_MAX_LINES, &lines_value_value_item); + + ArkUI_NumberValue minFontSize_value[] = {{.f32 = 5}}; + ArkUI_AttributeItem minFontSize_value_item = {minFontSize_value, + sizeof(minFontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + nodeAPI->setAttribute(span, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + nodeAPI->setAttribute(text4, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem exception_value_value_item = {exception_value, + sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_TEXT_MAX_FONT_SIZE, &exception_value_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMaxFontSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxfontsize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxfontsize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a9f72a46dc571b6332bb24538d46a8987bec435a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxfontsize_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_MAXFONTSIZE_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_MAXFONTSIZE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextMaxFontSizeTest { +public: + ~TextMaxFontSizeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_MAXFONTSIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxlines_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxlines_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..57f82310d090963bc7280121ef305fe2b2acf55d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxlines_test.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_maxlines_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextMaxLinesTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMaxLinesTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMaxLinesTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建三个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置三个text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "Test the maximum number of lines in text attribute of the C API"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本最大行数 + ArkUI_NumberValue lines_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem lines_value_value_item = {lines_value, sizeof(lines_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MAX_LINES, &lines_value_value_item); + + ArkUI_NumberValue boundary_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem boundary_value_item = {boundary_value, sizeof(boundary_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_MAX_LINES, &boundary_value_item); + + ArkUI_NumberValue exception_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_MAX_LINES, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMaxLinesTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxlines_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxlines_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f08547a1d8c944724b487c3b2c32eedc12945e8a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_maxlines_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_MAXLINES_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_MAXLINES_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextMaxLinesTest { +public: + ~TextMaxLinesTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_MAXLINES_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_minfontsize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_minfontsize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f485b3b8e164bb596c6e53fe1996feef73b28753 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_minfontsize_test.cpp @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_minfontsize_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextMinFontSizeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMinFontSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMinFontSizeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto span = nodeAPI->createNode(ARKUI_NODE_SPAN); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(text2, span); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "MinFontSize Test"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(span, NODE_SPAN_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + + // 设置字体大小 + ArkUI_NumberValue font_size_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem font_size_value_item = {font_size_value, sizeof(font_size_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(span, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text3, NODE_FONT_SIZE, &font_size_value_item); + nodeAPI->setAttribute(text4, NODE_FONT_SIZE, &font_size_value_item); + + // 设置text组件文本最小显示字号 + ArkUI_NumberValue minFontSize_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem minFontSize_value_item = {minFontSize_value, + sizeof(minFontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + nodeAPI->setAttribute(span, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + nodeAPI->setAttribute(text3, NODE_TEXT_MIN_FONT_SIZE, &minFontSize_value_item); + // 设置text组件文本最多行数 + ArkUI_NumberValue lines_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem lines_value_value_item = {lines_value, sizeof(lines_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(span, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(text4, NODE_TEXT_MAX_LINES, &lines_value_value_item); + // 设置text组件文本最大显示字号 + ArkUI_NumberValue maxFontSize_value[] = {{.f32 = 40}}; + ArkUI_AttributeItem maxFontSize_value_item = {maxFontSize_value, + sizeof(maxFontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(span, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + nodeAPI->setAttribute(text4, NODE_TEXT_MAX_FONT_SIZE, &maxFontSize_value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem exception_value_value_item = {exception_value, + sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_TEXT_MIN_FONT_SIZE, &exception_value_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextMinFontSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_minfontsize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_minfontsize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d2ccf75d8739c1c427f8ee6684e2aafcbce5471b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_minfontsize_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_MINFONTSIZE_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_MINFONTSIZE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextMinFontSizeTest { +public: + ~TextMinFontSizeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_MINFONTSIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_offset_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_offset_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c58f200dc0514c603656a4f156d9e37418eac3e2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_offset_test.cpp @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_offset_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextOffsetTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextOffsetTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextOffsetTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置text组件背景色 + + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue white_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_NumberValue black_color_value[] = {{.u32 = 0xFF000000}}; + + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem white_color_item = {white_color_value, sizeof(white_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem black_color_item = {black_color_value, sizeof(black_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text2, NODE_BACKGROUND_COLOR, &white_color_item); + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &black_color_item); + + // 设置text组件偏移 + ArkUI_NumberValue upper_left_value[2] = {{.f32 = 50}, {.f32 = 50}}; + ArkUI_AttributeItem upper_left_value_item = {upper_left_value, + sizeof(upper_left_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_OFFSET, &upper_left_value_item); + + ArkUI_NumberValue lower_right_value[2] = {{.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem lower_right_value_item = {lower_right_value, + sizeof(lower_right_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_OFFSET, &lower_right_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextOffsetTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_offset_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_offset_test.h new file mode 100644 index 0000000000000000000000000000000000000000..21331b7599d1237bf5564b9c5fabf1e337f706e4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_offset_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_OFFSET_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_OFFSET_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextOffsetTest { +public: + ~TextOffsetTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_OFFSET_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_opacity_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_opacity_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c015d601be220a9400ea2d09fe1e98cb1582b1df --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_opacity_test.cpp @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_opacity_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextOpacityTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextOpacityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextOpacityTest", "GetContext env or info is null"); + return nullptr; + } + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建父容器节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置父容器组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + + // text组件放置父容器中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + + // 设置text组件背景色 + ArkUI_NumberValue black_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_AttributeItem black_color_item = {black_color_value, sizeof(black_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BACKGROUND_COLOR, &black_color_item); + nodeAPI->setAttribute(text2, NODE_BACKGROUND_COLOR, &black_color_item); + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &black_color_item); + nodeAPI->setAttribute(text4, NODE_BACKGROUND_COLOR, &black_color_item); + + ArkUI_NumberValue column_opacity_value[] = {{.f32 = 0.8}}; + ArkUI_AttributeItem column_opacity_value_item = {column_opacity_value, + sizeof(column_opacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_OPACITY, &column_opacity_value_item); + + // 设置text组件透明度 + ArkUI_NumberValue opacity_value[] = {{.f32 = 0.5}}; + ArkUI_AttributeItem opacity_value_item = {opacity_value, sizeof(opacity_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_OPACITY, &opacity_value_item); + + ArkUI_NumberValue boundary_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem boundary_value_item = {boundary_value, sizeof(boundary_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_OPACITY, &boundary_value_item); + + ArkUI_NumberValue boundary_valueTwo[] = {{.f32 = 0}}; + ArkUI_AttributeItem boundary_valueTwo_item = {boundary_valueTwo, + sizeof(boundary_valueTwo) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_OPACITY, &boundary_valueTwo_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_OPACITY, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextOpacityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_opacity_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_opacity_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6a1997c77d95831911543963ac448a62f2c195cd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_opacity_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_OPACITY_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_OPACITY_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextOpacityTest { +public: + ~TextOpacityTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_OPACITY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_overlay_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_overlay_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a081672f4e39b2067217129d83fc6b748ece57ad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_overlay_test.cpp @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_overlay_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextOverlayTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextOverlayTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextOverlayTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建column节点组件 + auto column1 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto column2 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column1, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column1, NODE_HEIGHT, &column_height_item); + nodeAPI->setAttribute(column2, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column2, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text7 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text8 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text9 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text10 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text11 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text12 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 120}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 120}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text6, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text7, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text8, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text9, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text10, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text11, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text12, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text7, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text8, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text9, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text10, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text11, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text12, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column1, text1); + nodeAPI->addChild(column1, text2); + nodeAPI->addChild(column1, text3); + nodeAPI->addChild(column1, text4); + nodeAPI->addChild(column1, text5); + nodeAPI->addChild(column1, text6); + + nodeAPI->addChild(column2, text7); + nodeAPI->addChild(column2, text8); + nodeAPI->addChild(column2, text9); + nodeAPI->addChild(column2, text10); + nodeAPI->addChild(column2, text11); + nodeAPI->addChild(column2, text12); + + nodeAPI->addChild(row, column1); + nodeAPI->addChild(row, column2); + + // 设置colum组件布局位置 + ArkUI_NumberValue right_value[4] = {{.f32 = 0}, {.f32 = 50}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_NumberValue left_value[4] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 50}}; + ArkUI_NumberValue offset_value[2] = {{.f32 = 0}, {.f32 = -200}}; + ArkUI_AttributeItem right_value_item = {right_value, sizeof(right_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem left_value_item = {left_value, sizeof(left_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem offset_value_item = {offset_value, sizeof(offset_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column1, NODE_MARGIN, &right_value_item); + nodeAPI->setAttribute(column2, NODE_MARGIN, &left_value_item); + nodeAPI->setAttribute(column1, NODE_OFFSET, &offset_value_item); + nodeAPI->setAttribute(column2, NODE_OFFSET, &offset_value_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text6, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text7, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text8, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text9, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text10, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text11, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text12, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件遮罩文本属性 + ArkUI_AttributeItem overlay_value_item = {}; + overlay_value_item.string = "A"; + nodeAPI->setAttribute(text1, NODE_OVERLAY, &overlay_value_item); + + ArkUI_NumberValue top_start_value[] = {{.i32 = ARKUI_ALIGNMENT_TOP_START}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem top_start_value_item = {top_start_value, sizeof(top_start_value) / sizeof(ArkUI_NumberValue)}; + top_start_value_item.string = "A"; + nodeAPI->setAttribute(text2, NODE_OVERLAY, &top_start_value_item); + + ArkUI_NumberValue top_value[] = {{.i32 = ARKUI_ALIGNMENT_TOP}}; + ArkUI_AttributeItem top_value_item = {top_value, sizeof(top_value) / sizeof(ArkUI_NumberValue)}; + top_value_item.string = "A"; + nodeAPI->setAttribute(text3, NODE_OVERLAY, &top_value_item); + + ArkUI_NumberValue top_end_value[] = {{.i32 = ARKUI_ALIGNMENT_TOP_END}}; + ArkUI_AttributeItem top_end_value_item = {top_end_value, sizeof(top_end_value) / sizeof(ArkUI_NumberValue)}; + top_end_value_item.string = "A"; + nodeAPI->setAttribute(text4, NODE_OVERLAY, &top_end_value_item); + + ArkUI_NumberValue start_value[] = {{.i32 = ARKUI_ALIGNMENT_START}}; + ArkUI_AttributeItem start_value_item = {start_value, sizeof(start_value) / sizeof(ArkUI_NumberValue)}; + start_value_item.string = "A"; + nodeAPI->setAttribute(text5, NODE_OVERLAY, &start_value_item); + + ArkUI_NumberValue center_value[] = {{.i32 = ARKUI_ALIGNMENT_CENTER}}; + ArkUI_AttributeItem center_value_value_item = {center_value, sizeof(center_value) / sizeof(ArkUI_NumberValue)}; + center_value_value_item.string = "A"; + nodeAPI->setAttribute(text6, NODE_OVERLAY, ¢er_value_value_item); + + ArkUI_NumberValue end_value[] = {{.i32 = ARKUI_ALIGNMENT_END}}; + ArkUI_AttributeItem end_value_item = {end_value, sizeof(end_value) / sizeof(ArkUI_NumberValue)}; + end_value_item.string = "A"; + nodeAPI->setAttribute(text7, NODE_OVERLAY, &end_value_item); + + ArkUI_NumberValue bottom_start_value[] = {{.i32 = ARKUI_ALIGNMENT_BOTTOM_START}}; + ArkUI_AttributeItem bottom_start_value_item = {bottom_start_value, + sizeof(bottom_start_value) / sizeof(ArkUI_NumberValue)}; + bottom_start_value_item.string = "A"; + nodeAPI->setAttribute(text8, NODE_OVERLAY, &bottom_start_value_item); + + ArkUI_NumberValue bottom_value[] = {{.i32 = ARKUI_ALIGNMENT_BOTTOM}}; + ArkUI_AttributeItem bottom_value_item = {bottom_value, sizeof(bottom_value) / sizeof(ArkUI_NumberValue)}; + bottom_value_item.string = "A"; + nodeAPI->setAttribute(text9, NODE_OVERLAY, &bottom_value_item); + + ArkUI_NumberValue bottom_end_value[] = {{.i32 = ARKUI_ALIGNMENT_BOTTOM_END}}; + ArkUI_AttributeItem bottom_end_value_item = {bottom_end_value, + sizeof(bottom_end_value) / sizeof(ArkUI_NumberValue)}; + bottom_end_value_item.string = "A"; + nodeAPI->setAttribute(text10, NODE_OVERLAY, &bottom_end_value_item); + + ArkUI_NumberValue largeOffset_value[] = {{.i32 = ARKUI_ALIGNMENT_TOP_START}, {.f32 = 1000}, {.f32 = 1000}}; + ArkUI_AttributeItem largeOffset_value_item = {largeOffset_value, + sizeof(largeOffset_value) / sizeof(ArkUI_NumberValue)}; + largeOffset_value_item.string = "A"; + nodeAPI->setAttribute(text11, NODE_OVERLAY, &largeOffset_value_item); + + ArkUI_NumberValue exception_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + exception_value_item.string = "A"; + nodeAPI->setAttribute(text12, NODE_OVERLAY, &exception_value_item); + + // text组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_overlay_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_overlay_test.h new file mode 100644 index 0000000000000000000000000000000000000000..091d9e75867334ff9d13d7ba35378df2e3facb1f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_overlay_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_OVERLAY_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_OVERLAY_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextOverlayTest { +public: + ~TextOverlayTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_OVERLAY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_padding_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_padding_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..95abafd62a70fc168a22b3039561ac1447232fa9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_padding_test.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_padding_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextPaddingTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPaddingTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPaddingTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + // 设置设column组件背景色 + ArkUI_NumberValue white_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem white_color_item = {white_color_value, sizeof(white_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BACKGROUND_COLOR, &white_color_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + + // 设置text背景色 + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue blue_value[] = {{.u32 = 0XFF0000FF}}; + ArkUI_AttributeItem blue_value_item = {blue_value, sizeof(blue_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue yellow_color_value[] = {{.u32 = 0XFFFFFF00}}; + ArkUI_AttributeItem yellow_color_value_item = {yellow_color_value, + sizeof(yellow_color_value) / sizeof(ArkUI_NumberValue)}; + + nodeAPI->setAttribute(text1, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text2, NODE_BACKGROUND_COLOR, &white_color_item); + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &blue_value_item); + nodeAPI->setAttribute(text4, NODE_BACKGROUND_COLOR, &yellow_color_value_item); + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "Padding test"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件内边距 + ArkUI_NumberValue padding_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem padding_value_item = {padding_value, sizeof(padding_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_PADDING, &padding_value_item); + + float topValue = 10; + float rightValue = 20; + float bottomValue = 30; + float leftValue = 40; + ArkUI_NumberValue value[4] = {{.f32 = topValue}, {.f32 = rightValue}, {.f32 = bottomValue}, {.f32 = leftValue}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_PADDING, &value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = -20}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_PADDING, &exception_value_item); + + ArkUI_NumberValue exceptionValue[4] = {{.f32 = -10}, {.f32 = -10}, {.f32 = -10}, {.f32 = -200}}; + ArkUI_AttributeItem exceptionValue_value_item = {exceptionValue, + sizeof(exceptionValue) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_PADDING, &exceptionValue_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPaddingTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_padding_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_padding_test.h new file mode 100644 index 0000000000000000000000000000000000000000..093e660edbae168833f5569f6f0c2197eb4983f6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_padding_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_PADDING_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_PADDING_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPaddingTest { +public: + ~TextPaddingTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_PADDING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_position_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_position_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..31081941ae4d540b51afe0125f8c1aa73cd170d7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_position_test.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_position_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextPositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPositionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPositionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置text组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + + // first text,设置position为{10,10} + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + ArkUI_NumberValue position_value[] = {{.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_POSITION, &position_item); + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text, NODE_HEIGHT, &height_item); + + // second text,设置position为{-10,-10} + auto text_second = nodeAPI->createNode(ARKUI_NODE_TEXT); + ArkUI_NumberValue position_second_value[] = {{.f32 = -10}, {.f32 = -10}}; + ArkUI_AttributeItem position_second_item = {position_second_value, + sizeof(position_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text_second, NODE_POSITION, &position_second_item); + nodeAPI->setAttribute(text_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(text_second, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text_second, NODE_HEIGHT, &height_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, text); + nodeAPI->insertChildAfter(column, text_second, text); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPositionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_position_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_position_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7c18fea8723b2042d2d1de85a1939110f4ce33bd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_position_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_POSITION_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_POSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPositionTest { +public: + ~TextPositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_POSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_radialgradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_radialgradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..66ced9823537073918f004b51f62ced8b237d6ca --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_radialgradient_test.cpp @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_radialgradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value TextRadialGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextRadialGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextRadialGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件径向颜色渐变 + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.3, 1}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue radialGradient_value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 0}}; + ArkUI_AttributeItem radialGradient_value_value_item = {radialGradient_value, + sizeof(radialGradient_value) / sizeof(ArkUI_NumberValue)}; + radialGradient_value_value_item.object = &colorStop; + nodeAPI->setAttribute(text1, NODE_RADIAL_GRADIENT, &radialGradient_value_value_item); + + unsigned int colors_object[] = {0xFFFFFFFF, 0xFF0000FF, 0xFF000000}; + float stops_object[] = {0.2, 0.5, 1}; + ArkUI_ColorStop colorStop_object = {colors_object, stops_object, 3}; + ArkUI_NumberValue threeColors_value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 0}}; + ArkUI_AttributeItem threeColors_value_item = {threeColors_value, + sizeof(threeColors_value) / sizeof(ArkUI_NumberValue)}; + threeColors_value_item.object = &colorStop_object; + nodeAPI->setAttribute(text2, NODE_RADIAL_GRADIENT, &threeColors_value_item); + + ArkUI_NumberValue repeat_value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 1}}; + ArkUI_AttributeItem repeat_value_item = {repeat_value, sizeof(repeat_value) / sizeof(ArkUI_NumberValue)}; + repeat_value_item.object = &colorStop; + nodeAPI->setAttribute(text3, NODE_RADIAL_GRADIENT, &repeat_value_item); + + unsigned int colors_exception[] = {1234, 1234}; + ArkUI_ColorStop exception_colorStop = {colors_exception, stops, 2}; + ArkUI_NumberValue value[] = {{.f32 = 25}, {.f32 = 25}, {.f32 = 25}, {.i32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.object = &exception_colorStop; + nodeAPI->setAttribute(text4, NODE_RADIAL_GRADIENT, &value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = -25}, {.f32 = -25}, {.f32 = -25}, {.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + exception_value_item.object = &colorStop; + nodeAPI->setAttribute(text5, NODE_RADIAL_GRADIENT, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextRadialGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_radialgradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_radialgradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b54c71d6e61c89f2dc9dbac5f264a3652dd9abbb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_radialgradient_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_RADIALGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_RADIALGRADIENT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextRadialGradientTest { +public: + ~TextRadialGradientTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_RADIALGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_scale_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_scale_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4379777d63e3c64aae9f43e6305a4918936431fe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_scale_test.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_scale_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextScaleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextScaleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextScaleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置text组件背景色 + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue white_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_NumberValue black_color_value[] = {{.u32 = 0xFF000000}}; + + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem white_color_item = {white_color_value, sizeof(white_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem black_color_item = {black_color_value, sizeof(black_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text2, NODE_BACKGROUND_COLOR, &white_color_item); + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &black_color_item); + // 设置text组件上边距 + ArkUI_NumberValue top_value[4] = {{.f32 = 30}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem top_value_item = {top_value, sizeof(top_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_MARGIN, &top_value_item); + + // 设置text组件缩放 + ArkUI_NumberValue exception_value[] = {{.f32 = -1}, {.f32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_SCALE, &exception_value_item); + + ArkUI_NumberValue narrow_value[] = {{.f32 = 0.5}, {.f32 = 0.5}}; + ArkUI_AttributeItem narrow_value_item = {narrow_value, sizeof(narrow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_SCALE, &narrow_value_item); + + ArkUI_NumberValue enlarge_value[] = {{.f32 = 2}, {.f32 = 2}}; + ArkUI_AttributeItem enlarge_value_item = {enlarge_value, sizeof(enlarge_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_SCALE, &enlarge_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextScaleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_scale_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_scale_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8da30d383b69a8616283714edab1fabfafa6a9ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_scale_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_SCALE_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_SCALE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextScaleTest { +public: + ~TextScaleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_SCALE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_shadow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_shadow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ef16136baef956fbf91acff1f395545cb855e5e0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_shadow_test.cpp @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_shadow_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextShadowTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column1 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto column2 = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column1, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column1, NODE_HEIGHT, &column_height_item); + nodeAPI->setAttribute(column2, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column2, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text6, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column1, text1); + nodeAPI->addChild(column1, text2); + nodeAPI->addChild(column1, text3); + nodeAPI->addChild(column2, text4); + nodeAPI->addChild(column2, text5); + nodeAPI->addChild(column2, text6); + + nodeAPI->addChild(row, column1); + nodeAPI->addChild(row, column2); + + // 设置text组件colum组件外边距 + ArkUI_NumberValue right_value[4] = {{.f32 = 0}, {.f32 = 50}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_NumberValue left_value[4] = {{.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 50}}; + ArkUI_NumberValue top_value[4] = {{.f32 = 100}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem right_value_item = {right_value, sizeof(right_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem left_value_item = {left_value, sizeof(left_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem top_value_item = {top_value, sizeof(top_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column1, NODE_MARGIN, &right_value_item); + nodeAPI->setAttribute(column2, NODE_MARGIN, &left_value_item); + nodeAPI->setAttribute(text2, NODE_MARGIN, &top_value_item); + nodeAPI->setAttribute(text5, NODE_MARGIN, &top_value_item); + nodeAPI->setAttribute(text3, NODE_MARGIN, &top_value_item); + nodeAPI->setAttribute(text6, NODE_MARGIN, &top_value_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text6, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件阴影 + + ArkUI_NumberValue default_xs_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS}}; + ArkUI_AttributeItem default_xs_value_item = {default_xs_value, + sizeof(default_xs_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_SHADOW, &default_xs_value_item); + + ArkUI_NumberValue default_sm_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM}}; + ArkUI_AttributeItem default_sm_value_item = {default_sm_value, + sizeof(default_sm_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_SHADOW, &default_sm_value_item); + + ArkUI_NumberValue default_md_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD}}; + ArkUI_AttributeItem default_md_value_item = {default_md_value, + sizeof(default_md_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_SHADOW, &default_md_value_item); + + ArkUI_NumberValue default_lg_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG}}; + ArkUI_AttributeItem default_lg_value_item = {default_lg_value, + sizeof(default_lg_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_SHADOW, &default_lg_value_item); + + ArkUI_NumberValue floating_sm_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM}}; + ArkUI_AttributeItem floating_sm_value_item = {floating_sm_value, + sizeof(floating_sm_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text5, NODE_SHADOW, &floating_sm_value_item); + + ArkUI_NumberValue floating_md_value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD}}; + ArkUI_AttributeItem floating_md_value_item = {floating_md_value, + sizeof(floating_md_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text6, NODE_SHADOW, &floating_md_value_item); + + ArkUI_NumberValue exception_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_SHADOW, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_shadow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_shadow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..33b790eec78b536336067d349fc42d276f56e1c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_shadow_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_SHADOW_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_SHADOW_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextShadowTest { +public: + ~TextShadowTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_SHADOW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_sweepgradient_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_sweepgradient_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..702440324f6fc6f93ee6fde7cfea53d6552f0380 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_sweepgradient_test.cpp @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_sweepgradient_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +napi_value TextSweepGradientTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextSweepGradientTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextSweepGradientTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件角度颜色渐变 + unsigned int colors[] = {0xFFFFFFFF, 0xFF0000FF}; + float stops[] = {0.3, 1}; + ArkUI_ColorStop colorStop = {colors, stops, 2}; + ArkUI_NumberValue sweepGradient_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, + {.f32 = 180}, {.f32 = 90}, {.i32 = 0}}; + ArkUI_AttributeItem sweepGradient_value_item = {sweepGradient_value, + sizeof(sweepGradient_value) / sizeof(ArkUI_NumberValue)}; + sweepGradient_value_item.object = &colorStop; + nodeAPI->setAttribute(text1, NODE_SWEEP_GRADIENT, &sweepGradient_value_item); + + unsigned int colors_object[] = {0xFFFFFFFF, 0xFF0000FF, 0xFF000000}; + float stops_object[] = {0.2, 0.5, 1}; + ArkUI_ColorStop colorStop_object = {colors_object, stops_object, 3}; + ArkUI_NumberValue threeColors_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, + {.f32 = 180}, {.f32 = 90}, {.i32 = 0}}; + ArkUI_AttributeItem threeColors_value_item = {threeColors_value, + sizeof(threeColors_value) / sizeof(ArkUI_NumberValue)}; + threeColors_value_item.object = &colorStop_object; + nodeAPI->setAttribute(text2, NODE_SWEEP_GRADIENT, &threeColors_value_item); + + ArkUI_NumberValue repeat_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, {.f32 = 180}, {.f32 = 90}, {.i32 = 1}}; + ArkUI_AttributeItem repeat_value_item = {repeat_value, sizeof(repeat_value) / sizeof(ArkUI_NumberValue)}; + repeat_value_item.object = &colorStop; + nodeAPI->setAttribute(text3, NODE_SWEEP_GRADIENT, &repeat_value_item); + + unsigned int colors_exception[] = {1234, 1234}; + ArkUI_ColorStop exception_colorStop = {colors_exception, stops, 2}; + ArkUI_NumberValue value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 0}, {.f32 = 180}, {.f32 = 90}, {.i32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.object = &exception_colorStop; + nodeAPI->setAttribute(text4, NODE_SWEEP_GRADIENT, &value_item); + + ArkUI_NumberValue exception_value[] = {{.f32 = -50}, {.f32 = -50}, {.f32 = -1}, + {.f32 = -180}, {.f32 = -90}, {.i32 = -1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + exception_value_item.object = &colorStop; + nodeAPI->setAttribute(text5, NODE_RADIAL_GRADIENT, &exception_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextSweepGradientTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_sweepgradient_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_sweepgradient_test.h new file mode 100644 index 0000000000000000000000000000000000000000..748e52425ccf25099978e2bd4d584d1674efbef1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_sweepgradient_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_SWEEPGRADIENT_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_SWEEPGRADIENT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextSweepGradientTest { +public: + ~TextSweepGradientTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_SWEEPGRADIENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textalign_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textalign_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3be023594c40f20ba195d814c6287487483e2c02 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textalign_test.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_textalign_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextTextAlignTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextAlignTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextAlignTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + ArkUI_AttributeItem text5_content_item = {}; + text5_content_item.string = "Test the textAlign property of the text component"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text5, NODE_TEXT_CONTENT, &text5_content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本对齐 + ArkUI_NumberValue exception_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_ALIGN, &exception_value_item); + + ArkUI_NumberValue textAlign_center_value[] = {{.i32 = ARKUI_TEXT_ALIGNMENT_CENTER}}; + ArkUI_AttributeItem textAlign_center_value_item = {textAlign_center_value, + sizeof(textAlign_center_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_ALIGN, &textAlign_center_value_item); + + ArkUI_NumberValue textAlign_end_value[] = {{.i32 = ARKUI_TEXT_ALIGNMENT_END}}; + ArkUI_AttributeItem textAlign_end_value_item = {textAlign_end_value, + sizeof(textAlign_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_ALIGN, &textAlign_end_value_item); + + ArkUI_NumberValue textalign_justify_value[] = {{.i32 = ARKUI_TEXT_ALIGNMENT_JUSTIFY}}; + ArkUI_AttributeItem textalign_justify_value_item = {textalign_justify_value, + sizeof(textalign_justify_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_TEXT_ALIGN, &textalign_justify_value_item); + + nodeAPI->setAttribute(text5, NODE_TEXT_ALIGN, &textalign_justify_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextAlignTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textalign_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textalign_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9033814a205758673f45938910762a51641516d9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textalign_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_TEXTALIGN_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_TEXTALIGN_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextTextAlignTest { +public: + ~TextTextAlignTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_TEXTALIGN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textcase_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textcase_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..21d2b90253a21315e418fa7d0ef29d1336eec193 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textcase_test.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_textcase_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextTextCaseTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextCaseTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextCaseTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "textCase test"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本大小写 + ArkUI_NumberValue exception_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_CASE, &exception_value_item); + + ArkUI_NumberValue lower_value[] = {{.i32 = ARKUI_TEXT_CASE_LOWER}}; + ArkUI_AttributeItem lower_value_item = {lower_value, sizeof(lower_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_CASE, &lower_value_item); + + ArkUI_NumberValue upper_value[] = {{.i32 = ARKUI_TEXT_CASE_UPPER}}; + ArkUI_AttributeItem upper_value_item = {upper_value, sizeof(upper_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_CASE, &upper_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextCaseTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textcase_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textcase_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d7ec0a1caa7d2d7bc3840cb726515ec823717181 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textcase_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_TEXTCASE_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_TEXTCASE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextTextCaseTest { +public: + ~TextTextCaseTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_TEXTCASE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textindent_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textindent_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..85187ed4f09d7da6f742c572dfd7ead7befdee0b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textindent_test.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_textindent_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextTextIndentTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextIndentTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextIndentTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文本首行缩进 + ArkUI_NumberValue exception_value[] = {{.f32 = -10}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_INDENT, &exception_value_item); + + ArkUI_NumberValue text_indent_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem text_indent_value_item = {text_indent_value, + sizeof(text_indent_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_INDENT, &text_indent_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextIndentTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textindent_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textindent_test.h new file mode 100644 index 0000000000000000000000000000000000000000..99a98b7a8f4da96e77cd8e4fc89e9baa87460d99 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textindent_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_TEXTINDENT_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_TEXTINDENT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextTextIndentTest { +public: + ~TextTextIndentTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_TEXTINDENT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textoverflow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textoverflow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6da440df941ef3f1ffe2ab1c9cc0b97e24a3defa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textoverflow_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_textoverflow_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextTextOverflowTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextOverflowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextOverflowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建7个个text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text6 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text7 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 250}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text6, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text7, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text6, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text7, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + nodeAPI->addChild(column, text6); + nodeAPI->addChild(column, text7); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "Test the textOverflow property of the C API"; + ArkUI_AttributeItem text_content_item = {}; + text_content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text5, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text6, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text7, NODE_TEXT_CONTENT, &text_content_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text6, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text7, NODE_BORDER_WIDTH, &borderWidth_value_item); + + /*设置text组件文本超长时的显示方式属性 + text1不设置,text2、text3设置None和Ellipsis但不设置maxLines,text4、text5设置None和Ellipsis和设置maxLines + text6设置子组件ImageSpan,text7设置textAlign两端对齐 + */ + ArkUI_NumberValue lines_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem lines_value_value_item = {lines_value, sizeof(lines_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_MAX_LINES, &lines_value_value_item); + ArkUI_NumberValue exception_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_OVERFLOW, &exception_value_item); + + ArkUI_NumberValue invalid_none_value[] = {{.i32 = ARKUI_TEXT_OVERFLOW_NONE}}; + ArkUI_AttributeItem invalid_none_value_item = {invalid_none_value, + sizeof(invalid_none_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_OVERFLOW, &invalid_none_value_item); + + ArkUI_NumberValue invalid_ellipsis_value[] = {{.i32 = ARKUI_TEXT_OVERFLOW_ELLIPSIS}}; + ArkUI_AttributeItem invalid_ellipsis_value_item = {invalid_ellipsis_value, + sizeof(invalid_ellipsis_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_OVERFLOW, &invalid_ellipsis_value_item); + + ArkUI_NumberValue effective_none_value[] = {{.i32 = ARKUI_TEXT_OVERFLOW_NONE}}; + ArkUI_AttributeItem effective_none_item = {effective_none_value, + sizeof(effective_none_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_TEXT_OVERFLOW, &effective_none_item); + + ArkUI_NumberValue effective_ellipsis_value[] = {{.i32 = ARKUI_TEXT_OVERFLOW_ELLIPSIS}}; + ArkUI_AttributeItem effective_ellipsis_value_item = {effective_ellipsis_value, + sizeof(effective_ellipsis_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text5, NODE_TEXT_OVERFLOW, &effective_ellipsis_value_item); + + nodeAPI->setAttribute(text4, NODE_TEXT_MAX_LINES, &lines_value_value_item); + nodeAPI->setAttribute(text5, NODE_TEXT_MAX_LINES, &lines_value_value_item); + + ArkUI_NumberValue marquee_value[] = {{.i32 = ARKUI_TEXT_OVERFLOW_MARQUEE}}; + ArkUI_AttributeItem marquee_value_item = {marquee_value, sizeof(marquee_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text6, NODE_TEXT_OVERFLOW, &marquee_value_item); + ArkUI_NumberValue text6_lines_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem text6_lines_value_item = {text6_lines_value, + sizeof(text6_lines_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text6, NODE_TEXT_MAX_LINES, &text6_lines_value_item); + + ArkUI_NumberValue textAlign_value[] = {{.i32 = ARKUI_TEXT_ALIGNMENT_END}}; + ArkUI_AttributeItem textAlign_value_item = {textAlign_value, sizeof(textAlign_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text6, NODE_TEXT_ALIGN, &textAlign_value_item); + + nodeAPI->setAttribute(text7, NODE_TEXT_OVERFLOW, &marquee_value_item); + nodeAPI->setAttribute(text7, NODE_TEXT_ALIGN, &textAlign_value_item); + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextOverflowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textoverflow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textoverflow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b2693076755c0c80b710e2467774701a05a8ed24 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textoverflow_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_TEXTOVERFLOW_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_TEXTOVERFLOW_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextTextOverflowTest { +public: + ~TextTextOverflowTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_TEXTOVERFLOW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textshadow_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textshadow_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a2a87d6a5e91fe0ea4234275113c5226caee85ac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textshadow_test.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_textshadow_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextTextShadowTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextShadowTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextShadowTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + + // 设置text组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TEXT"; + nodeAPI->setAttribute(text1, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text2, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text3, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text4, NODE_TEXT_CONTENT, &content_item); + nodeAPI->setAttribute(text5, NODE_TEXT_CONTENT, &content_item); + // 设置text组件文本字体大小 + ArkUI_NumberValue fontSize_value[] = {{.f32 = 40}}; + ArkUI_AttributeItem fontSize_value_item = {fontSize_value, sizeof(fontSize_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_FONT_SIZE, &fontSize_value_item); + nodeAPI->setAttribute(text1, NODE_FONT_SIZE, &fontSize_value_item); + nodeAPI->setAttribute(text2, NODE_FONT_SIZE, &fontSize_value_item); + nodeAPI->setAttribute(text3, NODE_FONT_SIZE, &fontSize_value_item); + nodeAPI->setAttribute(text4, NODE_FONT_SIZE, &fontSize_value_item); + nodeAPI->setAttribute(text5, NODE_FONT_SIZE, &fontSize_value_item); + + // 设置text组件边框 + ArkUI_NumberValue borderWidth_value[] = {{.f32 = 2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text2, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text3, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text4, NODE_BORDER_WIDTH, &borderWidth_value_item); + nodeAPI->setAttribute(text5, NODE_BORDER_WIDTH, &borderWidth_value_item); + + // 设置text组件文字阴影 + ArkUI_NumberValue exception_type_value[] = { + {.f32 = 30}, {.i32 = 1234}, {.u32 = 0xFF000000}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem exception_type_value_item = {exception_type_value, + sizeof(exception_type_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TEXT_TEXT_SHADOW, &exception_type_value_item); + + ArkUI_NumberValue blur_type_value[] = { + {.f32 = 30}, {.i32 = ARKUI_SHADOW_TYPE_BLUR}, {.u32 = 0xFFFF0000}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem blur_type_valuevalue_item = {blur_type_value, + sizeof(blur_type_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TEXT_TEXT_SHADOW, &blur_type_valuevalue_item); + + ArkUI_NumberValue color_type_value[] = { + {.f32 = 50}, {.i32 = ARKUI_SHADOW_TYPE_COLOR}, {.u32 = 0xFF000000}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem color_type_value_item = {color_type_value, + sizeof(color_type_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TEXT_TEXT_SHADOW, &color_type_value_item); + + ArkUI_NumberValue radius_exception_value[] = { + {.f32 = -10}, {.i32 = ARKUI_SHADOW_TYPE_COLOR}, {.u32 = 0xFF000000}, {.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem radius_exception_value_item = {radius_exception_value, + sizeof(radius_exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_TEXT_TEXT_SHADOW, &radius_exception_value_item); + + ArkUI_NumberValue offset_value[] = { + {.f32 = 20}, {.i32 = ARKUI_SHADOW_TYPE_COLOR}, {.u32 = 0xFF000000}, {.f32 = 40}, {.f32 = 40}}; + ArkUI_AttributeItem offset_value_item = {offset_value, sizeof(offset_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text5, NODE_TEXT_TEXT_SHADOW, &offset_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTextShadowTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textshadow_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textshadow_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3d6a7a725eac577ece55d4325c3eb834cefa83b5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_textshadow_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_TEXTSHADOW_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_TEXTSHADOW_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextTextShadowTest { +public: + ~TextTextShadowTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_TEXTSHADOW_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_transform_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_transform_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..837194803d79b94daa7afef7e119afdd41fdb8f7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_transform_test.cpp @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_transform_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextTransformTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTransformTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTransformTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + + // 设置text组件背景色 + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue white_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_NumberValue black_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_NumberValue yellow_color_value[] = {{.u32 = 0XFFFFFF00}}; + ArkUI_NumberValue blue_color_value[] = {{.u32 = 0XFF0000FF}}; + + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem white_color_item = {white_color_value, sizeof(white_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem black_color_item = {black_color_value, sizeof(black_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem yellow_color_item = {yellow_color_value, + sizeof(yellow_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem blue_color_item = {blue_color_value, sizeof(blue_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text2, NODE_BACKGROUND_COLOR, &white_color_item); + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &black_color_item); + nodeAPI->setAttribute(text4, NODE_BACKGROUND_COLOR, &yellow_color_item); + nodeAPI->setAttribute(text5, NODE_BACKGROUND_COLOR, &blue_color_item); + + // 设置text组件矩阵变换 + ArkUI_NumberValue matrix_value[] = {{.f32 = 0.5}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0.5}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, + {.f32 = 100}, {.f32 = 100}, {.f32 = 0}, {.f32 = 1}}; + ArkUI_AttributeItem matrix_value_item = {matrix_value, sizeof(matrix_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_TRANSFORM, &matrix_value_item); + + ArkUI_NumberValue exception_value[] = { + {.f32 = -1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = -1}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = -1}, {.f32 = 0}, {.f32 = -100}, {.f32 = -100}, {.f32 = 0}, {.f32 = 1}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_TRANSFORM, &exception_value_item); + + ArkUI_NumberValue rotateException_value[] = {{.f32 = static_cast(cos(45))}, + {.f32 = static_cast(-sin(45))}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = static_cast(sin(45))}, + {.f32 = static_cast(cos(45))}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 1}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 0}, + {.f32 = 1}}; + ArkUI_AttributeItem rotateException_value_item = {rotateException_value, + sizeof(rotateException_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_TRANSFORM, &rotateException_value_item); + + ArkUI_NumberValue translateException_value[] = { + {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, {.f32 = 1000}, {.f32 = 1000}, {.f32 = 0}, {.f32 = 1}}; + ArkUI_AttributeItem translateException_value_item = {translateException_value, + sizeof(translateException_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_TRANSFORM, &translateException_value_item); + + ArkUI_NumberValue boundaryException_value[] = { + {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, + {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}}; + ArkUI_AttributeItem boundaryException_value_item = {boundaryException_value, + sizeof(boundaryException_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text5, NODE_TRANSFORM, &boundaryException_value_item); + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextTransformTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_transform_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_transform_test.h new file mode 100644 index 0000000000000000000000000000000000000000..65004636b9e83dadaf5bbb05b2ea5e00225ec1be --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_transform_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_TRANSFORM_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_TRANSFORM_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextTransformTest { +public: + ~TextTransformTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_TRANSFORM_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_visibility_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_visibility_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..19c5e7cf6e57cea2b20986c0c0d02907f2a32e79 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_visibility_test.cpp @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_visibility_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextVisibilityTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextVisibilityTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextVisibilityTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // 设置column组件宽度和高度 + ArkUI_NumberValue column_width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem column_width_item = {column_width_value, + sizeof(column_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue column_height_value[] = {{.f32 = 350}}; + ArkUI_AttributeItem column_height_item = {column_height_value, + sizeof(column_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &column_width_item); + nodeAPI->setAttribute(column, NODE_HEIGHT, &column_height_item); + + // 创建text节点组件 + auto text1 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text2 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text3 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text4 = nodeAPI->createNode(ARKUI_NODE_TEXT); + auto text5 = nodeAPI->createNode(ARKUI_NODE_TEXT); + + // 设置text组件宽度和高度 + ArkUI_NumberValue width_value[] = {{.f32 = 150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text2, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text3, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text4, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text5, NODE_HEIGHT, &height_item); + nodeAPI->setAttribute(text1, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text2, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text3, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text4, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(text5, NODE_WIDTH, &width_item); + + // text组件放置父容器column中 + nodeAPI->addChild(column, text1); + nodeAPI->addChild(column, text2); + nodeAPI->addChild(column, text3); + nodeAPI->addChild(column, text4); + nodeAPI->addChild(column, text5); + + // 设置text组件背景色 + ArkUI_NumberValue red_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_NumberValue white_color_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_NumberValue black_color_value[] = {{.u32 = 0xFF000000}}; + ArkUI_NumberValue yellow_color_value[] = {{.u32 = 0XFFFFFF00}}; + ArkUI_NumberValue blue_color_value[] = {{.u32 = 0XFF0000FF}}; + + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem white_color_item = {white_color_value, sizeof(white_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem black_color_item = {black_color_value, sizeof(black_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem yellow_color_item = {yellow_color_value, + sizeof(yellow_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem blue_color_item = {blue_color_value, sizeof(blue_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_BACKGROUND_COLOR, &red_color_item); + nodeAPI->setAttribute(text2, NODE_BACKGROUND_COLOR, &white_color_item); + nodeAPI->setAttribute(text3, NODE_BACKGROUND_COLOR, &black_color_item); + nodeAPI->setAttribute(text4, NODE_BACKGROUND_COLOR, &yellow_color_item); + nodeAPI->setAttribute(text5, NODE_BACKGROUND_COLOR, &blue_color_item); + + // 设置text组件是否可见 + ArkUI_NumberValue exception_value[] = {{.i32 = -10}}; + ArkUI_AttributeItem exception_value_item = {exception_value, sizeof(exception_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text1, NODE_VISIBILITY, &exception_value_item); + + ArkUI_NumberValue visible_value[] = {{.i32 = ARKUI_VISIBILITY_VISIBLE}}; + ArkUI_AttributeItem visible_value_item = {visible_value, sizeof(visible_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text2, NODE_VISIBILITY, &visible_value_item); + + ArkUI_NumberValue hidden_value[] = {{.i32 = ARKUI_VISIBILITY_HIDDEN}}; + ArkUI_AttributeItem hidden_value_item = {hidden_value, sizeof(hidden_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text3, NODE_VISIBILITY, &hidden_value_item); + + ArkUI_NumberValue none_value[] = {{.i32 = ARKUI_VISIBILITY_NONE}}; + ArkUI_AttributeItem none_value_item = {none_value, sizeof(none_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text4, NODE_VISIBILITY, &none_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextVisibilityTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_visibility_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_visibility_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b734bfab9cdf504ba26ed1b26a5408bb5aa2dd0d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_visibility_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_VISIBILITY_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_VISIBILITY_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextVisibilityTest { +public: + ~TextVisibilityTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_VISIBILITY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7397e3026ae7c373a058705a5bd7b1902a022df1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_width_test.cpp @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "text_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置text组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置text组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first text + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->setAttribute(text, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(text, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(text, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // second text + auto text_second = nodeAPI->createNode(ARKUI_NODE_TEXT); + nodeAPI->setAttribute(text_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(text_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(text_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(text_second, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, text); + nodeAPI->insertChildAfter(column, text_second, text); + + // text组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextWidthTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为500 + auto text = nodeAPI->createNode(ARKUI_NODE_TEXT); + ArkUI_NumberValue width_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_WIDTH, &width_item); + + // 设置text组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置text组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(text, NODE_HEIGHT, &default_height_item); + + nodeAPI->addChild(column, text); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..438b993c9364f7c804175ad04719cdefbe00b85d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/text/text_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXT_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_TEXT_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextWidthTest { +public: + ~TextWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXT_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e6e48d0cb9ad7b6f4709e21c3d0845d562d1eef7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_backgroundcolor_test.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_backgroundcolor_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); +} + +napi_value TextAreaBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaBackgroundColorTest::CreateNativeNodeBlack(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaBackgroundColorTest::CreateNativeNodeWhite(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..58d2e42c3f1ce86f48a149c6fe1c0036cccdbff2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_backgroundcolor_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_BACKGROUND_COLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_BACKGROUND_COLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaBackgroundColorTest { +public: + ~TextAreaBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlack(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeWhite(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_BACKGROUND_COLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_borderradius_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_borderradius_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..04af4ce8d95e13d419afa4a6a81c755b0a1c691a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_borderradius_test.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_borderradius_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); +} + +napi_value TextAreaBorderRadiusTest::CreateNativeNodeSingle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 40}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BORDER_RADIUS, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaBorderRadiusTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = -100}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BORDER_RADIUS, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaBorderRadiusTest::CreateNativeNodeAllParam(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 10}, {.f32 = 40}, {.f32 = 10}, {.f32 = 40}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BORDER_RADIUS, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_borderradius_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_borderradius_test.h new file mode 100644 index 0000000000000000000000000000000000000000..81b4aa917d66514a56d81efd2f37f5031caa10ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_borderradius_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_BORDER_RADIUS_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_BORDER_RADIUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaBorderRadiusTest { +public: + ~TextAreaBorderRadiusTest(); + static napi_value CreateNativeNodeSingle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAllParam(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_BORDER_RADIUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_caretcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_caretcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..497d1f9d40d3b53b62fdd8990eb19949f214367b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_caretcolor_test.cpp @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_caretcolor_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 400}}; + ArkUI_NumberValue height_value[] = {{.f32 = 400}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextAreaCaretColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_CARET_COLOR, &item); + + ArkUI_AttributeItem strItem; + strItem.string = "TextCaretColor"; + nodeAPI->setAttribute(textArea, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaCaretColorTest::CreateNativeNodeBlack(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_CARET_COLOR, &item); + + ArkUI_AttributeItem strItem; + strItem.string = "TextCaretColor"; + nodeAPI->setAttribute(textArea, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaCaretColorTest::CreateNativeNodeWhite(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_CARET_COLOR, &item); + + ArkUI_AttributeItem strItem; + strItem.string = "TextCaretColor"; + nodeAPI->setAttribute(textArea, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_caretcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_caretcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..70de5c751fc9eb3c8e138eaef15b06ea6c48527f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_caretcolor_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_CARETCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_CARETCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaCaretColorTest { +public: + ~TextAreaCaretColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlack(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeWhite(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_CARETCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_defaultfocus_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_defaultfocus_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7e0ded10936a8e9a270c139c6da37e1472cf7a43 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_defaultfocus_test.cpp @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_defaultfocus_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle compare; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + compare = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + + nodeAPI->setAttribute(compare, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(compare, NODE_HEIGHT, &height_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "TextAreaDefaultFocus"; + nodeAPI->setAttribute(textArea, NODE_ID, &id_item); + id_item.string = "CompareDefaultFocus"; + nodeAPI->setAttribute(compare, NODE_ID, &id_item); + + ArkUI_NumberValue caret_color_value[] = {{.u32 = 0x00000000}}; + ArkUI_AttributeItem caret_color_item = {caret_color_value, sizeof(caret_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_INPUT_CARET_COLOR, &caret_color_item); + nodeAPI->setAttribute(compare, NODE_TEXT_INPUT_CARET_COLOR, &caret_color_item); + nodeAPI->registerNodeEvent(textArea, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(compare, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + nodeAPI->addChild(column, textArea); + nodeAPI->addChild(column, compare); +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextAreaDefaultFocusTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaDefaultFocusTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextAreaDefaultFocusTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_FOCUS_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +napi_value TextAreaDefaultFocusTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = 0}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_DEFAULT_FOCUS, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaDefaultFocusTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = 1}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_DEFAULT_FOCUS, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaDefaultFocusTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaDefaultFocusTest::CreateNativeNodeSingle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 参考组件设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = 1}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(compare, NODE_DEFAULT_FOCUS, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaDefaultFocusTest::CreateNativeNodeMulti(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 参考组件设置textArea测试属性 + ArkUI_NumberValue compare_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem compare_item = {compare_value, sizeof(compare_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(compare, NODE_DEFAULT_FOCUS, &compare_item); + + // 目标组件设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = 1}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_DEFAULT_FOCUS, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaDefaultFocusTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = -10}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_DEFAULT_FOCUS, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_defaultfocus_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_defaultfocus_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5da8bfea40e5f1ac60bd55ae287f05e9a7c7dfea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_defaultfocus_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_DEFAULTFOCUS_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_DEFAULTFOCUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaDefaultFocusTest { +public: + ~TextAreaDefaultFocusTest(); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSingle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMulti(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_DEFAULTFOCUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_enabled_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_enabled_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f53762ca5655191723ac0e70bd08ae87ef672fe9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_enabled_test.cpp @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textarea_enabled_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int enabled, const char *id, bool isRegOnFocusFlag) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + // set id + ArkUI_AttributeItem id_item = {}; + id_item.string = id; + nodeAPI->setAttribute(nodeHandle, NODE_ID, &id_item); + + // set background color + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + // set width + ArkUI_NumberValue width_value[] = {{.f32 = TEXTAREA_WIDTH_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // set height + ArkUI_NumberValue height_value[] = {{.f32 = TEXTAREA_HEIGHT_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + // set keyboard + ArkUI_NumberValue keyboard_value[] = {{.i32 = PARAM_0}}; + ArkUI_AttributeItem keyboard_item = {keyboard_value, sizeof(keyboard_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + if (isRegOnFocusFlag) { + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + } + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextAreaEnabledTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaEnabledTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + uint32_t color = COLOR_PURPLE; + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + switch (eventId) { + case ON_CLICK_EVENT_ID: + color = COLOR_GREEN; + break; + case ON_FOCUS_EVENT_ID: + color = COLOR_BLUE; + break; + case ON_BLUR_EVENT_ID: + color = COLOR_YELLOW; + break; + default: + break; + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + + // 点击事件时,关闭弹出的输入法 + if (eventId == ON_CLICK_EVENT_ID) { + ArkUI_NumberValue text_area_editing_value[] = {{.i32 = PARAM_0}}; + ArkUI_AttributeItem text_area_editing_item = {text_area_editing_value, + sizeof(text_area_editing_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_TEXT_AREA_EDITING, &text_area_editing_item); + } +} + +napi_value TextAreaEnabledTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaEnabledTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaEnabledTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // enabled text + auto text_area_click = createChildNode(nodeAPI, PARAM_1, "OnClickEnabledTextArea", false); + auto text_area_focus = createChildNode(nodeAPI, PARAM_1, "OnFocusEnabledTextArea", true); + auto text_area_blur = createChildNode(nodeAPI, PARAM_1, "OnBlurEnabledTextArea", true); + + // disabled text + auto text_area_disabled_click = createChildNode(nodeAPI, PARAM_0, "OnClickDisabledTextArea", false); + auto text_area_disabled_focus = createChildNode(nodeAPI, PARAM_0, "OnFocusDisabledTextArea", true); + auto text_area_disabled_blur = createChildNode(nodeAPI, PARAM_0, "OnBlurDisabledTextArea", true); + + // abnormal text + auto text_area_abnormal_click = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnClickAbnormalTextArea", false); + auto text_area_abnormal_focus = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnFocusAbnormalTextArea", true); + auto text_area_abnormal_blur = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnBlurAbnormalTextArea", true); + + // set row height + ArkUI_NumberValue row_height_value[] = {{.f32 = ROW_HEIGHT_110}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + + // set row width + ArkUI_NumberValue row_width_value[] = {{.f32 = ROW_WIDTH_350}}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + + // set row alignment + ArkUI_NumberValue row_justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem row_justify_content_item = {row_justify_content_value, + sizeof(row_justify_content_value) / sizeof(ArkUI_NumberValue)}; + + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_first, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + nodeAPI->addChild(row_first, text_area_click); + nodeAPI->insertChildAfter(row_first, text_area_focus, text_area_click); + nodeAPI->insertChildAfter(row_first, text_area_blur, text_area_focus); + + nodeAPI->addChild(row_second, text_area_disabled_click); + nodeAPI->insertChildAfter(row_second, text_area_disabled_focus, text_area_disabled_click); + nodeAPI->insertChildAfter(row_second, text_area_disabled_blur, text_area_disabled_focus); + + nodeAPI->addChild(row_third, text_area_abnormal_click); + nodeAPI->insertChildAfter(row_third, text_area_abnormal_focus, text_area_abnormal_click); + nodeAPI->insertChildAfter(row_third, text_area_abnormal_blur, text_area_abnormal_focus); + + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + + // Bind click event + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_enabled_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_enabled_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3bcc0555b03ce7c313781535788d20d734331fbd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_enabled_test.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_ENABLED_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_ENABLED_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +#define COLUMN_HEIGHT_700 700 +#define COLUMN_WIDTH_150 150 + +#define ROW_HEIGHT_110 110 +#define ROW_WIDTH_350 350 + +#define TEXTAREA_HEIGHT_100 100 +#define TEXTAREA_WIDTH_100 100 + +#define FOCUSABLE_TRUE 1 + +class TextAreaEnabledTest { +public: + ~TextAreaEnabledTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_ENABLED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6f614cfce77e6598df4367a62a29cb4d497ca3dd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontcolor_test.cpp @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_fontcolor_test.h" + +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); +} + +napi_value TextAreaFontColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_FONT_COLOR, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaFontColorTest::CreateNativeNodeBlack(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_FONT_COLOR, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaFontColorTest::CreateNativeNodeWhite(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_FONT_COLOR, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2d8beb7cbad5518122fff68c95b993a880f0b3af --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontcolor_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_FONTCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_FONTCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaFontColorTest { +public: + ~TextAreaFontColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlack(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeWhite(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_FONTCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontfamily_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontfamily_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f4b34e9b2b20da19004db0e234bffe6387bf3f3e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontfamily_test.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_fontfamily_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextAreaFontFamilyTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_AttributeItem item; + item.string = "HarmonyOS Sans"; + nodeAPI->setAttribute(textArea, NODE_FONT_FAMILY, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaFontFamilyTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_AttributeItem item; + item.string = ""; + nodeAPI->setAttribute(textArea, NODE_FONT_FAMILY, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontfamily_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontfamily_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e0c7edfc0a71c7bd3ca0e5d7890ab7a54b0b4a2c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontfamily_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_FONTFAMILY_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_FONTFAMILY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaFontFamilyTest { +public: + ~TextAreaFontFamilyTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_FONTFAMILY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontsize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontsize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..43cbd4365b881dd49d355da15a0bc49b9d847a58 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontsize_test.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_fontsize_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextAreaFontSizeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 30}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_FONT_SIZE, &value_item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaFontSizeTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 0}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_FONT_SIZE, &value_item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaFontSizeTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = -100}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_FONT_SIZE, &value_item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontsize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontsize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..528e7e459cf2b166aa3162070a283025c0e8bf57 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontsize_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_FONTSIZE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_FONTSIZE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaFontSizeTest { +public: + ~TextAreaFontSizeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_FONTSIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3301b942583e7a99c5cd9dd5a83a5123d8434a71 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontstyle_test.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_fontstyle_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextAreaFontStyleTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_FONT_STYLE_NORMAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_FONT_STYLE, &value_item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaFontStyleTest::CreateNativeNodeItalic(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_FONT_STYLE_ITALIC}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_FONT_STYLE, &value_item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..84917d9664c146f1659c0b00a963a385367ab977 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontstyle_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_FONTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_FONTSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaFontStyleTest { +public: + ~TextAreaFontStyleTest(); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeItalic(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_FONTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontweight_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontweight_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..48087d5097c87c04620f65e2979ac25507ae6b5b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontweight_test.cpp @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_fontweight_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 +#define PARAM_9 9 +#define PARAM_10 10 +#define PARAM_11 11 +#define PARAM_12 12 +#define PARAM_13 13 +#define PARAM_14 14 +#define PARAM_15 15 +#define PARAM_16 16 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; +static int32_t testType; +static int32_t fontWeight; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextAreaFontWeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_FONT_WEIGHT_W200}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_FONT_WEIGHT, &value_item); + + column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textArea); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaFontWeightTest::ChangeType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignItemsTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + + nodeAPI->removeChild(column, textArea); + switch (testType) { + case PARAM_1: + fontWeight = ARKUI_FONT_WEIGHT_W100; + break; + case PARAM_2: + fontWeight = ARKUI_FONT_WEIGHT_W200; + break; + case PARAM_3: + fontWeight = ARKUI_FONT_WEIGHT_W300; + break; + case PARAM_4: + fontWeight = ARKUI_FONT_WEIGHT_W400; + break; + case PARAM_5: + fontWeight = ARKUI_FONT_WEIGHT_W500; + break; + case PARAM_6: + fontWeight = ARKUI_FONT_WEIGHT_W600; + break; + case PARAM_7: + fontWeight = ARKUI_FONT_WEIGHT_W700; + break; + case PARAM_8: + fontWeight = ARKUI_FONT_WEIGHT_W800; + break; + case PARAM_9: + fontWeight = ARKUI_FONT_WEIGHT_W900; + break; + case PARAM_10: + fontWeight = ARKUI_FONT_WEIGHT_BOLD; + break; + case PARAM_11: + fontWeight = ARKUI_FONT_WEIGHT_NORMAL; + break; + case PARAM_12: + fontWeight = ARKUI_FONT_WEIGHT_BOLDER; + break; + case PARAM_13: + fontWeight = ARKUI_FONT_WEIGHT_LIGHTER; + break; + case PARAM_14: + fontWeight = ARKUI_FONT_WEIGHT_MEDIUM; + break; + case PARAM_15: + fontWeight = ARKUI_FONT_WEIGHT_REGULAR; + break; + case PARAM_16: + fontWeight = -100; + break; + default: + + break; + } + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = fontWeight}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_FONT_WEIGHT, &value_item); + nodeAPI->addChild(column, textArea); + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontweight_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontweight_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9828fd28a7bcc2ea29acac4eb839f94de896d170 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_fontweight_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_FONTWEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_FONTWEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaFontWeightTest { +public: + ~TextAreaFontWeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value ChangeType(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_FONTWEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..935d31ab9276bdafd38627dbf94ebc7f6f84cec4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_height_test.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textarea_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAreaHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textarea组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textarea组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // first textarea,设置高度为200 + auto textarea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->setAttribute(textarea, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textarea, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textarea, NODE_HEIGHT, &default_height_item); + + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea, NODE_HEIGHT, &height_item); + + // second textarea,设置高度为异常值 + auto textarea_second = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->setAttribute(textarea_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textarea_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textarea_second, NODE_HEIGHT, &default_height_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textarea); + nodeAPI->insertChildAfter(column, textarea_second, textarea); + + // 设置父column的高为500vp,子组件间隔对齐 + ArkUI_NumberValue col_height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAreaHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置高度为超大值500 + auto textarea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue height_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea, NODE_HEIGHT, &height_item); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置textarea组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea, NODE_WIDTH, &default_width_item); + + nodeAPI->addChild(column, textarea); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3bd64e95365d4d8ed9219f2f52ed450c02d65210 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaHeightTest { +public: + ~TextAreaHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_key_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_key_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fd3eefe0d62a45c08c17c8b159bb3b1aac6be29e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_key_test.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_key_test.h" + +#define PARAM_LENGTH 200 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle textAreaCompare; +static ArkUI_NodeHandle row; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t background_color = COLOR_YELLOW; + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextAreaKeyTest", "OnEventReceive eventId: %{public}d", eventId); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_CLICK_EVENT_ID) { + background_color = COLOR_RED; + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +static void BasicSet() +{ + row = nodeAPI->createNode(ARKUI_NODE_ROW); + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_NumberValue height_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "TARGET"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + + textAreaCompare = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue compare_width_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_NumberValue compare_height_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_AttributeItem compare_width_item = {compare_width_value, + sizeof(compare_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem compare_height_item = {compare_height_value, + sizeof(compare_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textAreaCompare, NODE_WIDTH, &compare_width_item); + nodeAPI->setAttribute(textAreaCompare, NODE_HEIGHT, &compare_height_item); + + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textAreaCompare, NODE_BACKGROUND_COLOR, &color_item); + + ArkUI_AttributeItem compare_place_holder_item; + compare_place_holder_item.string = "COMPARE"; + nodeAPI->setAttribute(textAreaCompare, NODE_TEXT_AREA_TEXT, &compare_place_holder_item); + + ArkUI_NumberValue value[] = {{.i32 = true}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textAreaCompare, NODE_DEFAULT_FOCUS, &item); + + ArkUI_AttributeItem idItem = {}; + idItem.string = "TextAreaKey"; + nodeAPI->setAttribute(textArea, NODE_ID, &idItem); + + ArkUI_AttributeItem idCompareItem = {}; + idCompareItem.string = "TextAreaOnFocusCompare"; + nodeAPI->setAttribute(textAreaCompare, NODE_ID, &idCompareItem); +} + +napi_value TextAreaKeyTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + ArkUI_NumberValue value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &item); + + ArkUI_NumberValue focus[] = {{.i32 = true}}; + ArkUI_AttributeItem focus_item = {focus, sizeof(focus) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_DEFAULT_FOCUS, &focus_item); + + nodeAPI->addChild(row, textAreaCompare); + nodeAPI->addChild(row, textArea); + + nodeAPI->registerNodeEvent(textArea, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string idrow(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idrow), row); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_key_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_key_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2cfdc0c7c63461c1ff5dacb05e909b5299ff6c11 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_key_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_KEY_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_KEY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaKeyTest { +public: + ~TextAreaKeyTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_KEY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_lineheight_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_lineheight_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e63273f79b38a726cd1689f1cea8465bec073fe8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_lineheight_test.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_lineheight_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); +} + +napi_value TextAreaLineHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT,node textArea text"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 100}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_LINE_HEIGHT, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaLineHeightTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT,node textArea text"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 0}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_LINE_HEIGHT, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_lineheight_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_lineheight_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5efbf82fd5d1c512d91f8f9388bf0ef4869d7f54 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_lineheight_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_LINEHEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_LINEHEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaLineHeightTest { +public: + ~TextAreaLineHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_LINEHEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_maxlength_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_maxlength_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aa37740a0c25c83da4d757787161fdeb8aac6620 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_maxlength_test.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_maxlength_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT,NODE_TEXT_AREA_TEXT,NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextAreaMaxLengthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = 10}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_MAX_LENGTH, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaMaxLengthTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = 0}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_MAX_LENGTH, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaMaxLengthTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = -100}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_MAX_LENGTH, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_maxlength_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_maxlength_test.h new file mode 100644 index 0000000000000000000000000000000000000000..cbd538c2a80c63f25393f6fd19143d7f6bb9e721 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_maxlength_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_MAXLENGTH_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_MAXLENGTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaMaxLengthTest { +public: + ~TextAreaMaxLengthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_MAXLENGTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onblur_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onblur_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..428f5443b69183a5f6df367b7a959af9b9f0bd89 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onblur_test.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_onblur_test.h" + +#define PARAM_LENGTH 200 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle textAreaCompare; +static ArkUI_NodeHandle row; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t background_color = COLOR_YELLOW; + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextAreaOnBlurTest", "OnEventReceive eventId: %{public}d", + eventId); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_BLUR_EVENT_ID) { + background_color = COLOR_RED; + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +static void BasicSet() +{ + row = nodeAPI->createNode(ARKUI_NODE_ROW); + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_NumberValue height_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "TARGET"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + + textAreaCompare = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue compare_width_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_NumberValue compare_height_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_AttributeItem compare_width_item = {compare_width_value, + sizeof(compare_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem compare_height_item = {compare_height_value, + sizeof(compare_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textAreaCompare, NODE_WIDTH, &compare_width_item); + nodeAPI->setAttribute(textAreaCompare, NODE_HEIGHT, &compare_height_item); + + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textAreaCompare, NODE_BACKGROUND_COLOR, &color_item); + + ArkUI_AttributeItem compare_place_holder_item; + compare_place_holder_item.string = "COMPARE"; + nodeAPI->setAttribute(textAreaCompare, NODE_TEXT_AREA_TEXT, &compare_place_holder_item); + + ArkUI_NumberValue value[] = {{.i32 = true}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textAreaCompare, NODE_DEFAULT_FOCUS, &item); + + ArkUI_AttributeItem idItem = {}; + idItem.string = "TextAreaOnBlur"; + nodeAPI->setAttribute(textArea, NODE_ID, &idItem); + + ArkUI_AttributeItem idCompareItem = {}; + idCompareItem.string = "TextAreaOnFocusCompare"; + nodeAPI->setAttribute(textAreaCompare, NODE_ID, &idCompareItem); +} + +napi_value TextAreaOnBlurTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + ArkUI_NumberValue value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &item); + + ArkUI_NumberValue focus[] = {{.i32 = true}}; + ArkUI_AttributeItem focus_item = {focus, sizeof(focus) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_DEFAULT_FOCUS, &focus_item); + + nodeAPI->addChild(row, textAreaCompare); + nodeAPI->addChild(row, textArea); + + nodeAPI->registerNodeEvent(textArea, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string idrow(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idrow), row); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onblur_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onblur_test.h new file mode 100644 index 0000000000000000000000000000000000000000..dac0a083796d82015e2465ab60dd4bd41d35d745 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onblur_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_ONBLUR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_ONBLUR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaOnBlurTest { +public: + ~TextAreaOnBlurTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_ONBLUR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onchange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onchange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f0bec7476b8a2dce2a3dc717567212bdd68899f0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onchange_test.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_onchange_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 当触发刷新事件时 将组件背景颜色设置为黄色,默认是红色 + if (ON_CHANGE_EVENT_ID == eventId) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_PLACEHOLDER, &place_holder_item); +} + +napi_value TextAreaOnChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + nodeAPI->registerNodeEvent(textArea, NODE_TEXT_AREA_ON_CHANGE, ON_CHANGE_EVENT_ID, nullptr); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onchange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onchange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e8bcb9ef11422d7a3287f751f3d55f0455df87ba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onchange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_ONCHANGE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_ONCHANGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaOnChangeTest { +public: + ~TextAreaOnChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_ONCHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onfocus_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onfocus_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..605081a36774bd41b6d3f7af2a5de9999c113e48 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onfocus_test.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_onfocus_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle textAreaCompare; +static ArkUI_NodeHandle row; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t background_color = 0xFF0000FF; + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextAreaOnFocusTest", "OnEventReceive eventId: %{public}d", + eventId); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 如果是触摸事件 + if (eventId == ON_FOCUS_EVENT_ID) { + // 修改组件背景色 + background_color = 0xFF0000FF; + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +static void BasicSet() +{ + row = nodeAPI->createNode(ARKUI_NODE_ROW); + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + + // 对照组件 先获取焦点并设置基础属性 + textAreaCompare = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue compare_width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue compare_height_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem compare_width_item = {compare_width_value, + sizeof(compare_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem compare_height_item = {compare_height_value, + sizeof(compare_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textAreaCompare, NODE_WIDTH, &compare_width_item); + nodeAPI->setAttribute(textAreaCompare, NODE_HEIGHT, &compare_height_item); + + // 设置对照组件背景颜色 + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textAreaCompare, NODE_BACKGROUND_COLOR, &color_item); + + // 设置对照组件默认获焦点 + ArkUI_NumberValue value[] = {{.i32 = true}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textAreaCompare, NODE_DEFAULT_FOCUS, &item); + + // 设置textAreaId,用于点击组件获焦触发onfocus事件 + ArkUI_AttributeItem idItem = {}; + idItem.string = "TextAreaOnFocus"; + nodeAPI->setAttribute(textArea, NODE_ID, &idItem); + + // 设置textAreaId,用于点击参考组件获焦触发onfocus事件 + ArkUI_AttributeItem idCompareItem = {}; + idCompareItem.string = "TextAreaOnFocusCompare"; + nodeAPI->setAttribute(textAreaCompare, NODE_ID, &idCompareItem); +} + +napi_value TextAreaOnFocusTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &item); + + nodeAPI->addChild(row, textAreaCompare); + nodeAPI->addChild(row, textArea); + + // 绑定获焦事件 + nodeAPI->registerNodeEvent(textArea, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 挂载组件 + std::string idrow(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idrow), row); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onfocus_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onfocus_test.h new file mode 100644 index 0000000000000000000000000000000000000000..91eb87f4223314f93ba81bf81b35ee26fa6d9106 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_onfocus_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_ONFOCUS_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_ONFOCUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaOnFocusTest { +public: + ~TextAreaOnFocusTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_ONFOCUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_padding_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_padding_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2153ab3bf343f98cab73c8501dfc3ecb0693ac22 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_padding_test.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_padding_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "Padding Test"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextAreaPaddingTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 0}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_PADDING, &item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "PADDING_TEXT_FOR_SINGLE_PARAM"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaPaddingTest::CreateNativeNodeAll(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 50}, {.f32 = 20}, {.f32 = 30}, {.f32 = 40}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_PADDING, &item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "PADDING_TEXT_FOR_ALL_PARAM"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_padding_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_padding_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f2bb6a94a09f44bc78ed6ec85ba192b2f470a98e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_padding_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_PADDING_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_PADDING_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaPaddingTest { +public: + ~TextAreaPaddingTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAll(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_PADDING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholdercolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholdercolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..55b84b1f1452838cfd6b250113df51b170036263 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholdercolor_test.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_placeholdercolor_test.h" + +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_PLACEHOLDER, &place_holder_item); +} + +napi_value TextAreaPlaceHolderColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_PLACEHOLDER_COLOR, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaPlaceHolderColorTest::CreateNativeNodeBlack(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_PLACEHOLDER_COLOR, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaPlaceHolderColorTest::CreateNativeNodeWhite(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_PLACEHOLDER_COLOR, &item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholdercolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholdercolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d8e137e39d9e129bc578b5b08fb0f19fc62739d0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholdercolor_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_PLACEHOLDERCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_PLACEHOLDERCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaPlaceHolderColorTest { +public: + ~TextAreaPlaceHolderColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlack(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeWhite(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_PLACEHOLDERCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholderfont_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholderfont_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..85a410d5f647749472c4f5c5b2b889e99666b1cf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholderfont_test.cpp @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea/textarea_placeholderfont_test.h" +#include + +#define STR_TEXT "TEXT; TEXT1, TEXT2" +#define CHANGETYPEID 6666 +#define FONT_SIZE 16.0 +#define PARAM_9 9 +#define PARAM_10 10 +#define PARAM_11 11 +#define PARAM_12 12 +#define PARAM_13 13 +#define PARAM_14 14 +#define PARAM_15 15 +#define PARAM_16 16 +#define PARAM_17 17 +#define PARAM_18 18 +#define PARAM_19 19 +#define PARAM_20 20 + +namespace ArkUICApiDemo { + +static int32_t testType; +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; +static char xComponentID[PARAM_64]; +static float PARAM_SIZE; +static int PARAM_STYLE; +static int PARAM_WEIGHT; +static uInt COLOR; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_INPUT_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextAreaPlaceholderFontTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 16}, {.i32 = ARKUI_FONT_STYLE_NORMAL}, {.i32 = ARKUI_FONT_WEIGHT_NORMAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = STR_TEXT; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_PLACEHOLDER_FONT, &item); + + nodeAPI->addChild(column, textArea); + + // 挂载组件 + std::string idColumn(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idColumn), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaPlaceholderFontTest::ChangeType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextAreaPlaceholderFontTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + nodeAPI->removeChild(column, textArea); + switch (testType) { + case PARAM_1: + PARAM_SIZE = FONT_SIZE; + PARAM_STYLE = ARKUI_FONT_STYLE_NORMAL; + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_NORMAL; + COLOR = COLOR_RED; + break; + case PARAM_2: + PARAM_SIZE = 0; + PARAM_STYLE = ARKUI_FONT_STYLE_NORMAL; + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_NORMAL; + COLOR = COLOR_YELLOW; + break; + case PARAM_3: + PARAM_SIZE = FONT_SIZE; + COLOR = COLOR_RED; + break; + case PARAM_4: + PARAM_SIZE = FONT_SIZE; + COLOR = COLOR_YELLOW; + break; + case PARAM_5: + COLOR = COLOR_RED; + break; + case PARAM_6: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W100; + COLOR = COLOR_YELLOW; + break; + case PARAM_7: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W200; + COLOR = COLOR_RED; + break; + case PARAM_8: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W300; + COLOR = COLOR_YELLOW; + break; + case PARAM_9: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W400; + COLOR = COLOR_RED; + break; + case PARAM_10: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W500; + COLOR = COLOR_YELLOW; + break; + case PARAM_11: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W600; + COLOR = COLOR_RED; + break; + case PARAM_12: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W700; + COLOR = COLOR_YELLOW; + break; + case PARAM_13: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W800; + COLOR = COLOR_RED; + break; + case PARAM_14: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W900; + COLOR = COLOR_YELLOW; + break; + case PARAM_15: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_BOLD; + COLOR = COLOR_RED; + break; + case PARAM_16: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_NORMAL; + COLOR = COLOR_YELLOW; + break; + case PARAM_17: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_BOLDER; + COLOR = COLOR_RED; + break; + case PARAM_18: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_LIGHTER; + COLOR = COLOR_YELLOW; + break; + case PARAM_19: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_MEDIUM; + COLOR = COLOR_RED; + break; + case PARAM_20: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_REGULAR; + COLOR = COLOR_YELLOW; + break; + default: + break; + } + + nodeAPI->addChild(column, textArea); + if (PARAM_3 == testType || PARAM_4 == testType) { + ArkUI_NumberValue value[] = {{.f32 = PARAM_SIZE}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = STR_TEXT; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_PLACEHOLDER_FONT, &value_item); + } else if (PARAM_5 == testType) { + ArkUI_NumberValue value[] = {}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = STR_TEXT; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_PLACEHOLDER_FONT, &value_item); + } else if (PARAM_6 <= testType) { + ArkUI_NumberValue value[] = {{.f32 = PARAM_0}, {.i32 = ARKUI_FONT_STYLE_ITALIC}, {.i32 = PARAM_WEIGHT}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = STR_TEXT; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_PLACEHOLDER_FONT, &value_item); + } else { + ArkUI_NumberValue value[] = { + {.f32 = PARAM_SIZE}, {.i32 = ARKUI_FONT_STYLE_NORMAL}, {.i32 = ARKUI_FONT_WEIGHT_NORMAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = STR_TEXT; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_PLACEHOLDER_FONT, &value_item); + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_BACKGROUND_COLOR, &background_color_item); + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholderfont_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholderfont_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3b644d51862d4abcf79fea083854c10f7f65e1df --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_placeholderfont_test.h @@ -0,0 +1,35 @@ + +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_PLACEHOLDERFONT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_PLACEHOLDERFONT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaPlaceholderFontTest { +public: + ~TextAreaPlaceholderFontTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value ChangeType(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_PLACEHOLDERFONT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_position_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_position_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d243138338c3f146133b5b69aeedca4289064b47 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_position_test.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textarea_position_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAreaPositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaPositionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaPositionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textarea组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textarea组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // first textarea,设置position为{10,10} + auto textarea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue position_value[] = {{.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea, NODE_POSITION, &position_item); + nodeAPI->setAttribute(textarea, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textarea, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textarea, NODE_HEIGHT, &default_height_item); + + // second textarea,设置position为{-10,-10} + auto textarea_second = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue position_second_value[] = {{.f32 = -10}, {.f32 = -10}}; + ArkUI_AttributeItem position_second_item = {position_second_value, + sizeof(position_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea_second, NODE_POSITION, &position_second_item); + nodeAPI->setAttribute(textarea_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textarea_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textarea_second, NODE_HEIGHT, &default_height_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textarea); + nodeAPI->insertChildAfter(column, textarea_second, textarea); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaPositionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_position_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_position_test.h new file mode 100644 index 0000000000000000000000000000000000000000..4d566c1e2b1503281894f1c650be248ded122f1e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_position_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_POSITION_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_POSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaPositionTest { +public: + ~TextAreaPositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_POSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_responseregion_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_responseregion_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..04190002fd0355c53a82fccca8f1677f3b3060eb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_responseregion_test.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea/textarea_responseregion_test.h" + +#define X_LOCATION 0 +#define Y_LOCATION (-400) +#define WIDTH 200 +#define HEIGHT 100 +#define X_LOCATION_OTHER 80 +#define Y_LOCATION_OTHER (-40) +#define WIDTH_OTHER 200 +#define HEIGHT_OTHER 100 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextAreaResponseRegionTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaResponseRegionTest", + "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_CLICK_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextAreaResponseRegionTest::CreateNativeNodeSingle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 0}, {.f32 = 100}, {.f32 = 200}, {.f32 = 200}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_RESPONSE_REGION, &value_item); + + // 设置textArea组件id + ArkUI_AttributeItem idItem = {}; + idItem.string = "ResponseRegion"; + nodeAPI->setAttribute(textArea, NODE_ID, &idItem); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEvent(textArea, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // 绑定组件回调函数 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaResponseRegionTest::CreateNativeNodeDouble(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.f32 = 0}, {.f32 = 100}, {.f32 = 200}, {.f32 = 200}, + {.f32 = 100}, {.f32 = 0}, {.f32 = 200}, {.f32 = 200}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_RESPONSE_REGION, &value_item); + + // 设置textArea组件id + ArkUI_AttributeItem idItem = {}; + idItem.string = "ResponseRegionMulti"; + nodeAPI->setAttribute(textArea, NODE_ID, &idItem); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_responseregion_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_responseregion_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c473f2aee7cc14a6f1de3c26dc232f25e56cd07b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_responseregion_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_RESPONSEREGION_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_RESPONSEREGION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaResponseRegionTest { +public: + ~TextAreaResponseRegionTest(); + static napi_value CreateNativeNodeSingle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDouble(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_RESPONSEREGION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_stopediting_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_stopediting_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4566e20c397631acb683e1c9f0caf427c86730fb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_stopediting_test.cpp @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_stopediting_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; +static int32_t testType; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); +} + +napi_value TextAreaStopEditingTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textArea, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaStopEditingTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT,node textArea text"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = true}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_EDITING, &item); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textArea, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaStopEditingTest::CreateNativeNodeNoneTrue(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT,node textArea text"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = true}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_EDITING, &item); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textArea, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaStopEditingTest::CreateNativeNodeNoneFalse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT,node textArea text"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = false}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_EDITING, &item); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textArea, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaStopEditingTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT,node textArea text"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = -10}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_EDITING, &item); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textArea, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaStopEditingTest::CreateNativeNodeNoneAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT,node textArea text"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = -10}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_EDITING, &item); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textArea, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaStopEditingTest::ChangeType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonAttrsAlignSelfTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + bool type; + if (PARAM_1 == testType) { + type = true; + } else if (PARAM_2 == testType) { + type = false; + } else if (PARAM_3 == testType) { + type = true; + } else if (PARAM_4 == testType) { + type = false; + } else if (PARAM_5 == testType) { + type = -10; + } else if (PARAM_6 == testType) { + type = -10; + } + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = type}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_EDITING, &item); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_stopediting_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_stopediting_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8cd674a04082c00551d85037b1df03d5dd93bb6b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_stopediting_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_STOPEDITING_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_STOPEDITING_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaStopEditingTest { +public: + ~TextAreaStopEditingTest(); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value ChangeType(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNoneTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNoneFalse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNoneAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_STOPEDITING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_textalign_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_textalign_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1268b46d20271998a275d9e0f489e2d73891bd64 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_textalign_test.cpp @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textarea_textalign_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textArea; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textArea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textArea, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_AREA_TEXT"; + nodeAPI->setAttribute(textArea, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextAreaTextAlignTest::CreateNativeNodeStart(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_TEXT_ALIGNMENT_START}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_ALIGN, &value_item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaTextAlignTest::CreateNativeNodeCenter(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_TEXT_ALIGNMENT_CENTER}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_ALIGN, &value_item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaTextAlignTest::CreateNativeNodeEnd(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_TEXT_ALIGNMENT_END}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_ALIGN, &value_item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaTextAlignTest::CreateNativeNodeJustify(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_TEXT_ALIGNMENT_JUSTIFY}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_ALIGN, &value_item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextAreaTextAlignTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textArea测试属性 + ArkUI_NumberValue value[] = {{.i32 = -100}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textArea, NODE_TEXT_ALIGN, &value_item); + + // 挂载组件 + std::string idTextArea(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextArea), textArea); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_textalign_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_textalign_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a0cec4e6dfb595c938c3f6c421dcf24dd2d6dc57 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_textalign_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_TEXTALIGN_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_TEXTALIGN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaTextAlignTest { +public: + ~TextAreaTextAlignTest(); + static napi_value CreateNativeNodeStart(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCenter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeEnd(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeJustify(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_TEXTALIGN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4a30b8fbf2e18de882a307259923ca3580fa813b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_width_test.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textarea_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextAreaWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textarea组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textarea组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // first textarea,设置宽度为300 + auto textarea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->setAttribute(textarea, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textarea, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textarea, NODE_HEIGHT, &default_height_item); + + ArkUI_NumberValue width_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea, NODE_WIDTH, &width_item); + + // second textarea,设置宽度为异常值 + auto textarea_second = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + nodeAPI->setAttribute(textarea_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textarea_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textarea_second, NODE_HEIGHT, &default_height_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textarea); + nodeAPI->insertChildAfter(column, textarea_second, textarea); + + // 设置父column的高为300vp,子组件间隔对齐 + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextAreaWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaWidthTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为超大值500 + auto textarea = nodeAPI->createNode(ARKUI_NODE_TEXT_AREA); + ArkUI_NumberValue width_value[] = {{.f32 = 500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea, NODE_WIDTH, &width_item); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置子组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textarea, NODE_HEIGHT, &default_height_item); + + nodeAPI->addChild(column, textarea); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextAreaWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..61f82945efcd602d6c9384cdcd1a5253ef14f40f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textarea/textarea_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTAREA_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_TEXTAREA_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextAreaWidthTest { +public: + ~TextAreaWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTAREA_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fbe40a0b2a8ddfe153f6bd0692713ec73e001789 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundcolor_test.cpp @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_backgroundcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputBackgroundColorTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, uint32_t color) +{ + float width = 200; + float height = 200; + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件背景色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = color}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + if ((nodeApi->setAttribute(textInput, NODE_BACKGROUND_COLOR, &backgroundColorItem)) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputBackgroundColorTest", + "set textInput attribute abnormal value,return result 401"); + } + + return textInput; +} + +napi_value TextInputBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + uint32_t color = 0xFFFF0000; + auto textInput = CreateSubTextInputNode(nodeAPI, color); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + color = 0xFF000000; + textInput = CreateSubTextInputNode(nodeAPI, color); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3e366d048f6afbf48a80d9566c6d058d75fd104b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundcolor_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputBackgroundColorTest { +public: + ~TextInputBackgroundColorTest(); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, uint32_t color); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundimage_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundimage_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c9a49a1719def6eb7331c64f5e08eb8039f4ab34 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundimage_test.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_backgroundimage_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputBackgroundImageTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t value, + const char *src) +{ + float width = 100; + float height = 100; + + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件背景色图片属性 + ArkUI_NumberValue backgroundImageValue[] = {{.i32 = value}}; + ArkUI_AttributeItem backgroundImageItem = {backgroundImageValue, + sizeof(backgroundImageValue) / sizeof(ArkUI_NumberValue)}; + backgroundImageItem.string = src; + nodeApi->setAttribute(textInput, NODE_BACKGROUND_IMAGE, &backgroundImageItem); + + return textInput; +} + +napi_value TextInputBackgroundImageTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputBackgroundImageTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputBackgroundImageTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + const char *srcLocal = "resource://media/icon_small.png"; + const char *srcNetwork = "https://gitee.com/openharmony/docs/raw/master/zh-cn/application-dev/reference/apis-arkui/" + "arkui-ts/figures/edgewidths.png"; + int32_t value = ArkUI_ImageRepeat::ARKUI_IMAGE_REPEAT_NONE; + auto textInput = CreateSubTextInputNode(nodeAPI, value, srcLocal); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + value = ArkUI_ImageRepeat::ARKUI_IMAGE_REPEAT_X; + textInput = CreateSubTextInputNode(nodeAPI, value, srcLocal); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + value = ArkUI_ImageRepeat::ARKUI_IMAGE_REPEAT_Y; + textInput = CreateSubTextInputNode(nodeAPI, value, srcLocal); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + value = ArkUI_ImageRepeat::ARKUI_IMAGE_REPEAT_XY; + textInput = CreateSubTextInputNode(nodeAPI, value, srcLocal); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + value = ArkUI_ImageRepeat::ARKUI_IMAGE_REPEAT_NONE; + textInput = CreateSubTextInputNode(nodeAPI, value, srcNetwork); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + value = PARAM_NEGATIVE_100; + textInput = CreateSubTextInputNode(nodeAPI, value, srcLocal); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputBackgroundImageTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundimage_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundimage_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e11da6b943f8cb9176a939f4fc3981f934337a8a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_backgroundimage_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_BACKGROUNDIMAGE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_BACKGROUNDIMAGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class TextInputBackgroundImageTest { +public: + ~TextInputBackgroundImageTest(); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t value, const char *src); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_BACKGROUNDIMAGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..25c26bd46135ade6c92d5e1d17f7aec2712bbbfb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretcolor_test.cpp @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_caretcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputCaretColorTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, const char *id, + uint32_t caretColor) +{ + float width = 200; + float height = 200; + + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件Id + ArkUI_AttributeItem idItem = {}; + idItem.string = id; + nodeApi->setAttribute(textInput, NODE_ID, &idItem); + + ArkUI_NumberValue caretColorValue[] = {{.u32 = caretColor}}; + ArkUI_AttributeItem caretColorItem = {caretColorValue, sizeof(caretColorValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_TEXT_INPUT_CARET_COLOR, &caretColorItem); + + return textInput; +} + +napi_value TextInputCaretColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputCaretColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputCaretColorTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_ROW); + + const char *commonAttrsFirstId = "onTouchFirstTextInputCaretColor"; + + auto textInput = CreateSubTextInputNode(nodeAPI, commonAttrsFirstId, COLOR_RED); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + const char *commonAttrsSecondId = "onTouchSecondTextInputCaretColor"; + textInput = CreateSubTextInputNode(nodeAPI, commonAttrsSecondId, 0xFF000000); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + // 绑定组件 + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageIdTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a52dbda17ac500c01cb384bdf8dce2bfd25a4d9c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretcolor_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_CARETCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_CARETCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputCaretColorTest { +public: + ~TextInputCaretColorTest(); + static void OnEventReceive(ArkUI_NodeEvent *event); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, const char *id, uint32_t eventId); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_CARETCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e243afaeadbc73ee6e6d2b7466d5e45adc00b84f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretstyle_test.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput_caretstyle_test.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextInputCaretStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputCaretStyleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputCaretStyleTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置textInput组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // first textInput,设置caretStyle为10 + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue caretstyle_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem caretstyle_item = {caretstyle_value, sizeof(caretstyle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_CARET_STYLE, &caretstyle_item); + nodeAPI->setAttribute(textInput, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &default_height_item); + + // 设置组件id + ArkUI_AttributeItem id_item = {}; + id_item.string = "caretStyle_10_textInput"; + nodeAPI->setAttribute(textInput, NODE_ID, &id_item); + + // 设置聚焦不拉起输入法 + ArkUI_NumberValue keyboard_value[] = {{.i32 = PARAM_0}}; + ArkUI_AttributeItem keyboard_item = {keyboard_value, sizeof(keyboard_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + + // 注册点击事件 + nodeAPI->registerNodeEvent(textInput, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // second textInput,设置caretStyle为1 + auto textInput_second = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue caretstyle_second_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem caretstyle_second_item = {caretstyle_second_value, + sizeof(caretstyle_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_second, NODE_TEXT_INPUT_CARET_STYLE, &caretstyle_second_item); + nodeAPI->setAttribute(textInput_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_second, NODE_HEIGHT, &default_height_item); + + // 设置组件id + id_item.string = "caretStyle_1_textInput"; + nodeAPI->setAttribute(textInput_second, NODE_ID, &id_item); + + // 设置聚焦不拉起输入法 + nodeAPI->setAttribute(textInput_second, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + + // 注册点击事件 + nodeAPI->registerNodeEvent(textInput_second, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // third textInput,设置caretStyle为-1 + auto textInput_third = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue caretstyle_third_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem caretstyle_third_item = {caretstyle_third_value, + sizeof(caretstyle_third_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_third, NODE_TEXT_INPUT_CARET_STYLE, &caretstyle_third_item); + nodeAPI->setAttribute(textInput_third, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_third, NODE_HEIGHT, &default_height_item); + + // 设置组件id + id_item.string = "caretStyle_-1_textInput"; + nodeAPI->setAttribute(textInput_third, NODE_ID, &id_item); + + // 设置聚焦不拉起输入法 + nodeAPI->setAttribute(textInput_third, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + + // 注册点击事件 + nodeAPI->registerNodeEvent(textInput_third, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // first textInput,设置caretStyle为10.5 + auto textInput_four = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue caretstyle_four_value[] = {{.f32 = 10.5}}; + ArkUI_AttributeItem caretstyle_four_item = {caretstyle_four_value, + sizeof(caretstyle_four_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_four, NODE_TEXT_INPUT_CARET_STYLE, &caretstyle_four_item); + nodeAPI->setAttribute(textInput_four, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_four, NODE_HEIGHT, &default_height_item); + + // 设置组件id + id_item.string = "caretStyle_10_5_textInput"; + nodeAPI->setAttribute(textInput_four, NODE_ID, &id_item); + // 设置聚焦不拉起输入法 + nodeAPI->setAttribute(textInput_four, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + // 注册点击事件 + nodeAPI->registerNodeEvent(textInput_four, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textInput); + nodeAPI->insertChildAfter(column, textInput_second, textInput); + nodeAPI->insertChildAfter(column, textInput_third, textInput_second); + nodeAPI->insertChildAfter(column, textInput_four, textInput_second); + // 设置父column的高为300vp + ArkUI_NumberValue col_height_value[] = {{.f32 = 800}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputCaretStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a789304fa50335a830b4bb5588fe8a58037e96a1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_caretstyle_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_CARETSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_CARETSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputCaretStyleTest { +public: + ~TextInputCaretStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_CARETSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clearbuttonmode_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clearbuttonmode_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e7cc91a28e3362429ce3415cc1e72512584b346d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clearbuttonmode_test.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput/textinput_clearbuttonmode_test.h" + +#define ABNORMAL_PARAM (-100) + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textInput; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_INPUT_TEXT"; + nodeAPI->setAttribute(textInput, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextInputClearButtonModeTest::CreateNativeNodeInput(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_CANCELBUTTON_STYLE_INPUT}, {.f32 = 40}, {.u32 = COLOR_RED}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = "./resources/base/media/icon.png"; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_CANCEL_BUTTON, &value_item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputClearButtonModeTest::CreateNativeNodeInvisible(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_CANCELBUTTON_STYLE_INVISIBLE}, {.f32 = 40}, {.u32 = COLOR_RED}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = "./resources/base/media/icon.png"; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_CANCEL_BUTTON, &value_item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputClearButtonModeTest::CreateNativeNodeConstant(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = ARKUI_CANCELBUTTON_STYLE_CONSTANT}, {.f32 = 40}, {.u32 = COLOR_RED}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = "./resources/base/media/icon.png"; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_CANCEL_BUTTON, &value_item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputClearButtonModeTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = ABNORMAL_PARAM}, {.f32 = 40}, {.u32 = COLOR_RED}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = "./resources/base/media/icon.png"; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_CANCEL_BUTTON, &value_item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clearbuttonmode_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clearbuttonmode_test.h new file mode 100644 index 0000000000000000000000000000000000000000..59d63f617c6300724e85ddf866733ede114c815a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clearbuttonmode_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_CLEARBUTTONMODE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_CLEARBUTTONMODE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputClearButtonModeTest { +public: + ~TextInputClearButtonModeTest(); + static napi_value CreateNativeNodeInput(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeInvisible(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeConstant(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_CLEARBUTTONMODE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aa51bbbf1a6ab1d6328319b4c793d80dc8c8425d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clip_test.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_clip_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputClipTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t value) +{ + float width = 100; + float height = 100; + float clipTypeRectangleWidth = 100; + float clipTypeRectangleHeight = 80; + float clipTypeRectangleRadiusWidth = 20; + float clipTypeRectangleRadiusHeight = 20; + float clipTypeCircleWidth = 80; + float clipTypeCircleHeight = 80; + float clipTypeEllipseWidth = 80; + float clipTypeEllipseHeight = 60; + float clipTypePathWidth = 100; + float clipTypePathHeight = 100; + const char *typePath = "M30 0 L50 50 L0 50 Z"; + + uint32_t backgroundColor = 0xFFFF0000; + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件背景色 + ArkUI_NumberValue backgroundColorValue[] = {{.u32 = backgroundColor}}; + ArkUI_AttributeItem backgroundColorItem = {backgroundColorValue, + sizeof(backgroundColorValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_BACKGROUND_COLOR, &backgroundColorItem); + + // 设置按指定的形状对当前组件进行裁剪 + switch (value) { + case ArkUI_ClipType::ARKUI_CLIP_TYPE_RECTANGLE: { + ArkUI_NumberValue clipShapeValue[] = {{.i32 = ArkUI_ClipType::ARKUI_CLIP_TYPE_RECTANGLE}, + {.f32 = clipTypeRectangleWidth}, + {.f32 = clipTypeRectangleHeight}, + {.f32 = clipTypeRectangleRadiusWidth}, + {.f32 = clipTypeRectangleRadiusHeight}}; + ArkUI_AttributeItem clipShapeItem = {clipShapeValue, sizeof(clipShapeValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_CLIP_SHAPE, &clipShapeItem); + } break; + case ArkUI_ClipType::ARKUI_CLIP_TYPE_CIRCLE: { + ArkUI_NumberValue clipShapeValue[] = {{.i32 = ArkUI_ClipType::ARKUI_CLIP_TYPE_CIRCLE}, + {.f32 = clipTypeCircleWidth}, + {.f32 = clipTypeCircleHeight}}; + ArkUI_AttributeItem clipShapeItem = {clipShapeValue, sizeof(clipShapeValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_CLIP_SHAPE, &clipShapeItem); + } break; + case ArkUI_ClipType::ARKUI_CLIP_TYPE_ELLIPSE: { + ArkUI_NumberValue clipShapeValue[] = {{.i32 = ArkUI_ClipType::ARKUI_CLIP_TYPE_ELLIPSE}, + {.f32 = clipTypeEllipseWidth}, + {.f32 = clipTypeEllipseHeight}}; + ArkUI_AttributeItem clipShapeItem = {clipShapeValue, sizeof(clipShapeValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_CLIP_SHAPE, &clipShapeItem); + } break; + case ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH: { + ArkUI_NumberValue clipShapeValue[] = { + {.i32 = ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH}, {.f32 = clipTypePathWidth}, {.f32 = clipTypePathHeight}}; + ArkUI_AttributeItem clipShapeItem = {clipShapeValue, sizeof(clipShapeValue) / sizeof(ArkUI_NumberValue)}; + clipShapeItem.string = typePath; + nodeApi->setAttribute(textInput, NODE_CLIP_SHAPE, &clipShapeItem); + } break; + default: + break; + } + + return textInput; +} + +napi_value TextInputClipTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageClipTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageClipTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t value = ArkUI_ClipType::ARKUI_CLIP_TYPE_RECTANGLE; + auto textInput = CreateSubTextInputNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + value = ArkUI_ClipType::ARKUI_CLIP_TYPE_CIRCLE; + textInput = CreateSubTextInputNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + value = ArkUI_ClipType::ARKUI_CLIP_TYPE_ELLIPSE; + textInput = CreateSubTextInputNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + value = ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH; + textInput = CreateSubTextInputNode(nodeAPI, value); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ImageClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..817001af6610d773e68c7f6f63ba982e6b41f9ae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_clip_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_CLIP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +using namespace std; + +class TextInputClipTest { +public: + ~TextInputClipTest(); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t value); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_defaultfocus_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_defaultfocus_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e1750b2023dd15852762c15b1faab5aa80d1df75 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_defaultfocus_test.cpp @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput_defaultfocus_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textInput; +static ArkUI_NodeHandle compare; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + compare = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + nodeAPI->setAttribute(compare, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(compare, NODE_HEIGHT, &height_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "TextInputDefaultFocus"; + nodeAPI->setAttribute(textInput, NODE_ID, &id_item); + id_item.string = "CompareDefaultFocus"; + nodeAPI->setAttribute(compare, NODE_ID, &id_item); + + ArkUI_NumberValue caret_color_value[] = {{.u32 = 0x00000000}}; + ArkUI_AttributeItem caret_color_item = {caret_color_value, sizeof(caret_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_CARET_COLOR, &caret_color_item); + nodeAPI->setAttribute(compare, NODE_TEXT_INPUT_CARET_COLOR, &caret_color_item); + nodeAPI->registerNodeEvent(textInput, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(compare, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->addChild(column, textInput); + nodeAPI->addChild(column, compare); +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputDefaultFocusTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputDefaultFocusTest", + "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputDefaultFocusTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_FOCUS_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +napi_value TextInputDefaultFocusTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = 0}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_DEFAULT_FOCUS, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string id(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputDefaultFocusTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = 1}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_DEFAULT_FOCUS, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string id(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputDefaultFocusTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string id(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputDefaultFocusTest::CreateNativeNodeSingle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 参考组件设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = 1}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(compare, NODE_DEFAULT_FOCUS, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string id(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputDefaultFocusTest::CreateNativeNodeMulti(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 参考组件设置textInput测试属性 + ArkUI_NumberValue compare_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem compare_item = {compare_value, sizeof(compare_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(compare, NODE_DEFAULT_FOCUS, &compare_item); + + // 目标组件设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = 1}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_DEFAULT_FOCUS, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string id(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputDefaultFocusTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = -10}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_DEFAULT_FOCUS, &item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + // 挂载组件 + std::string id(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_defaultfocus_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_defaultfocus_test.h new file mode 100644 index 0000000000000000000000000000000000000000..5858e3d40cb122c70213ccc08fe3378f0ba09314 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_defaultfocus_test.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_DEFAULTFOCUS_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_DEFAULTFOCUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputDefaultFocusTest { +public: + ~TextInputDefaultFocusTest(); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeSingle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMulti(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_DEFAULTFOCUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enabled_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enabled_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..38c4233e3fa6c17bdd630ec3b146aba87b76cf15 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enabled_test.cpp @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_enabled_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int enabled, const char *id, bool isRegisterFocusBlur) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + + // set enabled + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + // set id + ArkUI_AttributeItem id_item = {}; + id_item.string = id; + nodeAPI->setAttribute(nodeHandle, NODE_ID, &id_item); + + // set background color + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + // set width + ArkUI_NumberValue width_value[] = {{.f32 = TEXTINPUT_WIDTH_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // set height + ArkUI_NumberValue height_value[] = {{.f32 = TEXTINPUT_HEIGHT_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + // set keyboard + ArkUI_NumberValue keyboard_value[] = {{.i32 = PARAM_0}}; + ArkUI_AttributeItem keyboard_item = {keyboard_value, sizeof(keyboard_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + if (isRegisterFocusBlur) { + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + } + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputEnabledTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnabledTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + uint32_t color = COLOR_PURPLE; + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + switch (eventId) { + case ON_CLICK_EVENT_ID: + color = COLOR_GREEN; + break; + case ON_FOCUS_EVENT_ID: + color = COLOR_BLUE; + break; + case ON_BLUR_EVENT_ID: + color = COLOR_YELLOW; + break; + default: + break; + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + + // 点击事件时,关闭弹出的输入法 + if (eventId == ON_CLICK_EVENT_ID) { + ArkUI_NumberValue textInput_editing_value[] = {{.i32 = PARAM_0}}; + ArkUI_AttributeItem textInput_editing_item = {textInput_editing_value, + sizeof(textInput_editing_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_TEXT_INPUT_EDITING, &textInput_editing_item); + } +} + +napi_value TextInputEnabledTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnabledTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnabledTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // set height + ArkUI_NumberValue col_height_value[] = {{.f32 = COLUMN_HEIGHT_700}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + // set width + ArkUI_NumberValue col_width_value[] = {{.f32 = COLUMN_WIDTH_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + // set alignment + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + + // enabled text + auto textInput_click = createChildNode(nodeAPI, PARAM_1, "OnClickEnabledTextInput", false); + auto textInput_focus = createChildNode(nodeAPI, PARAM_1, "OnFocusEnabledTextInput", true); + auto textInput_blur = createChildNode(nodeAPI, PARAM_1, "OnBlurEnabledTextInput", true); + // disabled text + auto textInput_disabled_click = createChildNode(nodeAPI, PARAM_0, "OnClickDisabledTextInput", false); + auto textInput_disabled_focus = createChildNode(nodeAPI, PARAM_0, "OnFocusDisabledTextInput", true); + auto textInput_disabled_blur = createChildNode(nodeAPI, PARAM_0, "OnBlurDisabledTextInput", true); + // abnormal text + auto textInput_abnormal_click = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnClickAbnormalTextInput", false); + auto textInput_abnormal_focus = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnFocusAbnormalTextInput", true); + auto textInput_abnormal_blur = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnBlurAbnormalTextInput", true); + + // set row height + ArkUI_NumberValue row_height_value[] = {{.f32 = ROW_HEIGHT_110}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + // set row width + ArkUI_NumberValue row_width_value[] = {{.f32 = ROW_WIDTH_350}}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + // set row alignment + ArkUI_NumberValue row_justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem row_justify_content_item = {row_justify_content_value, + sizeof(row_justify_content_value) / sizeof(ArkUI_NumberValue)}; + + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_first, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &row_width_item); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &row_height_item); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + nodeAPI->addChild(row_first, textInput_click); + nodeAPI->insertChildAfter(row_first, textInput_focus, textInput_click); + nodeAPI->insertChildAfter(row_first, textInput_blur, textInput_focus); + + nodeAPI->addChild(row_second, textInput_disabled_click); + nodeAPI->insertChildAfter(row_second, textInput_disabled_focus, textInput_disabled_click); + nodeAPI->insertChildAfter(row_second, textInput_disabled_blur, textInput_disabled_focus); + + nodeAPI->addChild(row_third, textInput_abnormal_click); + nodeAPI->insertChildAfter(row_third, textInput_abnormal_focus, textInput_abnormal_click); + nodeAPI->insertChildAfter(row_third, textInput_abnormal_blur, textInput_abnormal_focus); + + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + + // Bind click event + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enabled_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enabled_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7ecfe6c762137f677dbfcf0b8e68a5b76a6ed726 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enabled_test.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_XTS_CB_TEXTINPUT_ENABLED_TEST_H +#define ARKUI_CAPI_XTS_CB_TEXTINPUT_ENABLED_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +#define COLUMN_HEIGHT_700 700 +#define COLUMN_WIDTH_200 200 + +#define ROW_HEIGHT_110 110 +#define ROW_WIDTH_350 350 + +#define TEXTINPUT_HEIGHT_100 100 +#define TEXTINPUT_WIDTH_100 100 + +#define FOCUSABLE_TRUE 1 + +class TextInputEnabledTest { +public: + ~TextInputEnabledTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_XTS_CB_TEXTINPUT_ENABLED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enablekeyboardonfocus_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enablekeyboardonfocus_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4c96acb25155a861c00bfba8d73e5a76cf082a30 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enablekeyboardonfocus_test.cpp @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput/textinput_enablekeyboardonfocus_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t enableKeyboardOnFocus, const char *id) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + + // set id + ArkUI_AttributeItem id_item = {}; + id_item.string = id; + nodeAPI->setAttribute(nodeHandle, NODE_ID, &id_item); + + // 设置textInput组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // 设置textInput组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + // 设置textInput组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + // 设置textInput组件enableKeyboardOnFocus + ArkUI_NumberValue enableKeyboardOnFocus_value[] = {{.i32 = enableKeyboardOnFocus}}; + ArkUI_AttributeItem enableKeyboardOnFocus_item = {enableKeyboardOnFocus_value, + sizeof(enableKeyboardOnFocus_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &enableKeyboardOnFocus_item); + + return nodeHandle; +} + +napi_value TextInputEnableKeyboardOnFocusTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnableKeyboardOnFocusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnableKeyboardOnFocusTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto textInput = createChildNode(nodeAPI, PARAM_1, "OnFocusEnableKeyBoard"); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + nodeAPI->addChild(column, textInput); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnableKeyboardOnFocusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputEnableKeyboardOnFocusTest::CreateNativeNodeDisableKeyBoard(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnableKeyboardOnFocusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnableKeyboardOnFocusTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto textInput = createChildNode(nodeAPI, PARAM_0, "OnFocusDisableKeyBoard"); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + nodeAPI->addChild(column, textInput); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnableKeyboardOnFocusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputEnableKeyboardOnFocusTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnableKeyboardOnFocusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnableKeyboardOnFocusTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto textInput = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnFocusAbnormal"); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + nodeAPI->addChild(column, textInput); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnableKeyboardOnFocusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enablekeyboardonfocus_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enablekeyboardonfocus_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9fad830e6bc28810e2253af9e7ebbbb2ca643f26 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enablekeyboardonfocus_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_ENABLEKEYBOARDONFOCUS_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_ENABLEKEYBOARDONFOCUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputEnableKeyboardOnFocusTest { +public: + ~TextInputEnableKeyboardOnFocusTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDisableKeyBoard(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_ENABLEKEYBOARDONFOCUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enterkeytype_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enterkeytype_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..670559e228e2c354b36cb9605e448653367866fa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enterkeytype_test.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput/textinput_enterkeytype_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t enterKeyType, char *id) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + + // 设置textInput组件宽度 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // 设置textInput组件高度 + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + // 设置textInput组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = id; + nodeAPI->setAttribute(nodeHandle, NODE_ID, &id_item); + + // 设置textInput组件enterKeyType + ArkUI_NumberValue enterKeyType_value[] = {{.i32 = enterKeyType}}; + ArkUI_AttributeItem enterKeyType_item = {enterKeyType_value, + sizeof(enterKeyType_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENTER_KEY_TYPE, &enterKeyType_item); + + return nodeHandle; +} + +napi_value TextInputEnterKeyTypeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnterKeyTypeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnterKeyTypeTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto textInputFirst = createChildNode(nodeAPI, ARKUI_ENTER_KEY_TYPE_GO, "OnClickTypeGo"); + auto textInputFirstEnd = createChildNode(nodeAPI, ARKUI_ENTER_KEY_TYPE_SEARCH, "OnClickTypeSearch"); + auto textInputSecond = createChildNode(nodeAPI, ARKUI_ENTER_KEY_TYPE_SEND, "OnClickTypeSend"); + auto textInputSecondEnd = createChildNode(nodeAPI, ARKUI_ENTER_KEY_TYPE_NEXT, "OnClickTypeNext"); + auto textInputThird = createChildNode(nodeAPI, ARKUI_ENTER_KEY_TYPE_DONE, "OnClickTypeDone"); + auto textInputThirdEnd = createChildNode(nodeAPI, ARKUI_ENTER_KEY_TYPE_PREVIOUS, "OnClickTypePrevious"); + auto textInputFourth = createChildNode(nodeAPI, ARKUI_ENTER_KEY_TYPE_NEW_LINE, "OnClickTypeNewLine"); + auto textInputFourthEnd = createChildNode(nodeAPI, PARAM_NEGATIVE_1, "OnClickAbnormal"); + + auto rowFirst = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowSecond = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowThird = nodeAPI->createNode(ARKUI_NODE_ROW); + auto rowFourth = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->addChild(rowFirst, textInputFirst); + nodeAPI->addChild(rowFirst, textInputFirstEnd); + nodeAPI->addChild(rowSecond, textInputSecond); + nodeAPI->addChild(rowSecond, textInputSecondEnd); + nodeAPI->addChild(rowThird, textInputThird); + nodeAPI->addChild(rowThird, textInputThirdEnd); + nodeAPI->addChild(rowFourth, textInputFourth); + nodeAPI->addChild(rowFourth, textInputFourthEnd); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue col_height_value[] = {{.f32 = 800}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + // set alignment + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_END}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + nodeAPI->addChild(column, rowFirst); + nodeAPI->addChild(column, rowSecond); + nodeAPI->addChild(column, rowThird); + nodeAPI->addChild(column, rowFourth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnterKeyTypeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enterkeytype_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enterkeytype_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f0c88ce64c80994b385fa2e477f1e696f91cc0b3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_enterkeytype_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_ENTERKEYTYPE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_ENTERKEYTYPE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputEnterKeyTypeTest { +public: + ~TextInputEnterKeyTypeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_ENTERKEYTYPE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..287c8ab10d765fb3b4771537abcf6e3c726d893e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontcolor_test.cpp @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_fontcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputFontColorTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, uint32_t color) +{ + float width = 200; + float height = 200; + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TextInput"; + nodeApi->setAttribute(textInput, NODE_TEXT_INPUT_TEXT, &content_item); + + // 设置字体颜色 + ArkUI_NumberValue fontColorValue[] = {{.u32 = color}}; + ArkUI_AttributeItem fontColorItem = {fontColorValue, sizeof(fontColorValue) / sizeof(ArkUI_NumberValue)}; + if ((nodeApi->setAttribute(textInput, NODE_FONT_COLOR, &fontColorItem)) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputFontColorTest", + "set textInput attribute abnormal value,return result 401"); + } + + return textInput; +} + +napi_value TextInputFontColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontColorTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + uint32_t color = 0xFFFF0000; + auto textInput = CreateSubTextInputNode(nodeAPI, color); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + color = 0xFF000000; + textInput = CreateSubTextInputNode(nodeAPI, color); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..48ee902a629b8fc33602911c7d2c343163b2104b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontcolor_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_FONTCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_FONTCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputFontColorTest { +public: + ~TextInputFontColorTest(); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, uint32_t color); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_FONTCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontfamily_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontfamily_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..80923648410c54e5094422fb29383d1f7984ca2f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontfamily_test.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput/textinput_fontfamily_test.h" + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textInput; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_INPUT_TEXT"; + nodeAPI->setAttribute(textInput, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextInputFontFamilyTest::CreateNativeNodeSingle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_AttributeItem value_item = {}; + value_item.string = "HarmonyOS Sans"; + nodeAPI->setAttribute(textInput, NODE_FONT_FAMILY, &value_item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputFontFamilyTest::CreateNativeNodeAdd(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_AttributeItem value_item = {}; + value_item.string = "HarmonyOS Sans STR_AREA"; + nodeAPI->setAttribute(textInput, NODE_FONT_FAMILY, &value_item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontfamily_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontfamily_test.h new file mode 100644 index 0000000000000000000000000000000000000000..23e25ebdd48491c8faadb0cda01641d551c0889f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontfamily_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_FONTFAMILY_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_FONTFAMILY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputFontFamilyTest { +public: + ~TextInputFontFamilyTest(); + static napi_value CreateNativeNodeSingle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAdd(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_FONTFAMILY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontsize_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontsize_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8f53fc70e8902adf2c2076e0a0c6c07850fee76b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontsize_test.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_fontsize_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputFontSizeTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, float fontSize) +{ + float width = 200; + float height = 200; + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TextInput"; + nodeApi->setAttribute(textInput, NODE_TEXT_INPUT_TEXT, &content_item); + + // 设置字体大小 + ArkUI_NumberValue fontSizeValue[] = {{.f32 = fontSize}}; + ArkUI_AttributeItem fontSizeItem = {fontSizeValue, sizeof(fontSizeValue) / sizeof(ArkUI_NumberValue)}; + if ((nodeApi->setAttribute(textInput, NODE_FONT_SIZE, &fontSizeItem)) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputFontSizeTest", + "set textInput attribute abnormal value,return result 401"); + } + + return textInput; +} + +napi_value TextInputFontSizeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontSizeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontSizeTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float fontSize = 0.0; + auto textInput = CreateSubTextInputNode(nodeAPI, fontSize); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + fontSize = 10.0; + textInput = CreateSubTextInputNode(nodeAPI, fontSize); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + fontSize = 12.5; + textInput = CreateSubTextInputNode(nodeAPI, fontSize); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + fontSize = -1.0; + textInput = CreateSubTextInputNode(nodeAPI, fontSize); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontSizeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontsize_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontsize_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0b76b8156d704a4539e113654e18d8181244dd24 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontsize_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_FONTSIZE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_FONTSIZE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputFontSizeTest { +public: + ~TextInputFontSizeTest(); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, float fontSize); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_FONTSIZE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..13c863b9254dd017ad61b1eb78f8580de1d4f91a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontstyle_test.cpp @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_fontstyle_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputFontStyleTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t fontStyle) +{ + float width = 200; + float height = 200; + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TextInput"; + nodeApi->setAttribute(textInput, NODE_TEXT_INPUT_TEXT, &content_item); + + // 设置组件字体样式属性 + ArkUI_NumberValue fontStyleValue[] = {{.i32 = fontStyle}}; + ArkUI_AttributeItem fontSizeItem = {fontStyleValue, sizeof(fontStyleValue) / sizeof(ArkUI_NumberValue)}; + if ((nodeApi->setAttribute(textInput, NODE_FONT_STYLE, &fontSizeItem)) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputFontStyleTest", + "set textInput attribute abnormal value,return result 401"); + } + + return textInput; +} + +napi_value TextInputFontStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontStyleTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontStyleTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t fontStyle = ArkUI_FontStyle::ARKUI_FONT_STYLE_NORMAL; + auto textInput = CreateSubTextInputNode(nodeAPI, fontStyle); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + fontStyle = ArkUI_FontStyle::ARKUI_FONT_STYLE_ITALIC; + textInput = CreateSubTextInputNode(nodeAPI, fontStyle); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + fontStyle = PARAM_NEGATIVE_100; + textInput = CreateSubTextInputNode(nodeAPI, fontStyle); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b5aa4a8d604466a1994262b2c591c0e44856255f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontstyle_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_FONTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_FONTSTYLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputFontStyleTest { +public: + ~TextInputFontStyleTest(); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t fontStyle); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_FONTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontweight_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontweight_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..58b1ea5ed421772bdbf98461a59c2c06d35e3eef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontweight_test.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_fontweight_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputFontWeightTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t fontWeight) +{ + float width = 100; + float height = 100; + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TextInput"; + nodeApi->setAttribute(textInput, NODE_TEXT_INPUT_TEXT, &content_item); + + // 设置组件字体粗细属性 + ArkUI_NumberValue fontWeightValue[] = {{.i32 = fontWeight}}; + ArkUI_AttributeItem fontWeightItem = {fontWeightValue, sizeof(fontWeightValue) / sizeof(ArkUI_NumberValue)}; + if ((nodeApi->setAttribute(textInput, NODE_FONT_WEIGHT, &fontWeightItem)) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputFontWeightTest", + "set textInput attribute abnormal value,return result 401"); + } + + return textInput; +} + +napi_value TextInputFontWeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontWeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontWeightTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto leftColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto rightColumn = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + + int32_t fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W100; + auto textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W200; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W300; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W400; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W500; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W600; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W700; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W800; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(leftColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W900; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_BOLD; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_NORMAL; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_BOLDER; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_LIGHTER; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_MEDIUM; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, textInput); + + fontWeight = ArkUI_FontWeight::ARKUI_FONT_WEIGHT_REGULAR; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, textInput); + + fontWeight = PARAM_NEGATIVE_100; + textInput = CreateSubTextInputNode(nodeAPI, fontWeight); + // 添加组件到容器 + nodeAPI->addChild(rightColumn, textInput); + + // 添加组件到容器 + nodeAPI->addChild(row, leftColumn); + // 添加组件到容器 + nodeAPI->addChild(row, rightColumn); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputFontWeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontweight_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontweight_test.h new file mode 100644 index 0000000000000000000000000000000000000000..235c2b8bec578f6822b69198fe2c20de974374c5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_fontweight_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_FONTWEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_FONTWEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputFontWeightTest { +public: + ~TextInputFontWeightTest(); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t fontWeight); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_FONTWEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fba2c7d836fae1876b852e97c60e14d8d98f515d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_height_test.cpp @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput/textinput_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextInputHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputHeightTest", "GetContext env or info is null"); + return nullptr; + } + + // 设置textInput组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput背景颜色 + ArkUI_NumberValue red_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue green_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem green_color_item = {green_color_value, sizeof(green_color_value) / sizeof(ArkUI_NumberValue)}; + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // first textInput,设置高度为200 + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->setAttribute(textInput, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &red_color_item); + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + // second textInput,设置宽度为异常值 + auto textInput_second = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->setAttribute(textInput_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput_second, NODE_BACKGROUND_COLOR, &green_color_item); + ArkUI_NumberValue height_second_value[] = {{.f32 = -50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textInput); + nodeAPI->insertChildAfter(column, textInput_second, textInput); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputHeightTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置textInput组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput背景颜色 + ArkUI_NumberValue red_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为超大值500 + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->setAttribute(textInput, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &red_color_item); + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + + nodeAPI->addChild(column, textInput); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bed8844d8964f6aa2735a05b0d5e198f77e2a8ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputHeightTest { +public: + ~TextInputHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_key_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_key_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0b30deb2e3055a65247eee58397b1455452e50da --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_key_test.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput_key_test.h" + +#define PARAM_LENGTH 200 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textInput; +static ArkUI_NodeHandle textInputCompare; +static ArkUI_NodeHandle row; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + uint32_t background_color = COLOR_YELLOW; + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputKeyTest", "OnEventReceive eventId: %{public}d", + eventId); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_CLICK_EVENT_ID) { + background_color = COLOR_RED; + ArkUI_NumberValue background_color_value[] = {{.u32 = background_color}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +static void BasicSet() +{ + row = nodeAPI->createNode(ARKUI_NODE_ROW); + textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue width_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_NumberValue height_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "TARGET"; + nodeAPI->setAttribute(textInput, NODE_TEXT_AREA_TEXT, &place_holder_item); + + textInputCompare = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue compare_width_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_NumberValue compare_height_value[] = {{.f32 = PARAM_LENGTH}}; + ArkUI_AttributeItem compare_width_item = {compare_width_value, + sizeof(compare_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem compare_height_item = {compare_height_value, + sizeof(compare_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInputCompare, NODE_WIDTH, &compare_width_item); + nodeAPI->setAttribute(textInputCompare, NODE_HEIGHT, &compare_height_item); + + ArkUI_NumberValue color_value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem color_item = {color_value, sizeof(color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInputCompare, NODE_BACKGROUND_COLOR, &color_item); + + ArkUI_AttributeItem compare_place_holder_item; + compare_place_holder_item.string = "COMPARE"; + nodeAPI->setAttribute(textInputCompare, NODE_TEXT_AREA_TEXT, &compare_place_holder_item); + + ArkUI_NumberValue value[] = {{.i32 = true}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInputCompare, NODE_DEFAULT_FOCUS, &item); + + ArkUI_AttributeItem idItem = {}; + idItem.string = "KEY"; + nodeAPI->setAttribute(textInput, NODE_ID, &idItem); + + ArkUI_AttributeItem idCompareItem = {}; + idCompareItem.string = "textInputOnFocusCompare"; + nodeAPI->setAttribute(textInputCompare, NODE_ID, &idCompareItem); +} + +napi_value TextInputKeyTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + ArkUI_NumberValue value[] = {{.u32 = COLOR_YELLOW}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &item); + + ArkUI_NumberValue focus[] = {{.i32 = true}}; + ArkUI_AttributeItem focus_item = {focus, sizeof(focus) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_DEFAULT_FOCUS, &focus_item); + + nodeAPI->addChild(row, textInputCompare); + nodeAPI->addChild(row, textInput); + + nodeAPI->registerNodeEvent(textInput, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string idrow(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idrow), row); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_key_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_key_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bc3212cd20afdac3e53d7d826bfd11b10f056db2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_key_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_KEY_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_KEY_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputKeyTest { +public: + ~TextInputKeyTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_KEY_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_lineheight_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_lineheight_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d84f95d9d6b8c53412e9c0a5313b8171cfff6bde --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_lineheight_test.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_lineheight_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextInputLineHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputLineHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputLineHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto textInputFirst = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue valueFirst[] = {{.f32 = 35}}; + ArkUI_AttributeItem valueItemFirst = {valueFirst, sizeof(valueFirst) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInputFirst, NODE_TEXT_LINE_HEIGHT, &valueItemFirst); + + auto textInputSecond = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue valueSecond[] = {{.f32 = 100}}; + ArkUI_AttributeItem valueItemSecond = {valueSecond, sizeof(valueSecond) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInputSecond, NODE_TEXT_LINE_HEIGHT, &valueItemSecond); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textInputFirst); + nodeAPI->addChild(column, textInputSecond); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputLineHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputLineHeightTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputLineHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputLineHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto textInputThird = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue valueThird[] = {{.f32 = 0}}; + ArkUI_AttributeItem valueItemThird = {valueThird, sizeof(valueThird) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInputThird, NODE_TEXT_LINE_HEIGHT, &valueItemThird); + + auto textInputFourth = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue valueFourth[] = {{.f32 = -1}}; + ArkUI_AttributeItem valueItemFourth = {valueFourth, sizeof(valueFourth) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInputFourth, NODE_TEXT_LINE_HEIGHT, &valueItemFourth); + + // 创建column节点组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textInputThird); + nodeAPI->addChild(column, textInputFourth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputLineHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_lineheight_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_lineheight_test.h new file mode 100644 index 0000000000000000000000000000000000000000..be70dc285250425a5c29414a107f18febe939ac0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_lineheight_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_LINEHEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_LINEHEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputLineHeightTest { +public: + ~TextInputLineHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_LINEHEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_maxlength_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_maxlength_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..05eb51312a4196c31247ccec3416e8bc5526d352 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_maxlength_test.cpp @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput/textinput_maxlength_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textInput; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_INPUT_TEXT"; + nodeAPI->setAttribute(textInput, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextInputMaxLengthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = 8}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_MAX_LENGTH, &item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputMaxLengthTest::CreateNativeNodeNone(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = 0}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_MAX_LENGTH, &item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputMaxLengthTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = -100}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_MAX_LENGTH, &item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_maxlength_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_maxlength_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0719ab3a0b31a1c13c61e7b7cbe8380f063cc74e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_maxlength_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_MAXLENGTH_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_MAXLENGTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputMaxLengthTest { +public: + ~TextInputMaxLengthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNone(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_MAXLENGTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onblur_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onblur_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..244c000e08f8d7e5cc4e94a3b390f2f392ac7df0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onblur_test.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_onblur_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnBlurTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnBlurTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnBlurTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_BLUR_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +napi_value TextInputOnBlurTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnBlurTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnBlurTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = createChildNode(nodeAPI, true); + auto textInputCompare = createChildNode(nodeAPI, true); + auto textInputDisable = createChildNode(nodeAPI, false); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnBlurTestTextInput"; + nodeAPI->setAttribute(textInput, NODE_ID, &id_item); + id_item.string = "OnBlurTestTextInputCompare"; + nodeAPI->setAttribute(textInputCompare, NODE_ID, &id_item); + id_item.string = "OnBlurTestTextInputDisable"; + nodeAPI->setAttribute(textInputDisable, NODE_ID, &id_item); + + nodeAPI->addChild(column, textInput); + nodeAPI->addChild(column, textInputCompare); + nodeAPI->addChild(column, textInputDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnBlurTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onblur_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onblur_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3dd5d5dfa2addef2c49cf48cff88788dd46f49bc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onblur_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_ONBLUR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_ONBLUR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputOnBlurTest { +public: + ~TextInputOnBlurTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_ONBLUR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onchange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onchange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..23d314d94877cc5d57dcc359b441a49e8771b2af --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onchange_test.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_onchange_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t enabled, const char *id) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + + // set enabled + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + // set id + ArkUI_AttributeItem id_item = {}; + id_item.string = id; + nodeAPI->setAttribute(nodeHandle, NODE_ID, &id_item); + + // set background color + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + // set width + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // set height + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + // set keyboard + ArkUI_NumberValue keyboard_value[] = {{.i32 = PARAM_0}}; + ArkUI_AttributeItem keyboard_item = {keyboard_value, sizeof(keyboard_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_TEXT_INPUT_ON_CHANGE, ON_CHANGE_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnChangeTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnChangeTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + if (eventId == ON_CHANGE_EVENT_ID) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnChangeTest", "OnEventReceive:ON_CHANGE_EVENT_ID"); + ArkUI_StringAsyncEvent *result = OH_ArkUI_NodeEvent_GetStringAsyncEvent(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnChangeTest", "result:%{public}s", result->pStr); + if (std::strcmp(result->pStr, "123abc") == 0) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_BLUE}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } else if (eventId == ON_CLICK_EVENT_ID) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnChangeTest", "OnEventReceive:ON_CLICK_EVENT_ID"); + ArkUI_NumberValue textInput_editing_value[] = {{.i32 = PARAM_0}}; + ArkUI_AttributeItem textInput_editing_item = {textInput_editing_value, + sizeof(textInput_editing_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_TEXT_INPUT_EDITING, &textInput_editing_item); + + ArkUI_AttributeItem text_item = {}; + text_item.string = "123abc"; + nodeAPI->setAttribute(nodeHandler, NODE_TEXT_INPUT_TEXT, &text_item); + } +} + +napi_value TextInputOnChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnChangeTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnChangeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + auto textInput = createChildNode(nodeAPI, PARAM_1, "OnChangeTextInput"); + auto textInputDisabled = createChildNode(nodeAPI, PARAM_0, "OnChangeTextInputDisabled"); + + // Bind onChange event + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textInput); + nodeAPI->addChild(column, textInputDisabled); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onchange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onchange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7c759ecdc5e92367142608662b950114f8b9452c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onchange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_XTS_CB_TEXTINPUT_ONCHANGE_TEST_H +#define ARKUI_CAPI_XTS_CB_TEXTINPUT_ONCHANGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputOnChangeTest { +public: + ~TextInputOnChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_XTS_CB_TEXTINPUT_ONCHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_oncut_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_oncut_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d45464fcfe748a07107d2130493febfafacd8908 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_oncut_test.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_oncut_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define TEXT_INPUT_ON_CUT_TEST_STRING "X" + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem text_item = {}; + text_item.string = TEXT_INPUT_ON_CUT_TEST_STRING; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_INPUT_TEXT, &text_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_TEXT_INPUT_ON_CUT, ON_CUT_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnCutTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnCutTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnCutTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_CUT_EVENT_ID) { + ArkUI_StringAsyncEvent *result = OH_ArkUI_NodeEvent_GetStringAsyncEvent(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnCutTest", "OnEventReceive pStr: %{public}s", + result->pStr); + if (::strcmp(result->pStr, TEXT_INPUT_ON_CUT_TEST_STRING) == 0) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } +} + +napi_value TextInputOnCutTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnCutTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnCutTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = createChildNode(nodeAPI); + auto textInputDisable = createChildNode(nodeAPI); + + ArkUI_NumberValue size_value[] = {{.f32 = SIZE_400}, {.f32 = SIZE_400}}; + ArkUI_AttributeItem size_item = {size_value, sizeof(size_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_SIZE, &size_item); + + ArkUI_NumberValue enter_value[] = {{.i32 = ARKUI_ENTER_KEY_TYPE_NEW_LINE}}; + ArkUI_AttributeItem enter_item = {enter_value, sizeof(enter_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInputDisable, NODE_TEXT_INPUT_ENTER_KEY_TYPE, &enter_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnCutTestTextInput"; + nodeAPI->setAttribute(textInput, NODE_ID, &id_item); + + nodeAPI->addChild(column, textInput); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnCutTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_oncut_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_oncut_test.h new file mode 100644 index 0000000000000000000000000000000000000000..37b68cffbfa0cac663564d3ad5c98f0ef51f5cc2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_oncut_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_XTS_TEXTINPUT_ONCUT_TEST_H +#define ARKUI_CAPI_XTS_TEXTINPUT_ONCUT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputOnCutTest { +public: + ~TextInputOnCutTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_XTS_TEXTINPUT_ONCUT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onfocus_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onfocus_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f03aa0b1efa9cd294f7e42e337278c54c2e0066f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onfocus_test.cpp @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_onfocus_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnFocusTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnFocusTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnFocusTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_FOCUS_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } +} + +napi_value TextInputOnFocusTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnFocusTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnFocusTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = createChildNode(nodeAPI, true); + auto textInputCompare = createChildNode(nodeAPI, true); + auto textInputDisable = createChildNode(nodeAPI, false); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnFocusTestTextInput"; + nodeAPI->setAttribute(textInput, NODE_ID, &id_item); + id_item.string = "OnFocusTestTextInputCompare"; + nodeAPI->setAttribute(textInputCompare, NODE_ID, &id_item); + id_item.string = "OnFocusTestTextInputDisable"; + nodeAPI->setAttribute(textInputDisable, NODE_ID, &id_item); + + nodeAPI->addChild(column, textInput); + nodeAPI->addChild(column, textInputCompare); + nodeAPI->addChild(column, textInputDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnFocusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onfocus_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onfocus_test.h new file mode 100644 index 0000000000000000000000000000000000000000..291ae2b2ce83fdbf38a83c7b06cca915332fadc2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onfocus_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_ONFOCUS_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_ONFOCUS_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputOnFocusTest { +public: + ~TextInputOnFocusTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_ONFOCUS_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onpaste_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onpaste_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5eb9bb6a432eb290d3307de24368a118d6e410ee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onpaste_test.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_onpaste_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define TEXT_INPUT_ON_PASTE_TEST_STRING "X" +#define TEXT_INPUT_DISABLE_ON_PASTE_TEST_STRING "Y" +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_TEXT_INPUT_ON_PASTE, ON_PASTE_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnPasteTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnPasteTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnPasteTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_PASTE_EVENT_ID) { + ArkUI_StringAsyncEvent *result = OH_ArkUI_NodeEvent_GetStringAsyncEvent(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnPasteTest", "OnEventReceive pStr: %{public}s", + result->pStr); + if (::strcmp(result->pStr, TEXT_INPUT_ON_PASTE_TEST_STRING) == 0) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } +} + +napi_value TextInputOnPasteTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnPasteTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnPasteTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto textInput = createChildNode(nodeAPI); + auto textInputDisable = createChildNode(nodeAPI); + + ArkUI_NumberValue size_value[] = {{.f32 = SIZE_400}, {.f32 = SIZE_400}}; + ArkUI_AttributeItem size_item = {size_value, sizeof(size_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_SIZE, &size_item); + + ArkUI_NumberValue align_value[] = {{.i32 = ARKUI_VERTICAL_ALIGNMENT_TOP}}; + ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row, NODE_ROW_ALIGN_ITEMS, &align_item); + + ArkUI_NumberValue enter_value[] = {{.i32 = ARKUI_ENTER_KEY_TYPE_NEW_LINE}}; + ArkUI_AttributeItem enter_item = {enter_value, sizeof(enter_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInputDisable, NODE_TEXT_INPUT_ENTER_KEY_TYPE, &enter_item); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnPasteTestTextInput"; + nodeAPI->setAttribute(textInput, NODE_ID, &id_item); + id_item.string = "OnPasteTestTextInputCompare"; + nodeAPI->setAttribute(textInputDisable, NODE_ID, &id_item); + + ArkUI_AttributeItem text_item = {}; + text_item.string = TEXT_INPUT_ON_PASTE_TEST_STRING; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_TEXT, &text_item); + + text_item.string = TEXT_INPUT_DISABLE_ON_PASTE_TEST_STRING; + nodeAPI->setAttribute(textInputDisable, NODE_TEXT_INPUT_TEXT, &text_item); + + nodeAPI->addChild(row, textInput); + nodeAPI->addChild(row, textInputDisable); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnPasteTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onpaste_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onpaste_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f7e42842b2790a3b4bcbeeee34416d3cfbf51412 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onpaste_test.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_XTS_TEXTINPUT_ONPASTE_TEST_H +#define ARKUI_CAPI_XTS_TEXTINPUT_ONPASTE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputOnPasteTest { +public: + ~TextInputOnPasteTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_XTS_TEXTINPUT_ONPASTE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onsubmit_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onsubmit_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..41ebfe12f7744a212c1093c6ffc5bd73bf426eb7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onsubmit_test.cpp @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_onsubmit_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &width_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnSubmitTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnSubmitTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnSubmitTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_SUBMIT_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + if (result->data[0].i32 == ARKUI_ENTER_KEY_TYPE_DONE) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + } + } +} + +napi_value TextInputOnSubmitTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputOnSubmitTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnSubmitTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textInput = createChildNode(nodeAPI); + + nodeAPI->registerNodeEvent(textInput, NODE_TEXT_INPUT_ON_SUBMIT, ON_SUBMIT_EVENT_ID, nullptr); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnSubmitTestTextInput"; + nodeAPI->setAttribute(textInput, NODE_ID, &id_item); + + nodeAPI->addChild(column, textInput); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputOnSubmitTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onsubmit_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onsubmit_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2735ca0b202e509194abd4e8aa72b09df86b8a65 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_onsubmit_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_ONSUBMIT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_ONSUBMIT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputOnSubmitTest { +public: + ~TextInputOnSubmitTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_ONSUBMIT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_padding_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_padding_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d4ba751f780e4365d3cfbe2d71f0e482b6263ad4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_padding_test.cpp @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_padding_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputPaddingTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, float padding) +{ + float width = 100; + float height = 100; + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TextInput"; + nodeApi->setAttribute(textInput, NODE_TEXT_INPUT_TEXT, &content_item); + + // 设置组件内间距属性 + ArkUI_NumberValue paddingValue[] = {{.f32 = padding}}; + ArkUI_AttributeItem paddingItem = {paddingValue, sizeof(paddingValue) / sizeof(ArkUI_NumberValue)}; + if ((nodeApi->setAttribute(textInput, NODE_PADDING, &paddingItem)) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputPaddingTest", + "set textInput attribute abnormal value,return result 401"); + } + + return textInput; +} + +ArkUI_NodeHandle TextInputPaddingTest::CreateSubTextInputNodeWithDirection(ArkUI_NativeNodeAPI_1 *nodeApi, + float topPadding, float rightPadding, + float bottomPadding, float leftPadding) +{ + float width = 100; + float height = 100; + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TextInput"; + nodeApi->setAttribute(textInput, NODE_TEXT_INPUT_TEXT, &content_item); + + // 设置组件内间距属性 + ArkUI_NumberValue paddingValue[] = { + {.f32 = topPadding, .f32 = rightPadding, .f32 = bottomPadding, .f32 = leftPadding}}; + ArkUI_AttributeItem paddingItem = {paddingValue, sizeof(paddingValue) / sizeof(ArkUI_NumberValue)}; + if ((nodeApi->setAttribute(textInput, NODE_PADDING, &paddingItem)) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputPaddingTest", + "set textInput attribute abnormal value,return result 401"); + } + + return textInput; +} + +napi_value TextInputPaddingTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputPaddingTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputPaddingTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + float padding = 0; + auto textInput = CreateSubTextInputNode(nodeAPI, padding); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + padding = 10; + textInput = CreateSubTextInputNode(nodeAPI, padding); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + float topPadding = 0, rightPadding = 0, bottomPadding = 0, leftPadding = 0; + textInput = CreateSubTextInputNodeWithDirection(nodeAPI, topPadding, rightPadding, bottomPadding, leftPadding); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + topPadding = 10, rightPadding = 10, bottomPadding = 10, leftPadding = 10; + textInput = CreateSubTextInputNodeWithDirection(nodeAPI, topPadding, rightPadding, bottomPadding, leftPadding); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + padding = -1; + textInput = CreateSubTextInputNode(nodeAPI, padding); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + topPadding = -1, rightPadding = -1, bottomPadding = -1, leftPadding = -1; + textInput = CreateSubTextInputNodeWithDirection(nodeAPI, topPadding, rightPadding, bottomPadding, leftPadding); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputPaddingTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_padding_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_padding_test.h new file mode 100644 index 0000000000000000000000000000000000000000..81065e1a41cbcc66e83b855741c801ac7461a1ee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_padding_test.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_PADDING_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_PADDING_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputPaddingTest { +public: + ~TextInputPaddingTest(); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, float padding); + static ArkUI_NodeHandle CreateSubTextInputNodeWithDirection(ArkUI_NativeNodeAPI_1 *nodeApi, float topPadding, + float rightPadding, float bottomPadding, + float leftPadding); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_PADDING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholdercolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholdercolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..526759bc0e209704b5f5b225726e998839b3235f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholdercolor_test.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput/textinput_placeholdercolor_test.h" + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textInput; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_INPUT_TEXT"; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_PLACEHOLDER, &place_holder_item); +} + +napi_value TextInputPlaceholderColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_PLACEHOLDER_COLOR, &item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputPlaceholderColorTest::CreateNativeNodeWhite(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_PLACEHOLDER_COLOR, &item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputPlaceholderColorTest::CreateNativeNodeBlack(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.u32 = COLOR_BLACK}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_PLACEHOLDER_COLOR, &item); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholdercolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholdercolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..13f6890d9c7e65f81490c82407c25999af838eca --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholdercolor_test.h @@ -0,0 +1,36 @@ + +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_PLACEHOLDERCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_PLACEHOLDERCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputPlaceholderColorTest { +public: + ~TextInputPlaceholderColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBlack(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeWhite(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_PLACEHOLDERCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholderfont_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholderfont_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1d69f206bc73a7c55defde59c16ef23675bfdf85 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholderfont_test.cpp @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput/textinput_placeholderfont_test.h" +#include + +#define STR_TEXT "TEXT; TEXT1, TEXT2" +#define CHANGETYPEID 6666 +#define FONT_SIZE 16.0 +#define PARAM_9 9 +#define PARAM_10 10 +#define PARAM_11 11 +#define PARAM_12 12 +#define PARAM_13 13 +#define PARAM_14 14 +#define PARAM_15 15 +#define PARAM_16 16 +#define PARAM_17 17 +#define PARAM_18 18 +#define PARAM_19 19 +#define PARAM_20 20 + +namespace ArkUICApiDemo { + +static int32_t testType; +static ArkUI_NodeHandle textInput; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; +static char xComponentID[PARAM_64]; +static float PARAM_SIZE; +static int PARAM_STYLE; +static int PARAM_WEIGHT; +static uInt COLOR; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_INPUT_TEXT"; + nodeAPI->setAttribute(textInput, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextInputPlaceholderFontTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.f32 = 16}, {.i32 = ARKUI_FONT_STYLE_NORMAL}, {.i32 = ARKUI_FONT_WEIGHT_NORMAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = STR_TEXT; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &item); + + nodeAPI->addChild(column, textInput); + + // 挂载组件 + std::string idColumn(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idColumn), column); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputPlaceholderFontTest::ChangeType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputPlaceholderFontTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + nodeAPI->removeChild(column, textInput); + switch (testType) { + case PARAM_1: + PARAM_SIZE = FONT_SIZE; + PARAM_STYLE = ARKUI_FONT_STYLE_NORMAL; + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_NORMAL; + COLOR = COLOR_RED; + break; + case PARAM_2: + PARAM_SIZE = 0; + PARAM_STYLE = ARKUI_FONT_STYLE_NORMAL; + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_NORMAL; + COLOR = COLOR_YELLOW; + break; + case PARAM_3: + PARAM_SIZE = FONT_SIZE; + COLOR = COLOR_RED; + break; + case PARAM_4: + PARAM_SIZE = FONT_SIZE; + COLOR = COLOR_YELLOW; + break; + case PARAM_5: + COLOR = COLOR_RED; + break; + case PARAM_6: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W100; + COLOR = COLOR_YELLOW; + break; + case PARAM_7: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W200; + COLOR = COLOR_RED; + break; + case PARAM_8: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W300; + COLOR = COLOR_YELLOW; + break; + case PARAM_9: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W400; + COLOR = COLOR_RED; + break; + case PARAM_10: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W500; + COLOR = COLOR_YELLOW; + break; + case PARAM_11: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W600; + COLOR = COLOR_RED; + break; + case PARAM_12: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W700; + COLOR = COLOR_YELLOW; + break; + case PARAM_13: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W800; + COLOR = COLOR_RED; + break; + case PARAM_14: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_W900; + COLOR = COLOR_YELLOW; + break; + case PARAM_15: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_BOLD; + COLOR = COLOR_RED; + break; + case PARAM_16: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_NORMAL; + COLOR = COLOR_YELLOW; + break; + case PARAM_17: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_BOLDER; + COLOR = COLOR_RED; + break; + case PARAM_18: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_LIGHTER; + COLOR = COLOR_YELLOW; + break; + case PARAM_19: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_MEDIUM; + COLOR = COLOR_RED; + break; + case PARAM_20: + PARAM_WEIGHT = ARKUI_FONT_WEIGHT_REGULAR; + COLOR = COLOR_YELLOW; + break; + default: + break; + } + + nodeAPI->addChild(column, textInput); + if (PARAM_3 == testType || PARAM_4 == testType) { + ArkUI_NumberValue value[] = {{.f32 = PARAM_SIZE}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = STR_TEXT; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &value_item); + } else if (PARAM_5 == testType) { + ArkUI_NumberValue value[] = {}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = STR_TEXT; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &value_item); + } else if (PARAM_6 <= testType) { + ArkUI_NumberValue value[] = {{.f32 = PARAM_0}, {.i32 = ARKUI_FONT_STYLE_ITALIC}, {.i32 = PARAM_WEIGHT}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = STR_TEXT; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &value_item); + } else { + ArkUI_NumberValue value[] = { + {.f32 = PARAM_SIZE}, {.i32 = ARKUI_FONT_STYLE_NORMAL}, {.i32 = ARKUI_FONT_WEIGHT_NORMAL}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + value_item.string = STR_TEXT; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_PLACEHOLDER_FONT, &value_item); + } + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholderfont_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholderfont_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fc9a040ac35be85ea30819bebf48556e75068375 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_placeholderfont_test.h @@ -0,0 +1,35 @@ + +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_PLACEHOLDERFONT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_PLACEHOLDERFONT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputPlaceholderFontTest { +public: + ~TextInputPlaceholderFontTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value ChangeType(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_PLACEHOLDERFONT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_position_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_position_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7c371620a7fb253d2693a9b6fb1d2627fbc7145f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_position_test.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_position_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextInputPositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputPositionTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputPositionTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // first textInput,设置position为{10,10} + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue position_value[] = {{.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem position_item = {position_value, sizeof(position_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_POSITION, &position_item); + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textInput, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &default_height_item); + + // second textInput,设置position为{-10,-10} + auto textInput_second = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue position_second_value[] = {{.f32 = -10}, {.f32 = -10}}; + ArkUI_AttributeItem position_second_item = {position_second_value, + sizeof(position_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_second, NODE_POSITION, &position_second_item); + nodeAPI->setAttribute(textInput_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textInput_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_second, NODE_HEIGHT, &default_height_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textInput); + nodeAPI->insertChildAfter(column, textInput_second, textInput); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputPositionTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_position_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_position_test.h new file mode 100644 index 0000000000000000000000000000000000000000..fafef2f456c6905934e9a1b8c758b76903c1b6b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_position_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_POSITION_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_POSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputPositionTest { +public: + ~TextInputPositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_POSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_responseregion_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_responseregion_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..077500058733c281d0c1114b894b428f71ae49c2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_responseregion_test.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput/textinput_responseregion_test.h" + +#define X_LOCATION 0 +#define Y_LOCATION (-400) +#define WIDTH 200 +#define HEIGHT 100 +#define X_LOCATION_OTHER 80 +#define Y_LOCATION_OTHER (-40) +#define WIDTH_OTHER 200 +#define HEIGHT_OTHER 100 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textInput; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputResponseRegionTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputResponseRegionTest", + "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + if (eventId == ON_CLICK_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + ArkUI_AttributeItem place_holder_item; + place_holder_item.string = "NODE_TEXT_INPUT_TEXT"; + nodeAPI->setAttribute(textInput, NODE_TEXT_AREA_TEXT, &place_holder_item); +} + +napi_value TextInputResponseRegionTest::CreateNativeNodeSingle(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.f32 = 0}, {.f32 = 100}, {.f32 = 200}, {.f32 = 200}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_RESPONSE_REGION, &value_item); + + // 设置textInput组件id + ArkUI_AttributeItem idItem = {}; + idItem.string = "ResponseRegion"; + nodeAPI->setAttribute(textInput, NODE_ID, &idItem); + + // 绑定组件触摸事件 + nodeAPI->registerNodeEvent(textInput, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + // 绑定组件回调函数 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputResponseRegionTest::CreateNativeNodeDouble(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.f32 = 0}, {.f32 = 100}, {.f32 = 200}, {.f32 = 200}, + {.f32 = 100}, {.f32 = 0}, {.f32 = 200}, {.f32 = 200}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_RESPONSE_REGION, &value_item); + + // 设置textInput组件id + ArkUI_AttributeItem idItem = {}; + idItem.string = "ResponseRegionMulti"; + nodeAPI->setAttribute(textInput, NODE_ID, &idItem); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_responseregion_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_responseregion_test.h new file mode 100644 index 0000000000000000000000000000000000000000..268882b58acd3ff153ad54d0e3dc0ff1ebbc5225 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_responseregion_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_RESPONSEREGION_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_RESPONSEREGION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputResponseRegionTest { +public: + ~TextInputResponseRegionTest(); + static napi_value CreateNativeNodeSingle(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeDouble(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_RESPONSEREGION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_selectedbackgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_selectedbackgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d9131bc9a50d54ea9c23f7446629bf7cafd98452 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_selectedbackgroundcolor_test.cpp @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_selectedbackgroundcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +#define COLOR_TRANSPARENT_RED 0x77FF0000 + +namespace ArkUICApiDemo { + +napi_value TextInputSelectedBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputSelectedBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputSelectedBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置textInput组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // first textInput,设置selectedBackgroundColor为0xFFFF0000 + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue selectedbackgroundcolor_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem selectedbackgroundcolor_item = { + selectedbackgroundcolor_value, sizeof(selectedbackgroundcolor_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, &selectedbackgroundcolor_item); + nodeAPI->setAttribute(textInput, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &default_height_item); + ArkUI_AttributeItem content_item = {}; + content_item.string = "123456789"; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_TEXT, &content_item); + ArkUI_AttributeItem id_item = {}; + id_item.string = "0xFFFF0000_textInput"; + nodeAPI->setAttribute(textInput, NODE_ID, &id_item); + + // 设置当初始状态,全选文本 + ArkUI_NumberValue textInput_select_all_value[] = {{.i32 = PARAM_1}}; + ArkUI_AttributeItem textInput_select_all_item = {textInput_select_all_value, + sizeof(textInput_select_all_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_SELECT_ALL, &textInput_select_all_item); + + // 设置聚焦不拉起输入法 + ArkUI_NumberValue keyboard_value[] = {{.i32 = PARAM_0}}; + ArkUI_AttributeItem keyboard_item = {keyboard_value, sizeof(keyboard_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + + // 注册获取焦点事件 + nodeAPI->registerNodeEvent(textInput, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + // second textInput,设置输入框文本选中时的背景色为0x00000000 + auto textInput_second = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue selectedbackgroundcolor_second_value[] = {{.u32 = COLOR_TRANSPARENT}}; + ArkUI_AttributeItem selectedbackgroundcolor_second_item = { + selectedbackgroundcolor_second_value, sizeof(selectedbackgroundcolor_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_second, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, + &selectedbackgroundcolor_second_item); + nodeAPI->setAttribute(textInput_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput_second, NODE_TEXT_INPUT_TEXT, &content_item); + // 设置组件id + id_item.string = "0xFFFFFFFF_textInput"; + nodeAPI->setAttribute(textInput_second, NODE_ID, &id_item); + // 设置聚焦不拉起输入法 + nodeAPI->setAttribute(textInput_second, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + // 注册获取焦点事件 + nodeAPI->registerNodeEvent(textInput_second, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + // 设置当初始状态,全选文本 + nodeAPI->setAttribute(textInput_second, NODE_TEXT_INPUT_SELECT_ALL, &textInput_select_all_item); + + // third textInput,设置selectedBackgroundColor为0xFFFFFFFF + auto textInput_third = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue selectedbackgroundcolor_third_value[] = {{.u32 = COLOR_WHITE}}; + ArkUI_AttributeItem selectedbackgroundcolor_third_item = { + selectedbackgroundcolor_third_value, sizeof(selectedbackgroundcolor_third_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_third, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, + &selectedbackgroundcolor_third_item); + nodeAPI->setAttribute(textInput_third, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_third, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput_third, NODE_TEXT_INPUT_TEXT, &content_item); + // 设置组件id + id_item.string = "0x00000000_textInput"; + nodeAPI->setAttribute(textInput_third, NODE_ID, &id_item); + // 设置聚焦不拉起输入法 + nodeAPI->setAttribute(textInput_third, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + // 注册获取焦点事件 + nodeAPI->registerNodeEvent(textInput_third, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + // 设置当初始状态,全选文本 + nodeAPI->setAttribute(textInput_third, NODE_TEXT_INPUT_SELECT_ALL, &textInput_select_all_item); + + // fourth textInput,设置selectedBackgroundColor为0x77FF0000 + auto textInput_fourth = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue selectedbackgroundcolor_fourth_value[] = {{.u32 = COLOR_TRANSPARENT_RED}}; + ArkUI_AttributeItem selectedbackgroundcolor_fourth_item = { + selectedbackgroundcolor_fourth_value, sizeof(selectedbackgroundcolor_fourth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_fourth, NODE_TEXT_INPUT_SELECTED_BACKGROUND_COLOR, + &selectedbackgroundcolor_fourth_item); + nodeAPI->setAttribute(textInput_fourth, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_fourth, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput_fourth, NODE_TEXT_INPUT_TEXT, &content_item); + // 设置组件id + id_item.string = "0x77FF0000_textInput"; + nodeAPI->setAttribute(textInput_fourth, NODE_ID, &id_item); + // 设置聚焦不拉起输入法 + nodeAPI->setAttribute(textInput_fourth, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + // 注册获取焦点事件 + nodeAPI->registerNodeEvent(textInput_fourth, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + // 设置当初始状态,全选文本 + nodeAPI->setAttribute(textInput_fourth, NODE_TEXT_INPUT_SELECT_ALL, &textInput_select_all_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textInput); + nodeAPI->insertChildAfter(column, textInput_second, textInput); + nodeAPI->insertChildAfter(column, textInput_third, textInput_second); + nodeAPI->insertChildAfter(column, textInput_fourth, textInput_third); + + // 设置父column的高为300vp,子组件间隔对齐 + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputSelectedBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_selectedbackgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_selectedbackgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..84c350b54f95f5f1044e996123b575b82a54b6c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_selectedbackgroundcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_SELECTEDBACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_SELECTEDBACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputSelectedBackgroundColorTest { +public: + ~TextInputSelectedBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_SELECTEDBACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showpasswordicon_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showpasswordicon_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8bac6eb8cc9843b33437ab76fe7732a314b704dc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showpasswordicon_test.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_showpasswordicon_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextInputShowPasswordIconTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputShowPasswordIconTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputShowPasswordIconTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // first textInput,设置showPasswordIcon为0 + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue showpasswordicon_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem showpasswordicon_item = {showpasswordicon_value, + sizeof(showpasswordicon_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, &showpasswordicon_item); + ArkUI_NumberValue textinput_type_value[] = {{.i32 = ARKUI_TEXTINPUT_TYPE_PASSWORD}}; + ArkUI_AttributeItem textinput_type_item = {textinput_type_value, + sizeof(textinput_type_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_TYPE, &textinput_type_item); + nodeAPI->setAttribute(textInput, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &background_color_item); + + // second textInput,设置showPasswordIcon为1 + auto textInput_second = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue showpasswordicon_second_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem showpasswordicon_second_item = { + showpasswordicon_second_value, sizeof(showpasswordicon_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_second, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, &showpasswordicon_second_item); + nodeAPI->setAttribute(textInput_second, NODE_TEXT_INPUT_TYPE, &textinput_type_item); + nodeAPI->setAttribute(textInput_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput_second, NODE_BACKGROUND_COLOR, &background_color_item); + + // third textInput,设置showPasswordIcon为-1 + auto textInput_third = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue showpasswordicon_third_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem showpasswordicon_third_item = { + showpasswordicon_third_value, sizeof(showpasswordicon_third_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_third, NODE_TEXT_INPUT_SHOW_PASSWORD_ICON, &showpasswordicon_third_item); + nodeAPI->setAttribute(textInput_third, NODE_TEXT_INPUT_TYPE, &textinput_type_item); + nodeAPI->setAttribute(textInput_third, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_third, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput_third, NODE_BACKGROUND_COLOR, &background_color_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textInput); + nodeAPI->insertChildAfter(column, textInput_second, textInput); + nodeAPI->insertChildAfter(column, textInput_third, textInput_second); + + // 设置父column的高为300vp,子组件间隔对齐 + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputShowPasswordIconTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showpasswordicon_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showpasswordicon_test.h new file mode 100644 index 0000000000000000000000000000000000000000..545c0d8c7ee983087e961c7d028bd71b46610ab4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showpasswordicon_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_SHOWPASSWORDICON_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_SHOWPASSWORDICON_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputShowPasswordIconTest { +public: + ~TextInputShowPasswordIconTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_SHOWPASSWORDICON_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showunderline_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showunderline_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..68bef69f7e302ca05006421b6d55ba07d89b543f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showunderline_test.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput_showunderline_test.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputShowUnderlineTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, + int32_t showUnderline) +{ + float width = 200; + float height = 200; + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TextInput"; + nodeApi->setAttribute(textInput, NODE_TEXT_INPUT_TEXT, &content_item); + + // 设置组件设置是否开启下划线 + ArkUI_NumberValue showUnderlineValue[] = {{.i32 = showUnderline}}; + ArkUI_AttributeItem showUnderlineItem = {showUnderlineValue, + sizeof(showUnderlineValue) / sizeof(ArkUI_NumberValue)}; + if ((nodeApi->setAttribute(textInput, NODE_TEXT_INPUT_SHOW_UNDERLINE, &showUnderlineItem)) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputShowUnderlineTest", + "set textInput attribute abnormal value,return result 401"); + } + + return textInput; +} + +napi_value TextInputShowUnderlineTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputShowUnderlineTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputShowUnderlineTest", + "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t showUnderline = 0; + auto textInput = CreateSubTextInputNode(nodeAPI, showUnderline); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + showUnderline = 1; + textInput = CreateSubTextInputNode(nodeAPI, showUnderline); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + showUnderline = -10; + textInput = CreateSubTextInputNode(nodeAPI, showUnderline); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputShowUnderlineTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showunderline_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showunderline_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d9852cd371d695b817061680d1b005b9785dfea2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_showunderline_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_SHOWUNDERLINE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_SHOWUNDERLINE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputShowUnderlineTest { +public: + ~TextInputShowUnderlineTest(); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t showUnderline); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_SHOWUNDERLINE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_stopediting_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_stopediting_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a6b4ded5416593d9dfc88efa542a6a9f8f08203a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_stopediting_test.cpp @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textinput_stopediting_test.h" + +#define COLOR_RED 0xFFFF0000 +#define INVALID_PARAM 401 + +namespace ArkUICApiDemo { +static ArkUI_NodeHandle textInput; +static ArkUI_NodeHandle column; +static ArkUI_NativeNodeAPI_1 *nodeAPI; +static int32_t testType; + +static void BasicSet() +{ + // 创建组件并添加到容器内 + textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + ArkUI_NumberValue width_value[] = {{.f32 = 200}}; + ArkUI_NumberValue height_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &height_item); + ArkUI_NumberValue caret_color_value[] = {{.u32 = 0x00000000}}; + ArkUI_AttributeItem caret_color_item = {caret_color_value, sizeof(caret_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_CARET_COLOR, &caret_color_item); +} + +napi_value TextInputStopEditingTest::CreateNativeNodeFalse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textInput, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputStopEditingTest::CreateNativeNodeTrue(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textInput, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputStopEditingTest::CreateNativeNodeNoneTrue(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textInput, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputStopEditingTest::CreateNativeNodeNoneFalse(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textInput, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputStopEditingTest::CreateNativeNodeAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textInput, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputStopEditingTest::CreateNativeNodeNoneAbnormal(napi_env env, napi_callback_info info) +{ + // 获取id + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + BasicSet(); + + ArkUI_AttributeItem strItem; + strItem.string = "Stop"; + nodeAPI->setAttribute(textInput, NODE_ID, &strItem); + + // 挂载组件 + std::string idTextInput(xComponentID); + OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(idTextInput), textInput); + + napi_value exports; + napi_create_object(env, &exports); + + return exports; +} + +napi_value TextInputStopEditingTest::ChangeType(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputStopEditingTest", "ChangeTestType"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + napi_get_value_int32(env, args[PARAM_0], &testType); + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + bool type; + if (PARAM_1 == testType) { + type = true; + } else if (PARAM_2 == testType) { + type = false; + } else if (PARAM_3 == testType) { + type = true; + } else if (PARAM_4 == testType) { + type = false; + } else if (PARAM_5 == testType) { + type = -10; + } else if (PARAM_6 == testType) { + type = -10; + } + // 设置textInput测试属性 + ArkUI_NumberValue value[] = {{.i32 = type}}; + ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_TEXT_INPUT_EDITING, &item); + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_stopediting_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_stopediting_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bb737cdcbbee5f3b4a59a538d4b25d41d999dc59 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_stopediting_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_STOPEDITING_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_STOPEDITING_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputStopEditingTest { +public: + ~TextInputStopEditingTest(); + static napi_value CreateNativeNodeFalse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeTrue(napi_env env, napi_callback_info info); + static napi_value ChangeType(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNoneTrue(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNoneFalse(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeAbnormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNoneAbnormal(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_STOPEDITING_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_textalign_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_textalign_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..99ddd49a2ebb198d0897a0e7292958ca766cb58b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_textalign_test.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_textalign_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +ArkUI_NodeHandle TextInputTextAlignTest::CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t textAlign) +{ + float width = 100; + float height = 100; + auto textInput = nodeApi->createNode(ARKUI_NODE_TEXT_INPUT); + // 设置组件大小 + ArkUI_NumberValue widthValue[] = {{.f32 = width}}; + ArkUI_AttributeItem widthItem = {widthValue, sizeof(widthValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_WIDTH, &widthItem); + + ArkUI_NumberValue heightValue[] = {{.f32 = height}}; + ArkUI_AttributeItem heightItem = {heightValue, sizeof(heightValue) / sizeof(ArkUI_NumberValue)}; + nodeApi->setAttribute(textInput, NODE_HEIGHT, &heightItem); + + // 设置组件文本 + ArkUI_AttributeItem content_item = {}; + content_item.string = "TextInput"; + nodeApi->setAttribute(textInput, NODE_TEXT_INPUT_TEXT, &content_item); + + // 设置组件文本水平对齐方式 + ArkUI_NumberValue textAlignValue[] = {{.i32 = textAlign}}; + ArkUI_AttributeItem textAlignItem = {textAlignValue, sizeof(textAlignValue) / sizeof(ArkUI_NumberValue)}; + if ((nodeApi->setAttribute(textInput, NODE_TEXT_ALIGN, &textAlignItem)) == INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "TextInputTextAlignTest", + "set textInput attribute abnormal value,return result 401"); + } + + return textInput; +} + +napi_value TextInputTextAlignTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputTextAlignTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputTextAlignTest", "GetContext env or info is null"); + return nullptr; + } + // 创建节点组件 + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 创建容器组件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + int32_t textAlign = ArkUI_TextAlignment::ARKUI_TEXT_ALIGNMENT_START; + auto textInput = CreateSubTextInputNode(nodeAPI, textAlign); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + textAlign = ArkUI_TextAlignment::ARKUI_TEXT_ALIGNMENT_CENTER; + textInput = CreateSubTextInputNode(nodeAPI, textAlign); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + textAlign = ArkUI_TextAlignment::ARKUI_TEXT_ALIGNMENT_END; + textInput = CreateSubTextInputNode(nodeAPI, textAlign); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + textAlign = ArkUI_TextAlignment::ARKUI_TEXT_ALIGNMENT_JUSTIFY; + textInput = CreateSubTextInputNode(nodeAPI, textAlign); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + textAlign = PARAM_NEGATIVE_100; + textInput = CreateSubTextInputNode(nodeAPI, textAlign); + // 添加组件到容器 + nodeAPI->addChild(column, textInput); + + // 组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputTextAlignTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_textalign_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_textalign_test.h new file mode 100644 index 0000000000000000000000000000000000000000..126970d7198afb178fc38052aea3b787c9847e5b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_textalign_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_TEXTALIGN_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_TEXTALIGN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputTextAlignTest { +public: + ~TextInputTextAlignTest(); + static ArkUI_NodeHandle CreateSubTextInputNode(ArkUI_NativeNodeAPI_1 *nodeApi, int32_t textAlign); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_TEXTALIGN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_type_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_type_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..956e30f40cb9fd8a692a6d7bbe91d85bae648726 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_type_test.cpp @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput_type_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t type) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + + // set type + ArkUI_NumberValue type_value[] = {{.i32 = type}}; + ArkUI_AttributeItem type_item = {type_value, sizeof(type_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_INPUT_TYPE, &type_item); + + // set width + ArkUI_NumberValue width_value[] = {{.f32 = TEXTINPUT_WIDTH_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &width_item); + + // set height + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &height_item); + + // set keyboard + ArkUI_NumberValue keyboard_value[] = {{.i32 = PARAM_0}}; + ArkUI_AttributeItem keyboard_item = {keyboard_value, sizeof(keyboard_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TEXT_INPUT_ENABLE_KEYBOARD_ON_FOCUS, &keyboard_item); + + return nodeHandle; +} + +napi_value TextInputTypeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputTypeTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputTypeTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // set alignment + ArkUI_NumberValue justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem justify_content_item = {justify_content_value, + sizeof(justify_content_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_COLUMN_JUSTIFY_CONTENT, &justify_content_item); + + auto textInputFirst = createChildNode(nodeAPI, ARKUI_TEXTINPUT_TYPE_NORMAL); + ArkUI_AttributeItem text_item = {}; + text_item.string = "1.2a@@3"; + nodeAPI->setAttribute(textInputFirst, NODE_TEXT_INPUT_TEXT, &text_item); + + auto textInputFirstMiddle = createChildNode(nodeAPI, ARKUI_TEXTINPUT_TYPE_NUMBER); + nodeAPI->setAttribute(textInputFirstMiddle, NODE_TEXT_INPUT_TEXT, &text_item); + + auto textInputFirstEnd = createChildNode(nodeAPI, ARKUI_TEXTINPUT_TYPE_PHONE_NUMBER); + nodeAPI->setAttribute(textInputFirstEnd, NODE_TEXT_INPUT_TEXT, &text_item); + + auto textInputSecond = createChildNode(nodeAPI, ARKUI_TEXTINPUT_TYPE_EMAIL); + nodeAPI->setAttribute(textInputSecond, NODE_TEXT_INPUT_TEXT, &text_item); + + auto textInputSecondMiddle = createChildNode(nodeAPI, ARKUI_TEXTINPUT_TYPE_PASSWORD); + nodeAPI->setAttribute(textInputSecondMiddle, NODE_TEXT_INPUT_TEXT, &text_item); + + auto textInputSecondEnd = createChildNode(nodeAPI, ARKUI_TEXTINPUT_TYPE_NUMBER_PASSWORD); + nodeAPI->setAttribute(textInputSecondEnd, NODE_TEXT_INPUT_TEXT, &text_item); + + auto textInputThird = createChildNode(nodeAPI, ARKUI_TEXTINPUT_TYPE_SCREEN_LOCK_PASSWORD); + nodeAPI->setAttribute(textInputThird, NODE_TEXT_INPUT_TEXT, &text_item); + + auto textInputThirdMiddle = createChildNode(nodeAPI, ARKUI_TEXTINPUT_TYPE_USER_NAME); + nodeAPI->setAttribute(textInputThirdMiddle, NODE_TEXT_INPUT_TEXT, &text_item); + + auto textInputThirdEnd = createChildNode(nodeAPI, ARKUI_TEXTINPUT_TYPE_NEW_PASSWORD); + nodeAPI->setAttribute(textInputThirdEnd, NODE_TEXT_INPUT_TEXT, &text_item); + + auto textInputFourth = createChildNode(nodeAPI, ARKUI_TEXTINPUT_TYPE_NUMBER_DECIMAL); + nodeAPI->setAttribute(textInputFourth, NODE_TEXT_INPUT_TEXT, &text_item); + + auto textInputFourthEnd = createChildNode(nodeAPI, PARAM_NEGATIVE_100); + nodeAPI->setAttribute(textInputFourthEnd, NODE_TEXT_INPUT_TEXT, &text_item); + + // set row height + ArkUI_NumberValue row_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem row_height_item = {row_height_value, sizeof(row_height_value) / sizeof(ArkUI_NumberValue)}; + // set row width + ArkUI_NumberValue row_width_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem row_width_item = {row_width_value, sizeof(row_width_value) / sizeof(ArkUI_NumberValue)}; + // set row alignment + ArkUI_NumberValue row_justify_content_value[] = {{.i32 = ARKUI_FLEX_ALIGNMENT_SPACE_AROUND}}; + ArkUI_AttributeItem row_justify_content_item = {row_justify_content_value, + sizeof(row_justify_content_value) / sizeof(ArkUI_NumberValue)}; + + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_first, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_third, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_fourth, NODE_ROW_JUSTIFY_CONTENT, &row_justify_content_item); + + nodeAPI->addChild(row_first, textInputFirst); + nodeAPI->insertChildAfter(row_first, textInputFirstMiddle, textInputFirst); + nodeAPI->insertChildAfter(row_first, textInputFirstEnd, textInputFirstMiddle); + + nodeAPI->addChild(row_second, textInputSecond); + nodeAPI->insertChildAfter(row_second, textInputSecondMiddle, textInputSecond); + nodeAPI->insertChildAfter(row_second, textInputSecondEnd, textInputSecondMiddle); + + nodeAPI->addChild(row_third, textInputThird); + nodeAPI->insertChildAfter(row_third, textInputThirdMiddle, textInputThird); + nodeAPI->insertChildAfter(row_third, textInputThirdEnd, textInputThirdMiddle); + + nodeAPI->addChild(row_fourth, textInputFourth); + nodeAPI->insertChildAfter(row_fourth, textInputFourthEnd, textInputFourth); + + nodeAPI->addChild(column, row_first); + nodeAPI->insertChildAfter(column, row_second, row_first); + nodeAPI->insertChildAfter(column, row_third, row_second); + nodeAPI->insertChildAfter(column, row_fourth, row_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputTypeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, nullptr, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_type_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_type_test.h new file mode 100644 index 0000000000000000000000000000000000000000..9fb3d4c8f41255635d373921ae3c1dd8fc1772b3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_type_test.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_XTS_CB_TEXTINPUT_TYPE_TEST_H +#define ARKUI_CAPI_XTS_CB_TEXTINPUT_TYPE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +#define TEXTINPUT_WIDTH_150 150 + +class TextInputTypeTest { +public: + ~TextInputTypeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_XTS_CB_TEXTINPUT_TYPE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1f3325c275a740ff14d223176731380b0a876dc2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_width_test.cpp @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textinput/textinput_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TextInputWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置textInput组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput背景颜色 + ArkUI_NumberValue red_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue green_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem green_color_item = {green_color_value, sizeof(green_color_value) / sizeof(ArkUI_NumberValue)}; + + // first textInput,设置宽度为300 + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->setAttribute(textInput, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &red_color_item); + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + // second textInput,设置宽度为异常值 + auto textInput_second = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->setAttribute(textInput_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput_second, NODE_BACKGROUND_COLOR, &green_color_item); + ArkUI_NumberValue width_second_value[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textInput); + nodeAPI->insertChildAfter(column, textInput_second, textInput); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextInputWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputWidthTest", "CreateNativeNodeLarge"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置textInput组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textInput背景颜色 + ArkUI_NumberValue red_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem red_color_item = {red_color_value, sizeof(red_color_value) / sizeof(ArkUI_NumberValue)}; + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为超大值500 + auto textInput = nodeAPI->createNode(ARKUI_NODE_TEXT_INPUT); + nodeAPI->setAttribute(textInput, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textInput, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textInput, NODE_BACKGROUND_COLOR, &red_color_item); + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textInput, NODE_WIDTH, &width_item); + + nodeAPI->addChild(column, textInput); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextInputWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6ff1f2f1fa034b60179607ee70935ec4e740bcd4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textinput/textinput_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTINPUT_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_TEXTINPUT_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextInputWidthTest { +public: + ~TextInputWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTINPUT_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_canloop_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_canloop_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ec3c86f1eb3b7ccb46f47c48a287177cb6136956 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_canloop_test.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_canloop_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue range_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem range_item = {range_value, sizeof(range_value) / sizeof(ArkUI_NumberValue)}; + range_item.string = "apple;orange;peach"; + nodeAPI->setAttribute(textPicker, NODE_TEXT_PICKER_OPTION_RANGE, &range_item); + + return textPicker; +} + +napi_value TextPickerCanLoopTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerCanLoopTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + auto textPicker3 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + nodeAPI->addChild(column, textPicker3); + + ArkUI_NumberValue canLoop_true_value[] = {{.i32 = true}}; + ArkUI_AttributeItem canLoop_true_item = {canLoop_true_value, + sizeof(canLoop_true_value) / sizeof(ArkUI_NumberValue)}; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_CAN_LOOP, &canLoop_true_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerCanLoopTest", + "NODE_TEXT_PICKER_CAN_LOOP is %{public}d", ret); + + ArkUI_NumberValue canLoop_false_value[] = {{.i32 = false}}; + ArkUI_AttributeItem canLoop_false_item = {canLoop_false_value, + sizeof(canLoop_false_value) / sizeof(ArkUI_NumberValue)}; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_CAN_LOOP, &canLoop_false_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerCanLoopTest", + "NODE_TEXT_PICKER_CAN_LOOP is %{public}d", abnormal_ret); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "textPickerCanLoopTest"; + nodeAPI->setAttribute(textPicker1, NODE_ID, &id_item); + id_item.string = "textPickerCanLoopTestDisable"; + nodeAPI->setAttribute(textPicker2, NODE_ID, &id_item); + id_item.string = "textPickerCanLoopTestDefault"; + nodeAPI->setAttribute(textPicker3, NODE_ID, &id_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerCanLoopTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_canloop_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_canloop_test.h new file mode 100644 index 0000000000000000000000000000000000000000..08f876af90d47a4037a82e76b8f7c4ea01018cd9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_canloop_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_CANLOOP_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_CANLOOP_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerCanLoopTest { +public: + ~TextPickerCanLoopTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_CANLOOP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_defaultpickeritemheight_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_defaultpickeritemheight_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..40a325a55766bf6c012c785591a08eded4fa099a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_defaultpickeritemheight_test.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_defaultpickeritemheight_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue range_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem range_item = {range_value, sizeof(range_value) / sizeof(ArkUI_NumberValue)}; + range_item.string = "apple;orange;peach"; + nodeAPI->setAttribute(textPicker, NODE_TEXT_PICKER_OPTION_RANGE, &range_item); + + return textPicker; +} + +napi_value TextPickerDefaultPickerItemHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDefaultPickerItemHeightTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + auto textPicker3 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + nodeAPI->addChild(column, textPicker3); + + ArkUI_NumberValue height_value[] = {{.f32 = 50}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, &height_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDefaultPickerItemHeightTest", + "NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT is %{public}d", ret); + + ArkUI_NumberValue boundary_value[] = {{.f32 = 0}}; + ArkUI_AttributeItem boundary_item = {boundary_value, sizeof(boundary_value) / sizeof(ArkUI_NumberValue)}; + auto boundary_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, &boundary_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDefaultPickerItemHeightTest", + "NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT is %{public}d", boundary_ret); + + ArkUI_NumberValue abnormal_value[] = {{.f32 = -1}}; + ArkUI_AttributeItem abnormal_item = {abnormal_value, sizeof(abnormal_value) / sizeof(ArkUI_NumberValue)}; + auto abnormal_ret = nodeAPI->setAttribute(textPicker3, NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT, &abnormal_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDefaultPickerItemHeightTest", + "NODE_TEXT_PICKER_DEFAULT_PICKER_ITEM_HEIGHT is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDefaultPickerItemHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_defaultpickeritemheight_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_defaultpickeritemheight_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1781b3d0e8a36f921028e805ca82dd5267909c93 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_defaultpickeritemheight_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_DEFAULTPICKERITEMHEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_DEFAULTPICKERITEMHEIGHT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerDefaultPickerItemHeightTest { +public: + ~TextPickerDefaultPickerItemHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_DEFAULTPICKERITEMHEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_disappeartextstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_disappeartextstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6fb55abf1f1fc1fcc16f4c90c4c88bf844339224 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_disappeartextstyle_test.cpp @@ -0,0 +1,390 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textpicker_disappeartextstyle_test.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue range_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem range_item = {range_value, sizeof(range_value) / sizeof(ArkUI_NumberValue)}; + range_item.string = "apple;orange;peach"; + nodeAPI->setAttribute(textPicker, NODE_TEXT_PICKER_OPTION_RANGE, &range_item); + + return textPicker; +} + +napi_value TextPickerDisappearTextStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;bold;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + ArkUI_AttributeItem abnormal_item = {}; + abnormal_item.string = "abnormal"; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &abnormal_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerDisappearTextStyleTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;normal;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + text_style_item.string = "#ff007dff;30;normal;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerDisappearTextStyleTest::CreateNativeNodeBolder(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;bolder;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + text_style_item.string = "#ff007dff;30;bolder;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerDisappearTextStyleTest::CreateNativeNodeLighter(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;lighter;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + text_style_item.string = "#ff007dff;30;lighter;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerDisappearTextStyleTest::CreateNativeNodeMedium(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;medium;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + text_style_item.string = "#ff007dff;30;medium;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerDisappearTextStyleTest::CreateNativeNodeRegular(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;regular;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + text_style_item.string = "#ff007dff;30;regular;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerDisappearTextStyleTest::CreateNativeNodeBold(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;bold;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_disappeartextstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_disappeartextstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b716ebda709f86a19287fbd440b8fbcf1ab5e319 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_disappeartextstyle_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_DISAPPEARTEXTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_DISAPPEARTEXTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerDisappearTextStyleTest { +public: + ~TextPickerDisappearTextStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBold(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBolder(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLighter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMedium(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRegular(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_DISAPPEARTEXTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ad0ca34ab7b4182ea5e14fcdcf1d3e2b40311f83 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_height_test.cpp @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define SIZE_NEGATIVE_50 (-50) + +napi_value TextPickerHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerHeightTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置textpicker组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textpicker组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textpicker组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textpicker组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textpicker组件文本选择列表 + const char *option = "123;456;789"; + ArkUI_NumberValue option_range_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem option_range_item = {option_range_value, + sizeof(option_range_value) / sizeof(option_range_value), option}; + + // first textpicker + auto textpicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->setAttribute(textpicker, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textpicker, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textpicker, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textpicker, NODE_MARGIN, &margin_item); + nodeAPI->setAttribute(textpicker, NODE_TEXT_PICKER_OPTION_RANGE, &option_range_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textpicker, NODE_HEIGHT, &height_item); + + // second textpicker + auto textpicker_second = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->setAttribute(textpicker_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textpicker_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textpicker_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textpicker_second, NODE_MARGIN, &margin_item); + nodeAPI->setAttribute(textpicker_second, NODE_TEXT_PICKER_OPTION_RANGE, &option_range_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = SIZE_NEGATIVE_50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textpicker_second, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textpicker); + nodeAPI->insertChildAfter(column, textpicker_second, textpicker); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerHeightTest", "CreateNativeNodeLarge"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置高度为500 + auto textpicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textpicker, NODE_HEIGHT, &height_item); + + // 设置textpicker组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textpicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置宽度为200 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textpicker, NODE_WIDTH, &width_item); + + // 设置textpicker组件文本选择列表 + const char *option = "123;456;789"; + ArkUI_NumberValue option_range_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem option_range_item = {option_range_value, + sizeof(option_range_value) / sizeof(option_range_value), option}; + nodeAPI->setAttribute(textpicker, NODE_TEXT_PICKER_OPTION_RANGE, &option_range_item); + + nodeAPI->addChild(column, textpicker); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..a6251ba0837dbfd142035ab3c99fa87485248f53 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerHeightTest { +public: + ~TextPickerHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_onchange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_onchange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8aa8f7c89eeb673a8d1647b68a3b005da739603e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_onchange_test.cpp @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_onchange_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, bool enabled) +{ + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + + ArkUI_NumberValue enable_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enable_item = {enable_value, sizeof(enable_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_ENABLED, &enable_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue range_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem range_item = {range_value, sizeof(range_value) / sizeof(ArkUI_NumberValue)}; + range_item.string = "apple;orange;peach"; + nodeAPI->setAttribute(textPicker, NODE_TEXT_PICKER_OPTION_RANGE, &range_item); + + nodeAPI->registerNodeEvent(textPicker, NODE_TEXT_PICKER_EVENT_ON_CHANGE, ON_CHANGE_EVENT_ID, nullptr); + + return textPicker; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_CHANGE_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} +napi_value TextPickerOnChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerOnChangeTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI, true); + auto textPicker2 = createChildNode(nodeAPI, false); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "textPickerOnChangeTest"; + nodeAPI->setAttribute(textPicker1, NODE_ID, &id_item); + id_item.string = "textPickerOnChangeTestDisable"; + nodeAPI->setAttribute(textPicker2, NODE_ID, &id_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerOnChangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_onchange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_onchange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..561cafdd85bd6655200aedc6e5d988fa386a176b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_onchange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_ONCHANGE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_ONCHANGE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerOnChangeTest { +public: + ~TextPickerOnChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_ONCHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_range_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_range_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8b93c43ff6a18d46239f76f8cc93a13b75393420 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_range_test.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_range_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_MARGIN, &margin_item); + + return textPicker; +} + +napi_value TextPickerRangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerRangeTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row1 = nodeAPI->createNode(ARKUI_NODE_ROW); + auto row2 = nodeAPI->createNode(ARKUI_NODE_ROW); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + auto textPicker3 = createChildNode(nodeAPI); + auto textPicker4 = createChildNode(nodeAPI); + auto textPicker5 = createChildNode(nodeAPI); + + nodeAPI->addChild(row1, textPicker1); + nodeAPI->addChild(row1, textPicker2); + nodeAPI->addChild(row2, textPicker3); + nodeAPI->addChild(row2, textPicker4); + nodeAPI->addChild(column, row1); + nodeAPI->addChild(column, row2); + nodeAPI->addChild(column, textPicker5); + + ArkUI_NumberValue single_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem single_item = {single_value, sizeof(single_value) / sizeof(ArkUI_NumberValue)}; + single_item.string = "A;B;C;D"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_OPTION_RANGE, &single_item); + + ArkUI_NumberValue multi_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_MULTI}}; + ArkUI_AttributeItem multi_item = {multi_value, sizeof(multi_value) / sizeof(ArkUI_NumberValue)}; + multi_item.string = "A,B,C;A,B,C;A,B,C"; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_OPTION_RANGE, &multi_item); + + ArkUI_NumberValue range_content_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_RANGE_CONTENT}}; + ArkUI_AttributeItem range_content_item = {range_content_value, + sizeof(range_content_value) / sizeof(ArkUI_NumberValue)}; + const char *icon = "resource://media/icon.png"; + const char *text = "TEST"; + ARKUI_TextPickerRangeContent rangeContent[] = {{icon, text}, {icon, text}, {icon, text}}; + range_content_item.object = &rangeContent; + auto ret = nodeAPI->setAttribute(textPicker3, NODE_TEXT_PICKER_OPTION_RANGE, &range_content_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerRangeTest", "ret is %{public}d", ret); + + ArkUI_NumberValue cascade_range_content_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_CASCADE_RANGE_CONTENT}}; + ArkUI_AttributeItem cascade_range_content_item = {cascade_range_content_value, + sizeof(cascade_range_content_value) / sizeof(ArkUI_NumberValue)}; + + ARKUI_TextPickerCascadeRangeContent multiple_rangeContent[] = { + {text, rangeContent, sizeof(rangeContent) / sizeof(ARKUI_TextPickerRangeContent)}}; + + cascade_range_content_item.object = &multiple_rangeContent; + nodeAPI->setAttribute(textPicker4, NODE_TEXT_PICKER_OPTION_RANGE, &cascade_range_content_item); + + ArkUI_NumberValue abnormal_value[] = {{.i32 = PARAM_NEGATIVE_1}}; + ArkUI_AttributeItem abnormal_item = {abnormal_value, sizeof(abnormal_value) / sizeof(ArkUI_NumberValue)}; + abnormal_item.string = "A;B;C;D"; + nodeAPI->setAttribute(textPicker5, NODE_TEXT_PICKER_OPTION_RANGE, &abnormal_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerRangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_range_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_range_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7c5e62d19b713dab88af47b3d512178631050834 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_range_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_RANGE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_RANGE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerRangeTest { +public: + ~TextPickerRangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_RANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selected_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selected_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9a65624b23eaede203b3d165cc7924e94be82c23 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selected_test.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_selected_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_MARGIN, &margin_item); + + return textPicker; +} + +napi_value TextPickerSelectedTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + auto textPicker3 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + nodeAPI->addChild(column, textPicker3); + // 设置选择内容 + ArkUI_NumberValue single_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem single_item = {single_value, sizeof(single_value) / sizeof(ArkUI_NumberValue)}; + single_item.string = "A;B;C"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_OPTION_RANGE, &single_item); + + ArkUI_NumberValue multi_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_MULTI}}; + ArkUI_AttributeItem multi_item = {multi_value, sizeof(multi_value) / sizeof(ArkUI_NumberValue)}; + multi_item.string = "A,B,C;A,B,C;A,B,C"; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_OPTION_RANGE, &multi_item); + nodeAPI->setAttribute(textPicker3, NODE_TEXT_PICKER_OPTION_RANGE, &single_item); + + // 设置选择内容默认值索引 + ArkUI_NumberValue selected_value[] = {{.u32 = 2}}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_OPTION_SELECTED, &selected_item); + + ArkUI_NumberValue selected_multiple_value[] = {{.u32 = 2}, {.u32 = 2}, {.u32 = 2}}; + ArkUI_AttributeItem selected_multiple_item = {selected_multiple_value, + sizeof(selected_multiple_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_OPTION_SELECTED, &selected_multiple_item); + + ArkUI_NumberValue abnormal_value[] = {{.u32 = 100}}; + ArkUI_AttributeItem abnormal_value_item = {abnormal_value, sizeof(abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker3, NODE_TEXT_PICKER_OPTION_SELECTED, &abnormal_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selected_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selected_test.h new file mode 100644 index 0000000000000000000000000000000000000000..121ea8381537fd6fb26d08e76b04da15e8094cbb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selected_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_SELECTED_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_SELECTED_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerSelectedTest { +public: + ~TextPickerSelectedTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_SELECTED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedindex_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedindex_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..90b25a5a36092debba2a016a14294e466961c999 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedindex_test.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_selectedindex_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_MARGIN, &margin_item); + + return textPicker; +} + +napi_value TextPickerSelectedIndexTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedIndexTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + auto textPicker3 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + nodeAPI->addChild(column, textPicker3); + // 设置选择内容 + ArkUI_NumberValue single_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem single_item = {single_value, sizeof(single_value) / sizeof(ArkUI_NumberValue)}; + single_item.string = "A;B;C"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_OPTION_RANGE, &single_item); + + ArkUI_NumberValue multi_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_MULTI}}; + ArkUI_AttributeItem multi_item = {multi_value, sizeof(multi_value) / sizeof(ArkUI_NumberValue)}; + multi_item.string = "A,B,C;A,B,C;A,B,C"; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_OPTION_RANGE, &multi_item); + nodeAPI->setAttribute(textPicker3, NODE_TEXT_PICKER_OPTION_RANGE, &single_item); + + // 设置选择内容默认值索引 + ArkUI_NumberValue selected_value[] = {{.u32 = 1}}; + ArkUI_AttributeItem selected_item = {selected_value, sizeof(selected_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_OPTION_SELECTED, &selected_item); + + ArkUI_NumberValue selected_multiple_value[] = {{.u32 = 1}, {.u32 = 1}, {.u32 = 1}}; + ArkUI_AttributeItem selected_multiple_item = {selected_multiple_value, + sizeof(selected_multiple_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_OPTION_SELECTED, &selected_multiple_item); + nodeAPI->setAttribute(textPicker3, NODE_TEXT_PICKER_OPTION_SELECTED, &selected_item); + + // 设置selectedIndex + ArkUI_NumberValue selectedIndex_value[] = {{.u32 = 2}}; + ArkUI_AttributeItem selectedIndex_item = {selectedIndex_value, + sizeof(selectedIndex_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_SELECTED_INDEX, &selectedIndex_item); + + ArkUI_NumberValue selectedIndex_multiple_value[] = {{.u32 = 2}, {.u32 = 2}, {.u32 = 2}}; + ArkUI_AttributeItem selectedIndex_multiple_item = { + selectedIndex_multiple_value, sizeof(selectedIndex_multiple_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_SELECTED_INDEX, &selectedIndex_multiple_item); + + ArkUI_NumberValue abnormal_value[] = {{.u32 = 100}}; + ArkUI_AttributeItem abnormal_item = {abnormal_value, sizeof(abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker3, NODE_TEXT_PICKER_SELECTED_INDEX, &abnormal_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedIndexTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedindex_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedindex_test.h new file mode 100644 index 0000000000000000000000000000000000000000..7ceb2747dc0ddc2618656eb1ffefd10b98484083 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedindex_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_SELECTEDINDEX_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_SELECTEDINDEX_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerSelectedIndexTest { +public: + ~TextPickerSelectedIndexTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_SELECTEDINDEX_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedtextstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedtextstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ba43c54f56690efcf300acda18e30ef8c25d5870 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedtextstyle_test.cpp @@ -0,0 +1,414 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textpicker_selectedtextstyle_test.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue range_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem range_item = {range_value, sizeof(range_value) / sizeof(ArkUI_NumberValue)}; + range_item.string = "apple;orange;peach;pear;watermelon"; + nodeAPI->setAttribute(textPicker, NODE_TEXT_PICKER_OPTION_RANGE, &range_item); + + return textPicker; +} + +napi_value TextPickerSelectedTextStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;normal;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + ArkUI_AttributeItem abnormal_item = {}; + abnormal_item.string = "abnormal"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &abnormal_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerSelectedTextStyleTest::CreateNativeNodeBold(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;bold;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff182431;50;bold;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerSelectedTextStyleTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;normal;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerSelectedTextStyleTest::CreateNativeNodeBolder(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;bolder;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff182431;50;bolder;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerSelectedTextStyleTest::CreateNativeNodeLighter(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;lighter;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff182431;50;lighter;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerSelectedTextStyleTest::CreateNativeNodeMedium(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;medium;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff182431;50;medium;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerSelectedTextStyleTest::CreateNativeNodeRegular(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;regular;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff182431;50;regular;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedtextstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedtextstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..56da04be1489394be5f1c41f6ab79324e35943c3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_selectedtextstyle_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_SELECTEDTEXTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_SELECTEDTEXTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerSelectedTextStyleTest { +public: + ~TextPickerSelectedTextStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBold(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBolder(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLighter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMedium(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRegular(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_SELECTEDTEXTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_textstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_textstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f14e5f2eeb7000147329dc62172f6f0f3234ec69 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_textstyle_test.cpp @@ -0,0 +1,409 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "textpicker_textstyle_test.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue range_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem range_item = {range_value, sizeof(range_value) / sizeof(ArkUI_NumberValue)}; + range_item.string = "apple;orange;peach;pear;watermelon"; + nodeAPI->setAttribute(textPicker, NODE_TEXT_PICKER_OPTION_RANGE, &range_item); + + return textPicker; +} + +napi_value TextPickerTextStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;normal;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + ArkUI_AttributeItem abnormal_item = {}; + abnormal_item.string = "abnormal"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_TEXT_STYLE, &abnormal_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerTextStyleTest::CreateNativeNodeBold(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;bold;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff007dff;30;bold;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerTextStyleTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;normal;Arial,HarmonyOS Sans;italic"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerTextStyleTest::CreateNativeNodeBolder(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;bolder;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff007dff;30;bolder;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerTextStyleTest::CreateNativeNodeLighter(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;lighter;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff007dff;30;lighter;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerTextStyleTest::CreateNativeNodeMedium(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;medium;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff007dff;30;medium;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerTextStyleTest::CreateNativeNodeRegular(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI); + auto textPicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;regular;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff007dff;30;regular;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(textPicker2, NODE_TEXT_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_textstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_textstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..d757586d5888debba67d18ba170da20de9b21e12 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_textstyle_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_TEXTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_TEXTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerTextStyleTest { +public: + ~TextPickerTextStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBold(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBolder(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLighter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMedium(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRegular(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_TEXTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_value_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_value_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7b18c4979f4f72314ae43688434d7b1760d6bfef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_value_test.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_value_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t range) +{ + auto textPicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textPicker, NODE_MARGIN, &margin_item); + + if (range == ARKUI_TEXTPICKER_RANGETYPE_SINGLE) { + ArkUI_NumberValue range_value[] = {{.i32 = range}}; + ArkUI_AttributeItem range_item = {range_value, sizeof(range_value) / sizeof(ArkUI_NumberValue)}; + range_item.string = "A;B;C"; + nodeAPI->setAttribute(textPicker, NODE_TEXT_PICKER_OPTION_RANGE, &range_item); + }; + + if (range == ARKUI_TEXTPICKER_RANGETYPE_MULTI) { + ArkUI_NumberValue range_value[] = {{.i32 = range}}; + ArkUI_AttributeItem range_item = {range_value, sizeof(range_value) / sizeof(ArkUI_NumberValue)}; + range_item.string = "A,B,C;A,B,C;A,B,C"; + nodeAPI->setAttribute(textPicker, NODE_TEXT_PICKER_OPTION_RANGE, &range_item); + ArkUI_AttributeItem multi_item = {}; + multi_item.string = "B;B;B"; + nodeAPI->setAttribute(textPicker, NODE_TEXT_PICKER_OPTION_VALUE, &multi_item); + }; + + return textPicker; +} + +napi_value TextPickerValueTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerValueTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto textPicker1 = createChildNode(nodeAPI, ARKUI_TEXTPICKER_RANGETYPE_SINGLE); + auto textPicker2 = createChildNode(nodeAPI, ARKUI_TEXTPICKER_RANGETYPE_MULTI); + auto textPicker3 = createChildNode(nodeAPI, ARKUI_TEXTPICKER_RANGETYPE_SINGLE); + + nodeAPI->addChild(column, textPicker1); + nodeAPI->addChild(column, textPicker2); + nodeAPI->addChild(column, textPicker3); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "B"; + nodeAPI->setAttribute(textPicker1, NODE_TEXT_PICKER_OPTION_VALUE, &single_item); + + ArkUI_AttributeItem abnormal_item = {}; + abnormal_item.string = "D"; + nodeAPI->setAttribute(textPicker3, NODE_TEXT_PICKER_OPTION_VALUE, &abnormal_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerValueTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_value_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_value_test.h new file mode 100644 index 0000000000000000000000000000000000000000..753bab8587748af9a7fb0030b79711a2a24da0b8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_value_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_VALUE_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_VALUE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerValueTest { +public: + ~TextPickerValueTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_VALUE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e3b1e23c4d620661598c5de1cbc599e095f3ee5b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_width_test.cpp @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "textpicker_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define SIZE_NEGATIVE_100 (-100) + +napi_value TextPickerWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerWidthTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置textpicker组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textpicker组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textpicker组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textpicker组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // 设置textpicker组件文本选择列表 + const char *option = "123;456;789"; + ArkUI_NumberValue option_range_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem option_range_item = {option_range_value, + sizeof(option_range_value) / sizeof(option_range_value), option}; + + // first textpicker + auto textpicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->setAttribute(textpicker, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textpicker, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textpicker, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textpicker, NODE_MARGIN, &margin_item); + nodeAPI->setAttribute(textpicker, NODE_TEXT_PICKER_OPTION_RANGE, &option_range_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textpicker, NODE_WIDTH, &width_item); + + // second textpicker + auto textpicker_second = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + nodeAPI->setAttribute(textpicker_second, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(textpicker_second, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(textpicker_second, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(textpicker_second, NODE_MARGIN, &margin_item); + nodeAPI->setAttribute(textpicker_second, NODE_TEXT_PICKER_OPTION_RANGE, &option_range_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = SIZE_NEGATIVE_100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textpicker_second, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, textpicker); + nodeAPI->insertChildAfter(column, textpicker_second, textpicker); + + // textpicker组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TextPickerWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerWidthTest", "CreateNativeNodeLarge"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为500 + auto textpicker = nodeAPI->createNode(ARKUI_NODE_TEXT_PICKER); + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textpicker, NODE_WIDTH, &width_item); + + // 设置textpicker组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textpicker, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置textpicker组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(textpicker, NODE_HEIGHT, &default_height_item); + + // 设置textpicker组件文本选择列表 + const char *option = "123;456;789"; + ArkUI_NumberValue option_range_value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; + ArkUI_AttributeItem option_range_item = {option_range_value, + sizeof(option_range_value) / sizeof(option_range_value), option}; + nodeAPI->setAttribute(textpicker, NODE_TEXT_PICKER_OPTION_RANGE, &option_range_item); + + nodeAPI->addChild(column, textpicker); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TextPickerWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b7c8f9a8792ea8cc3fc0b39971cbaacad9c08405 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/textpicker/textpicker_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TEXTPICKER_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_TEXTPICKER_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TextPickerWidthTest { +public: + ~TextPickerWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TEXTPICKER_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_disappeartextstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_disappeartextstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6476e9a38af3a31673243f7499c58208a2134fae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_disappeartextstyle_test.cpp @@ -0,0 +1,388 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "timepicker_disappeartextstyle_test.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem value_item = {.string = "22-8"}; + nodeAPI->setAttribute(timePicker, NODE_TIME_PICKER_SELECTED, &value_item); + + return timePicker; +} + +napi_value TimePickerDisappearTextStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;bold;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + ArkUI_AttributeItem abnormal_item = {}; + abnormal_item.string = "abnormal"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &abnormal_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerDisappearTextStyleTest::CreateNativeNodeBold(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;bold;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerDisappearTextStyleTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;normal;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + text_style_item.string = "#ff007dff;30;normal;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerDisappearTextStyleTest::CreateNativeNodeBolder(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;bolder;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + text_style_item.string = "#ff007dff;30;bolder;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerDisappearTextStyleTest::CreateNativeNodeLighter(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;lighter;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + text_style_item.string = "#ff007dff;30;lighter;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerDisappearTextStyleTest::CreateNativeNodeMedium(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;medium;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + text_style_item.string = "#ff007dff;30;medium;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerDisappearTextStyleTest::CreateNativeNodeRegular(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem text_style_item = {}; + text_style_item.string = "#ff007dff;30;regular;Arial,HarmonyOS Sans;normal"; + nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + text_style_item.string = "#ff007dff;30;regular;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_DISAPPEAR_TEXT_STYLE, &text_style_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerDisappearTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_disappeartextstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_disappeartextstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..57516182cbc3fb0b86f887e944c1b85a05017c5e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_disappeartextstyle_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_DISAPPEARTEXTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_DISAPPEARTEXTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerDisappearTextStyleTest { +public: + ~TimePickerDisappearTextStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBold(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBolder(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLighter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMedium(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRegular(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_DISAPPEARTEXTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4847933987aeb27b3676fc02953753b356b06918 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_height_test.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "timepicker_height_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, float height) +{ + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = height}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_AttributeItem value_item = {.string = "22-8"}; + nodeAPI->setAttribute(timePicker, NODE_TIME_PICKER_SELECTED, &value_item); + + return timePicker; +} + +napi_value TimePickerHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerHeightTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto row = nodeAPI->createNode(ARKUI_NODE_ROW); + auto timePicker1 = createChildNode(nodeAPI, SIZE_300); + auto timePicker2 = createChildNode(nodeAPI, PARAM_NEGATIVE_1); + auto timePicker3 = createChildNode(nodeAPI, 1000); + nodeAPI->addChild(row, timePicker1); + nodeAPI->addChild(row, timePicker2); + nodeAPI->addChild(row, timePicker3); + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), row) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1747ac7fe4e2f287dec4b93d511460afcad24754 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_height_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_HEIGHT_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerHeightTest { +public: + ~TimePickerHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_onchange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_onchange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c12768fb93e4d203b7d68932a6010bbffa414569 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_onchange_test.cpp @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "timepicker_onchange_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem value_item = {.string = "22-8"}; + nodeAPI->setAttribute(timePicker, NODE_TIME_PICKER_SELECTED, &value_item); + + nodeAPI->registerNodeEvent(timePicker, NODE_TIME_PICKER_EVENT_ON_CHANGE, ON_CHANGE_EVENT_ID, nullptr); + + return timePicker; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive: event is null"); + return; + } + + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "CommonEventOnClickTest", "OnEventReceive eventId: %{public}d", + eventId); + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + + // 事件回调时,修改组件背景色 + if (eventId == ON_CHANGE_EVENT_ID) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &background_color_item); + return; + } +} +napi_value TimePickerOnChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerOnChangeTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker); + + ArkUI_AttributeItem id_item = {}; + id_item.string = "timePickerOnChangeTest"; + nodeAPI->setAttribute(timePicker, NODE_ID, &id_item); + + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerOnChangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_onchange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_onchange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3bf8a9eeb620c135afec313657e2724afd3704cf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_onchange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_ONCHANGE_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_ONCHANGE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerOnChangeTest { +public: + ~TimePickerOnChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_ONCHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selected_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selected_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b1dbfc40c603661f007d0fa2e1fb7f453f1c03e7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selected_test.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "timepicker_selected_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + return timePicker; +} + +napi_value TimePickerSelectedTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem value_item = {.string = "22-8"}; + nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_SELECTED, &value_item); + ArkUI_AttributeItem abnormal_value_item = {.string = ""}; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_SELECTED, &abnormal_value_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selected_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selected_test.h new file mode 100644 index 0000000000000000000000000000000000000000..432bd4f350c0c28c07619dc87465cc6e74a71976 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selected_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_SELECTED_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_SELECTED_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerSelectedTest { +public: + ~TimePickerSelectedTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_SELECTED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selectedtextstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selectedtextstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e926d6da0653ea9496aee0372d98130d8f248032 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selectedtextstyle_test.cpp @@ -0,0 +1,404 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "timepicker_selectedtextstyle_test.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem value_item = {.string = "22-8"}; + nodeAPI->setAttribute(timePicker, NODE_TIME_PICKER_SELECTED, &value_item); + + return timePicker; +} + +napi_value TimePickerSelectedTextStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;normal;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + ArkUI_AttributeItem abnormal_item = {}; + abnormal_item.string = "abnormal"; + auto abnormal_ret = nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &abnormal_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerSelectedTextStyleTest::CreateNativeNodeBold(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;bold;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff182431;50;bold;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerSelectedTextStyleTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;normal;Arial,HarmonyOS Sans;italic"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerSelectedTextStyleTest::CreateNativeNodeBolder(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;bolder;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff182431;50;bolder;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerSelectedTextStyleTest::CreateNativeNodeLighter(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;lighter;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff182431;50;lighter;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerSelectedTextStyleTest::CreateNativeNodeMedium(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;medium;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff182431;50;medium;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerSelectedTextStyleTest::CreateNativeNodeRegular(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff182431;50;regular;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "NODE_TEXT_PICKER_SELECTED_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff182431;50;regular;Arial,HarmonyOS Sans;italic"; + nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_SELECTED_TEXT_STYLE, &single_item); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerSelectedTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selectedtextstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selectedtextstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..1f416ba7eba535621dd6ee50cb1a37c8725f4ee8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_selectedtextstyle_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_SELECTEDTEXTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_SELECTEDTEXTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerSelectedTextStyleTest { +public: + ~TimePickerSelectedTextStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBold(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBolder(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLighter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMedium(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRegular(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_SELECTEDTEXTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_textstyle_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_textstyle_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9b22d5ddb9031468433c8f27af2eaedd57678b7c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_textstyle_test.cpp @@ -0,0 +1,407 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "../manager/plugin_manager.h" +#include "timepicker_textstyle_test.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_250}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem value_item = {.string = "22-8"}; + nodeAPI->setAttribute(timePicker, NODE_TIME_PICKER_SELECTED, &value_item); + + return timePicker; +} + +napi_value TimePickerTextStyleTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;normal;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + ArkUI_AttributeItem abnormal_item = {}; + abnormal_item.string = "abnormal"; + auto abnormal_ret = nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_TEXT_STYLE, &abnormal_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerTextStyleTest::CreateNativeNodeBold(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;bold;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff007dff;30;bold;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerTextStyleTest::CreateNativeNodeNormal(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;normal;Arial,HarmonyOS Sans;italic"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerTextStyleTest::CreateNativeNodeBolder(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;bolder;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff007dff;30;bolder;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerTextStyleTest::CreateNativeNodeLighter(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;lighter;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff007dff;30;lighter;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerTextStyleTest::CreateNativeNodeMedium(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;medium;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff007dff;30;medium;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TimePickerTextStyleTest::CreateNativeNodeRegular(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timePicker1 = createChildNode(nodeAPI); + auto timePicker2 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timePicker1); + nodeAPI->addChild(column, timePicker2); + + ArkUI_AttributeItem single_item = {}; + single_item.string = "#ff007dff;30;regular;Arial,HarmonyOS Sans;normal"; + auto ret = nodeAPI->setAttribute(timePicker1, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", ret); + + single_item.string = "#ff007dff;30;regular;Arial,HarmonyOS Sans;italic"; + auto abnormal_ret = nodeAPI->setAttribute(timePicker2, NODE_TIME_PICKER_TEXT_STYLE, &single_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "NODE_TEXT_PICKER_TEXT_STYLE is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerTextStyleTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_textstyle_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_textstyle_test.h new file mode 100644 index 0000000000000000000000000000000000000000..01a7d21e2d2ba508f1d615a6b54a296f8f9e793a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_textstyle_test.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_TEXTSTYLE_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_TEXTSTYLE_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerTextStyleTest { +public: + ~TimePickerTextStyleTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBold(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeNormal(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeBolder(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLighter(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMedium(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeRegular(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_TEXTSTYLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_usemilitarytime_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_usemilitarytime_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8a73a215be6f328b6a6873f3c25983e553905261 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_usemilitarytime_test.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "timepicker_usemilitarytime_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto timePicker = nodeAPI->createNode(ARKUI_NODE_TIME_PICKER); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_150}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_HEIGHT, &height_item); + + ArkUI_NumberValue borderWidth_value[] = {{.f32 = PARAM_2}}; + ArkUI_AttributeItem borderWidth_value_item = {borderWidth_value, + sizeof(borderWidth_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_BORDER_WIDTH, &borderWidth_value_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(timePicker, NODE_MARGIN, &margin_item); + + ArkUI_AttributeItem value_item = {.string = "22-8"}; + nodeAPI->setAttribute(timePicker, NODE_TIME_PICKER_SELECTED, &value_item); + + return timePicker; +} + +napi_value TimePickerUseMilitaryTimeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerUseMilitaryTimeTest", + "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto timepicker1 = createChildNode(nodeAPI); + auto timepicker2 = createChildNode(nodeAPI); + auto timepicker3 = createChildNode(nodeAPI); + + nodeAPI->addChild(column, timepicker1); + nodeAPI->addChild(column, timepicker2); + nodeAPI->addChild(column, timepicker3); + + ArkUI_NumberValue true_value[] = {{.i32 = true}}; + ArkUI_AttributeItem true_value_item = {true_value, sizeof(true_value) / sizeof(ArkUI_NumberValue)}; + auto ret = nodeAPI->setAttribute(timepicker1, NODE_TIME_PICKER_USE_MILITARY_TIME, &true_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerUseMilitaryTimeTest", + "NODE_TIME_PICKER_USE_MILITARY_TIME is %{public}d", ret); + + ArkUI_NumberValue false_value[] = {{.i32 = false}}; + ArkUI_AttributeItem false_value_item = {false_value, sizeof(false_value) / sizeof(ArkUI_NumberValue)}; + auto false_ret = nodeAPI->setAttribute(timepicker2, NODE_TIME_PICKER_USE_MILITARY_TIME, &false_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerUseMilitaryTimeTest", + "NODE_TIME_PICKER_USE_MILITARY_TIME is %{public}d", false_ret); + + ArkUI_NumberValue abnormal_value[] = {{.i32 = PARAM_NEGATIVE_1}}; + ArkUI_AttributeItem abnormal_value_item = {abnormal_value, sizeof(abnormal_value) / sizeof(ArkUI_NumberValue)}; + auto abnormal_ret = nodeAPI->setAttribute(timepicker3, NODE_TIME_PICKER_USE_MILITARY_TIME, &abnormal_value_item); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerUseMilitaryTimeTest", + "NODE_TIME_PICKER_USE_MILITARY_TIME is %{public}d", abnormal_ret); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "TimePickerUseMilitaryTimeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_usemilitarytime_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_usemilitarytime_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6d197bd49d0e0f15696063a3a3b64370a1bccd84 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/timepicker/timepicker_usemilitarytime_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TIMEPICKER_USEMILITARYTIME_TEST_H +#define ARKUI_CAPI_DEMO_TIMEPICKER_USEMILITARYTIME_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class TimePickerUseMilitaryTimeTest { +public: + ~TimePickerUseMilitaryTimeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TIMEPICKER_USEMILITARYTIME_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_backgroundcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_backgroundcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1a668f6bd7828efeef4de10efb1435d88df6f14e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_backgroundcolor_test.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_backgroundcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleBackgroundColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleBackgroundColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleBackgroundColorTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // Toggle1:圆形滑块颜色为红色0xFFFF0000 + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue background_color_value[] = {{.u32 = 0xFFFFAAAA}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_BACKGROUND_COLOR, &background_color_item); + + // Toggle2:圆形滑块颜色为透明色0x00000000 + auto toggle_small = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue background_color_small_value[] = {{.u32 = 0x00000000}}; + ArkUI_AttributeItem background_small_color_item = { + background_color_small_value, sizeof(background_color_small_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_small, NODE_BACKGROUND_COLOR, &background_small_color_item); + + // Toggle3:圆形滑块颜色为白色0xFFFFFFFF + auto toggle_large = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue background_color_large_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem background_large_color_item = { + background_color_large_value, sizeof(background_color_large_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_large, NODE_BACKGROUND_COLOR, &background_large_color_item); + + // 添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, toggle); + nodeAPI->addChild(column, toggle_small); + nodeAPI->addChild(column, toggle_large); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleBackgroundColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_backgroundcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_backgroundcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..40627174f657d3d4788012c180cb459b8d633c86 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_backgroundcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_BACKGROUNDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_BACKGROUNDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleBackgroundColorTest { +public: + ~ToggleBackgroundColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_BACKGROUNDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_clip_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_clip_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..58e0c38e47a68ded70c264d99dc422f1fb382bf0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_clip_test.cpp @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_clip_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleClipTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleClipTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleClipTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // toggle在第一行的左边,裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE,矩形宽度:20,矩形高度:20,矩形圆角宽度:3,矩形圆角高度:3,圆形滑块颜色为红色 + auto toggle_first = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue switchpointcolor_red_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem switchpointcolor_red_item = {switchpointcolor_red_value, + sizeof(switchpointcolor_red_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_red_item); + ArkUI_NumberValue clip_rect_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 20}, {.f32 = 20}, {.f32 = 3}, {.f32 = 3}}; + ArkUI_AttributeItem clip_rect_item = {clip_rect_value, sizeof(clip_rect_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first, NODE_CLIP_SHAPE, &clip_rect_item); + + // toggle在第一行的中间,裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE,矩形宽度:-20,矩形高度:-20,矩形圆角宽度:-3,矩形圆角高度:-3,圆形滑块颜色为红色 + auto toggle_first_middle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->setAttribute(toggle_first_middle, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_red_item); + ArkUI_NumberValue clip_rect_abnormal_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = -20}, {.f32 = -20}, {.f32 = -3}, {.f32 = -3}}; + ArkUI_AttributeItem clip_rect_abnormal_item = {clip_rect_abnormal_value, + sizeof(clip_rect_abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first_middle, NODE_CLIP_SHAPE, &clip_rect_abnormal_item); + + // toggle在第一行的最后,裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE,矩形宽度:30000,矩形高度:30000,矩形圆角宽度:10000,矩形圆角高度:10000,圆形滑块颜色为红色 + auto toggle_first_end = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->setAttribute(toggle_first_end, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_red_item); + ArkUI_NumberValue clip_rect_large_value[] = { + {.i32 = ARKUI_CLIP_TYPE_RECTANGLE}, {.f32 = 30000}, {.f32 = 30000}, {.f32 = 10000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_rect_large_item = {clip_rect_large_value, + sizeof(clip_rect_large_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first_end, NODE_CLIP_SHAPE, &clip_rect_large_item); + + // toggle在第二行的左边,裁剪类型:ARKUI_CLIP_TYPE_CIRCLE,圆形宽度:20,圆形高度:20,圆形滑块颜色为绿色 + auto toggle_second = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue switchpointcolor_green_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem switchpointcolor_green_item = { + switchpointcolor_green_value, sizeof(switchpointcolor_green_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_green_item); + ArkUI_NumberValue clip_circle_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 20}, {.f32 = 20}}; + ArkUI_AttributeItem clip_circle_item = {clip_circle_value, sizeof(clip_circle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second, NODE_CLIP_SHAPE, &clip_circle_item); + + // toggle在第二行的中间,裁剪类型:ARKUI_CLIP_TYPE_CIRCLE,圆形宽度:-20,圆形高度:-20,圆形滑块颜色为绿色 + auto toggle_second_middle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->setAttribute(toggle_second_middle, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_green_item); + ArkUI_NumberValue clip_circle_middle_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = -20}, {.f32 = -20}}; + ArkUI_AttributeItem clip_circle_middle_item = {clip_circle_middle_value, + sizeof(clip_circle_middle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second_middle, NODE_CLIP_SHAPE, &clip_circle_middle_item); + + // toggle在第二行的最后,裁剪类型:ARKUI_CLIP_TYPE_CIRCLE,圆形宽度:10000,圆形高度:10000,圆形滑块颜色为绿色 + auto toggle_second_end = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->setAttribute(toggle_second_end, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_green_item); + ArkUI_NumberValue clip_circle_end_value[] = {{.i32 = ARKUI_CLIP_TYPE_CIRCLE}, {.f32 = 10000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_circle_end_item = {clip_circle_end_value, + sizeof(clip_circle_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second_end, NODE_CLIP_SHAPE, &clip_circle_end_item); + + // toggle在第三行的左边,裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE,椭圆形宽度:35,椭圆形高度:20,圆形滑块颜色为蓝色 + auto toggle_third = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue switchpointcolor_blue_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem switchpointcolor_blue_item = {switchpointcolor_blue_value, + sizeof(switchpointcolor_blue_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_third, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_blue_item); + ArkUI_NumberValue clip_ellipse_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 35}, {.f32 = 20}}; + ArkUI_AttributeItem clip_ellipse_item = {clip_ellipse_value, + sizeof(clip_ellipse_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_third, NODE_CLIP_SHAPE, &clip_ellipse_item); + + // toggle在第三行的中间,裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE,椭圆形宽度:-35,椭圆形高度:-20,圆形滑块颜色为蓝色 + auto toggle_third_middle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->setAttribute(toggle_third_middle, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_blue_item); + ArkUI_NumberValue clip_ellipse_middle_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = -35}, {.f32 = -20}}; + ArkUI_AttributeItem clip_ellipse_middle_item = {clip_ellipse_middle_value, + sizeof(clip_ellipse_middle_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_third_middle, NODE_CLIP_SHAPE, &clip_ellipse_middle_item); + + // toggle在第三行的最后,裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE,椭圆形宽度:20000,椭圆形高度:10000,圆形滑块颜色为蓝色 + auto toggle_third_end = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->setAttribute(toggle_third_end, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_blue_item); + ArkUI_NumberValue clip_ellipse_end_value[] = {{.i32 = ARKUI_CLIP_TYPE_ELLIPSE}, {.f32 = 20000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_ellipse_end_item = {clip_ellipse_end_value, + sizeof(clip_ellipse_end_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_third_end, NODE_CLIP_SHAPE, &clip_ellipse_end_item); + + // toggle在第四行的左边,裁剪类型:ARKUI_CLIP_TYPE_PATH,路径宽度:35,路径高度:20,路径绘制的命令字符串:"M0 0 H20 + // V20 H0 Z",圆形滑块颜色为黄色 + auto toggle_fourth = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue switchpointcolor_yellow_value[] = {{.u32 = 0xFFFFFF00}}; + ArkUI_AttributeItem switchpointcolor_yellow_item = { + switchpointcolor_yellow_value, sizeof(switchpointcolor_yellow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_fourth, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_yellow_item); + ArkUI_NumberValue clip_path_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 35}, {.f32 = 20}}; + std::string path = "M0 0 H20 V20 H0 Z"; + ArkUI_AttributeItem clip_path_item = {clip_path_value, sizeof(clip_path_value) / sizeof(ArkUI_NumberValue), + path.c_str()}; + nodeAPI->setAttribute(toggle_fourth, NODE_CLIP_SHAPE, &clip_path_item); + + // toggle在第四行的中间,裁剪类型:ARKUI_CLIP_TYPE_PATH,路径宽度:-35,路径高度:-20,路径绘制的命令字符串:"",圆形滑块颜色为黄色 + auto toggle_fourth_middle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->setAttribute(toggle_fourth_middle, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_yellow_item); + ArkUI_NumberValue clip_path_abnormal_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = -35}, {.f32 = -20}}; + std::string null_path = ""; + ArkUI_AttributeItem clip_path_abnormal_item = { + clip_path_abnormal_value, sizeof(clip_path_abnormal_value) / sizeof(ArkUI_NumberValue), null_path.c_str()}; + nodeAPI->setAttribute(toggle_fourth_middle, NODE_CLIP_SHAPE, &clip_path_abnormal_item); + + // toggle在第四行的右边,裁剪类型:ARKUI_CLIP_TYPE_PATH,路径宽度:10000,路径高度:10000,路径绘制的命令字符串:"M0 + // 0 H20 V20 H0 Z",圆形滑块颜色为黄色 + auto toggle_fourth_end = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + nodeAPI->setAttribute(toggle_fourth_end, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_yellow_item); + ArkUI_NumberValue clip_path_large_value[] = {{.i32 = ARKUI_CLIP_TYPE_PATH}, {.f32 = 10000}, {.f32 = 10000}}; + ArkUI_AttributeItem clip_path_large_item = { + clip_path_large_value, sizeof(clip_path_large_value) / sizeof(ArkUI_NumberValue), path.c_str()}; + nodeAPI->setAttribute(toggle_fourth_end, NODE_CLIP_SHAPE, &clip_path_large_item); + + // toggle在第五行的左边,NODE_CLIP设置为1,圆形滑块颜色为白色,宽为35vp,高为20vp + auto toggle_fifth = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue clip_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem clip_item = {clip_value, sizeof(clip_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_fifth, NODE_CLIP, &clip_item); + ArkUI_NumberValue toggle_width_value[] = {{.f32 = 35}}; + ArkUI_AttributeItem toggle_width_item = {toggle_width_value, + sizeof(toggle_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_fifth, NODE_WIDTH, &toggle_width_item); + ArkUI_NumberValue toggle_height_value[] = {{.f32 = 20}}; + ArkUI_AttributeItem toggle_height_item = {toggle_height_value, + sizeof(toggle_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_fifth, NODE_HEIGHT, &toggle_height_item); + + // toggle在第五行的中间,NODE_CLIP设置为0,圆形滑块颜色为白色,宽为35vp,高为20vp + auto toggle_fifth_middle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue clip_false_value[] = {{.i32 = 0}}; + ArkUI_AttributeItem clip_false_item = {clip_false_value, sizeof(clip_false_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_fifth_middle, NODE_CLIP, &clip_false_item); + nodeAPI->setAttribute(toggle_fifth_middle, NODE_WIDTH, &toggle_width_item); + nodeAPI->setAttribute(toggle_fifth_middle, NODE_HEIGHT, &toggle_height_item); + + // toggle在第五行的第三个,NODE_CLIP设置为-1,圆形滑块颜色为白色,宽为35vp,高为20vp + auto toggle_fifth_third = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue clip_abnormal_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem clip_abnormal_item = {clip_abnormal_value, + sizeof(clip_abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_fifth_third, NODE_CLIP, &clip_abnormal_item); + nodeAPI->setAttribute(toggle_fifth_third, NODE_WIDTH, &toggle_width_item); + nodeAPI->setAttribute(toggle_fifth_third, NODE_HEIGHT, &toggle_height_item); + + // 创建一个column中包含5个row,并设置row的边框为1,宽为180vp,高为150vp + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue col_height_value[] = {{.f32 = 150}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 180}}; + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_first, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_third, NODE_BORDER_WIDTH, &border_item); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_fourth, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_fourth, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_fourth, NODE_BORDER_WIDTH, &border_item); + auto row_fifth = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_fifth, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_fifth, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_fifth, NODE_BORDER_WIDTH, &border_item); + + // 子组件加入到父容器 + nodeAPI->addChild(column, row_first); + nodeAPI->addChild(column, row_second); + nodeAPI->addChild(column, row_third); + nodeAPI->addChild(column, row_fourth); + nodeAPI->addChild(column, row_fifth); + nodeAPI->addChild(row_first, toggle_first); + nodeAPI->addChild(row_first, toggle_first_middle); + nodeAPI->addChild(row_first, toggle_first_end); + nodeAPI->addChild(row_second, toggle_second); + nodeAPI->addChild(row_second, toggle_second_middle); + nodeAPI->addChild(row_second, toggle_second_end); + nodeAPI->addChild(row_third, toggle_third); + nodeAPI->addChild(row_third, toggle_third_middle); + nodeAPI->addChild(row_third, toggle_third_end); + nodeAPI->addChild(row_fourth, toggle_fourth); + nodeAPI->addChild(row_fourth, toggle_fourth_middle); + nodeAPI->addChild(row_fourth, toggle_fourth_end); + nodeAPI->addChild(row_fifth, toggle_fifth); + nodeAPI->addChild(row_fifth, toggle_fifth_middle); + nodeAPI->addChild(row_fifth, toggle_fifth_third); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleClipTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_clip_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_clip_test.h new file mode 100644 index 0000000000000000000000000000000000000000..c152551e27b1f1395f92af9b9d63fd6a1f0ba105 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_clip_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_CLIP_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_CLIP_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleClipTest { +public: + ~ToggleClipTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_CLIP_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_enabled_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_enabled_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1a71ed151781c488434c06911c5a6a6d6d852b45 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_enabled_test.cpp @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_enabled_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int enabled) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + + ArkUI_NumberValue enabled_value[] = {{.i32 = enabled}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_ENABLED, &enabled_item); + + // 设置圆形滑块颜色为红色 + ArkUI_NumberValue switch_point_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem switch_point_color_item = {switch_point_color_value, + sizeof(switch_point_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_color_item); + + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(nodeHandle, NODE_ON_BLUR, ON_BLUR_EVENT_ID, nullptr); + + return nodeHandle; +} + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ToggleEnabledTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleEnabledTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + + uint32_t color = COLOR_PURPLE; + switch (eventId) { + case ON_CLICK_EVENT_ID: + color = COLOR_GREEN; + break; + case ON_FOCUS_EVENT_ID: + color = COLOR_BLUE; + break; + case ON_BLUR_EVENT_ID: + color = COLOR_YELLOW; + break; + } + + ArkUI_NumberValue switch_point_color_value[] = {{.u32 = color}}; + ArkUI_AttributeItem switch_point_color_item = {switch_point_color_value, + sizeof(switch_point_color_value) / sizeof(ArkUI_NumberValue)}; + + // 如果是点击事件 + if (eventId == ON_CLICK_EVENT_ID) { + nodeAPI->setAttribute(nodeHandler, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_color_item); + return; + } + + // 如果是获取焦点事件 + if (eventId == ON_FOCUS_EVENT_ID) { + nodeAPI->setAttribute(nodeHandler, NODE_BACKGROUND_COLOR, &switch_point_color_item); + return; + } + + // 如果是失去焦点事件 + if (eventId == ON_BLUR_EVENT_ID) { + nodeAPI->setAttribute(nodeHandler, NODE_TOGGLE_SELECTED_COLOR, &switch_point_color_item); + return; + } +} + +napi_value ToggleEnabledTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleEnabledTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleEnabledTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // first toggle + auto toggle = createChildNode(nodeAPI, 1); + + // second toggle开关状态为开 + auto toggle_disabled = createChildNode(nodeAPI, 0); + ArkUI_NumberValue enabled_value[] = {{.i32 = 1}}; + ArkUI_AttributeItem enabled_item = {enabled_value, sizeof(enabled_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_disabled, NODE_TOGGLE_VALUE, &enabled_item); + + // third toggle + auto toggle_abnormal = createChildNode(nodeAPI, -1); + + // 设置组件ID + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnClickEnabledToggle"; + nodeAPI->setAttribute(toggle, NODE_ID, &id_item); + ArkUI_AttributeItem id_second_item = {}; + id_second_item.string = "OnClickDisabledToggle"; + nodeAPI->setAttribute(toggle_disabled, NODE_ID, &id_second_item); + ArkUI_AttributeItem id_third_item = {}; + id_third_item.string = "OnClickAbnormalToggle"; + nodeAPI->setAttribute(toggle_abnormal, NODE_ID, &id_third_item); + + nodeAPI->addChild(column, toggle); + nodeAPI->addChild(column, toggle_disabled); + nodeAPI->addChild(column, toggle_abnormal); + + // 绑定点击事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleEnabledTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_enabled_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_enabled_test.h new file mode 100644 index 0000000000000000000000000000000000000000..b2b4ee18de87f87692638249f78bec0106544aa8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_enabled_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_ENABLED_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_ENABLED_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleEnabledTest { +public: + ~ToggleEnabledTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_ENABLED_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_focusable_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_focusable_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fe2baf8bc25c659e099819e813ab8770df2ac512 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_focusable_test.cpp @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_focusable_test.h" +#include "../manager/plugin_manager.h" +#include + +#define ON_FOCUS_EVENT_ID 6001 + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ToggleOnFocusTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnFocusTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + + // 如果是焦点事件 + if (eventId == ON_FOCUS_EVENT_ID) { + ArkUI_NumberValue switch_point_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem switch_point_color_item = {switch_point_color_value, + sizeof(switch_point_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_color_item); + return; + } +} + +napi_value ToggleFocusableTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnFocusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnFocusTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // first toggle设置组件ID为FocusableToggle、focusable为true + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_AttributeItem id_item = {}; + id_item.string = "FocusableToggle"; + nodeAPI->setAttribute(toggle, NODE_ID, &id_item); + ArkUI_NumberValue switch_true_value[] = {{.i32 = true}}; + ArkUI_AttributeItem switch_true_item = {switch_true_value, sizeof(switch_true_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_FOCUSABLE, &switch_true_item); + + // second toggle设置组件ID为NofocusableToggle、focusable为false + auto toggle_second = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_AttributeItem id_second_item = {}; + id_second_item.string = "NofocusableToggle"; + nodeAPI->setAttribute(toggle_second, NODE_ID, &id_second_item); + ArkUI_NumberValue switch_false_value[] = {{.i32 = false}}; + ArkUI_AttributeItem switch_false_item = {switch_false_value, + sizeof(switch_false_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second, NODE_FOCUSABLE, &switch_false_item); + + // third toggle设置组件ID为AbnormalToggle、focusable为-1 + auto toggle_third = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_AttributeItem id_third_item = {}; + id_third_item.string = "AbnormalToggle"; + nodeAPI->setAttribute(toggle_third, NODE_ID, &id_third_item); + ArkUI_NumberValue switch_abnormal_value[] = {{.i32 = -1}}; + ArkUI_AttributeItem switch_abnormal_item = {switch_abnormal_value, + sizeof(switch_abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_third, NODE_FOCUSABLE, &switch_abnormal_item); + + // 子组件加入到父容器 + nodeAPI->addChild(column, toggle); + nodeAPI->addChild(column, toggle_second); + nodeAPI->addChild(column, toggle_third); + + // 绑定焦点事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(toggle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(toggle_second, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(toggle_third, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnFocusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleFocusableTest::CreateNativeNodeCombine(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnFocusTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnFocusTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_AttributeItem id_item = {}; + id_item.string = "FocusableToggleTrue"; + nodeAPI->setAttribute(toggle, NODE_ID, &id_item); + ArkUI_NumberValue switch_true_value[] = {{.i32 = true}}; + ArkUI_AttributeItem switch_true_item = {switch_true_value, sizeof(switch_true_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_NumberValue switch_false_value[] = {{.i32 = false}}; + ArkUI_AttributeItem switch_false_item = {switch_false_value, + sizeof(switch_false_value) / sizeof(ArkUI_NumberValue)}; + + nodeAPI->setAttribute(toggle, NODE_FOCUSABLE, &switch_true_item); + nodeAPI->setAttribute(toggle, NODE_DEFAULT_FOCUS, &switch_true_item); + + auto toggle_second = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_AttributeItem id_second_item = {}; + id_second_item.string = "FocusableToggleTrueFalse"; + nodeAPI->setAttribute(toggle_second, NODE_ID, &id_second_item); + nodeAPI->setAttribute(toggle_second, NODE_FOCUSABLE, &switch_true_item); + nodeAPI->setAttribute(toggle_second, NODE_DEFAULT_FOCUS, &switch_false_item); + + auto toggle_third = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_AttributeItem id_third_item = {}; + id_third_item.string = "FocusableToggleFalseTrue"; + nodeAPI->setAttribute(toggle_third, NODE_ID, &id_third_item); + nodeAPI->setAttribute(toggle_third, NODE_FOCUSABLE, &switch_false_item); + nodeAPI->setAttribute(toggle_third, NODE_DEFAULT_FOCUS, &switch_true_item); + + auto toggle_four = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_AttributeItem id_four_item = {}; + id_third_item.string = "FocusableToggleFalse"; + nodeAPI->setAttribute(toggle_four, NODE_ID, &id_four_item); + nodeAPI->setAttribute(toggle_four, NODE_FOCUSABLE, &switch_false_item); + nodeAPI->setAttribute(toggle_four, NODE_DEFAULT_FOCUS, &switch_false_item); + // 子组件加入到父容器 + nodeAPI->addChild(column, toggle); + nodeAPI->addChild(column, toggle_second); + nodeAPI->addChild(column, toggle_third); + nodeAPI->addChild(column, toggle_four); + + // 绑定焦点事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(toggle, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(toggle_second, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(toggle_third, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(toggle_four, NODE_ON_FOCUS, ON_FOCUS_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnFocusTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_focusable_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_focusable_test.h new file mode 100644 index 0000000000000000000000000000000000000000..e65a8659e8672f841b721dddef26b339ffb9f831 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_focusable_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_FOCUSABLE_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_FOCUSABLE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleFocusableTest { +public: + ~ToggleFocusableTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeCombine(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_FOCUSABLE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0af817efcd4ca3ec9d8613236b5ccdcfe49a488a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_height_test.cpp @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleHeightTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column设置宽200vp,高300vp + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // first toggle设置宽100vp,高30vp + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + ArkUI_NumberValue height_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + nodeAPI->addChild(column, toggle); + + // second toggle设置宽100vp,高-30vp + auto toggle_abnormal = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue width_value_abnormal[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item_abnormal = {width_value_abnormal, + sizeof(width_value_abnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_abnormal, NODE_WIDTH, &width_item_abnormal); + ArkUI_NumberValue height_value_abnormal[] = {{.f32 = -30}}; + ArkUI_AttributeItem height_item_abnormal = {height_value_abnormal, + sizeof(height_value_abnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_abnormal, NODE_HEIGHT, &height_item_abnormal); + nodeAPI->addChild(column, toggle_abnormal); + ArkUI_NumberValue switch_point_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem switch_point_color_item = {switch_point_color_value, + sizeof(switch_point_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_abnormal, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_color_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleHeightTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleHeightTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // first toggle + auto toggle_large = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue width_value_large[] = {{.f32 = 30000}}; + ArkUI_AttributeItem width_item_large = {width_value_large, sizeof(width_value_large) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_large, NODE_WIDTH, &width_item_large); + ArkUI_NumberValue height_value_large[] = {{.f32 = 10000}}; + ArkUI_AttributeItem height_item_large = {height_value_large, + sizeof(height_value_large) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_large, NODE_HEIGHT, &height_item_large); + nodeAPI->addChild(column, toggle_large); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..f2485900c56a11c1357a728d46030e232dd24c53 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleHeightTest { +public: + ~ToggleHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_margin_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_margin_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5283c69deab7f36b1e5747c741c785d30590bc6e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_margin_test.cpp @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_margin_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleMarginTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // Toggle1:组件外边距属性为{10},圆形滑块颜色为红色 + auto toggle_first = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue margin_value[] = {{.f32 = 10}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first, NODE_MARGIN, &margin_item); + ArkUI_NumberValue switchpointcolor_red_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem switchpointcolor_red_item = {switchpointcolor_red_value, + sizeof(switchpointcolor_red_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_red_item); + + // Toggle2:组件外边距属性为{-10},圆形滑块颜色为绿色 + auto toggle_second = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue margin_negative_value[] = {{.f32 = -10}}; + ArkUI_AttributeItem margin_negative_item = {margin_negative_value, + sizeof(margin_negative_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second, NODE_MARGIN, &margin_negative_item); + ArkUI_NumberValue switchpointcolor_yellow_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem switchpointcolor_yellow_item = { + switchpointcolor_yellow_value, sizeof(switchpointcolor_yellow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_yellow_item); + + // Toggle3:组件外边距属性为{50,50,10,10},圆形滑块颜色为蓝色 + auto toggle_third = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue margin_many_value[] = {{.f32 = 50}, {.f32 = 50}, {.f32 = 10}, {.f32 = 10}}; + ArkUI_AttributeItem margin_many_item = {margin_many_value, sizeof(margin_many_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_third, NODE_MARGIN, &margin_many_item); + ArkUI_NumberValue switchpointcolor_blue_value[] = {{.u32 = 0xFF0000FF}}; + ArkUI_AttributeItem switchpointcolor_blue_item = {switchpointcolor_blue_value, + sizeof(switchpointcolor_blue_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_third, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_blue_item); + + // Toggle4:组件外边距属性为{-10,-10,-50,-50},圆形滑块颜色为白色 + auto toggle_fourth = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue margin_many_negative_value[] = {{.f32 = -10}, {.f32 = -10}, {.f32 = -50}, {.f32 = -50}}; + ArkUI_AttributeItem margin_many_negative_item = {margin_many_negative_value, + sizeof(margin_many_negative_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_fourth, NODE_MARGIN, &margin_many_negative_item); + + // 创建一个column中包含4个row,并设置row的边框为1,宽高为150vp + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue col_height_value[] = {{.f32 = 150}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 150}}; + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_first, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + auto row_third = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_third, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_third, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_third, NODE_BORDER_WIDTH, &border_item); + auto row_fourth = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_fourth, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_fourth, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_fourth, NODE_BORDER_WIDTH, &border_item); + + // 子组件加入到父容器 + nodeAPI->addChild(column, row_first); + nodeAPI->addChild(column, row_second); + nodeAPI->addChild(column, row_third); + nodeAPI->addChild(column, row_fourth); + nodeAPI->addChild(row_first, toggle_first); + nodeAPI->addChild(row_second, toggle_second); + nodeAPI->addChild(row_third, toggle_third); + nodeAPI->addChild(row_fourth, toggle_fourth); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleMarginTest::CreateNativeNodeMiddle(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // toggle组件外边距属性为{230} + auto toggle_first = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue margin_value[] = {{.f32 = 230}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first, NODE_MARGIN, &margin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), toggle_first) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleMarginTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // first toggle组件外边距属性为{100} + auto toggle_first = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue margin_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first, NODE_MARGIN, &margin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), toggle_first) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleMarginTest::CreateNativeNodeFourLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // toggle组件外边距属性为{100,100,100,100} + auto toggle_first = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue margin_value[] = {{.f32 = 100}, {.f32 = 100}, {.f32 = 100}, {.f32 = 100}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first, NODE_MARGIN, &margin_item); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), toggle_first) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_margin_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_margin_test.h new file mode 100644 index 0000000000000000000000000000000000000000..bbad63db2870b55dd36e9689cc705f9fcabffc5a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_margin_test.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_MARGIN_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_MARGIN_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleMarginTest { +public: + ~ToggleMarginTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeFourLarge(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeMiddle(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_MARGIN_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_onchange_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_onchange_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..02a7de79e31caa268f8877259e6ede93dec84883 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_onchange_test.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_onchange_test.h" +#include "../manager/plugin_manager.h" +#include + +#define ON_CHANGE_ISON_EVENT_ID 7007 + +namespace ArkUICApiDemo { + +static void OnEventReceive(ArkUI_NodeEvent *event) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ToggleOnChangeTest", "OnEventReceive"); + if (event == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnChangeTest", "OnEventReceive: event is null"); + return; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto nodeHandler = OH_ArkUI_NodeEvent_GetNodeHandle(event); + int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event); + + // 如果是开关状态切换事件 + if (eventId == ON_CHANGE_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + if (result->data[0].i32) { + ArkUI_NumberValue switch_point_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem switch_point_color_item = {switch_point_color_value, sizeof(switch_point_color_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_color_item); + } + } + + if (eventId == ON_CHANGE_ISON_EVENT_ID) { + ArkUI_NodeComponentEvent *result = OH_ArkUI_NodeEvent_GetNodeComponentEvent(event); + if (!result->data[0].i32) { + ArkUI_NumberValue switch_point_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem switch_point_color_item = {switch_point_color_value, sizeof(switch_point_color_value) / + sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandler, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_color_item); + } + } +} + +napi_value ToggleOnChangeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnChangeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnChangeTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // first toggle设置组件ID为OnChangeToggle + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_AttributeItem id_item = {}; + id_item.string = "OnChangeToggle"; + nodeAPI->setAttribute(toggle, NODE_ID, &id_item); + + nodeAPI->addChild(column, toggle); + + // second toggle设置组件ID为OnChangeIsOnToggle,圆形滑块颜色为红色0xFF00FF00,开关状态为开 + auto toggle_second = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_AttributeItem id_second_item = {}; + id_second_item.string = "OnChangeIsOnToggle"; + nodeAPI->setAttribute(toggle_second, NODE_ID, &id_second_item); + ArkUI_NumberValue switch_point_color_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem switch_point_color_item = {switch_point_color_value, + sizeof(switch_point_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_color_item); + ArkUI_NumberValue switch_value[] = {{.i32 = true}}; + ArkUI_AttributeItem switch_item = {switch_value, sizeof(switch_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second, NODE_TOGGLE_VALUE, &switch_item); + + nodeAPI->addChild(column, toggle_second); + + // 绑定点击事件 + nodeAPI->registerNodeEventReceiver(&OnEventReceive); + nodeAPI->registerNodeEvent(toggle, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(toggle, NODE_TOGGLE_ON_CHANGE, ON_CHANGE_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(toggle_second, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + nodeAPI->registerNodeEvent(toggle_second, NODE_TOGGLE_ON_CHANGE, ON_CHANGE_ISON_EVENT_ID, nullptr); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleOnChangeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_onchange_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_onchange_test.h new file mode 100644 index 0000000000000000000000000000000000000000..349c192db436895868c5b119c1b01c55b728f657 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_onchange_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_ONCHANGE_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_ONCHANGE_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleOnChangeTest { +public: + ~ToggleOnChangeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_ONCHANGE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_position_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_position_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4977fa5b262f3ff8ba6e613205919ca8d6c09ae1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_position_test.cpp @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_position_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value TogglePositionTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // first toggle设置position为{100,110},圆形滑块颜色为红色0xFFFF0000 + auto toggle_first = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue value[] = {{.f32 = 100}, {.f32 = 110}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first, NODE_POSITION, &value_item); + ArkUI_NumberValue switchpointcolor_red_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem switchpointcolor_red_item = {switchpointcolor_red_value, + sizeof(switchpointcolor_red_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_first, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_red_item); + + // second toggle设置position为{-100,-110},圆形滑块颜色为绿色0xFF00FF00 + auto toggle_second = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue abnormal_value[] = {{.f32 = -100}, {.f32 = -110}}; + ArkUI_AttributeItem abnormal_value_item = {abnormal_value, sizeof(abnormal_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second, NODE_POSITION, &abnormal_value_item); + ArkUI_NumberValue switchpointcolor_yellow_value[] = {{.u32 = 0xFF00FF00}}; + ArkUI_AttributeItem switchpointcolor_yellow_item = { + switchpointcolor_yellow_value, sizeof(switchpointcolor_yellow_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_second, NODE_TOGGLE_SWITCH_POINT_COLOR, &switchpointcolor_yellow_item); + + // 创建一个column中包含2个row,并设置row的边框为1,宽高为150vp + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue col_height_value[] = {{.f32 = 150}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 150}}; + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_first, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + auto row_second = nodeAPI->createNode(ARKUI_NODE_ROW); + nodeAPI->setAttribute(row_second, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_second, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_second, NODE_BORDER_WIDTH, &border_item); + + // 子组件加入到父容器 + nodeAPI->addChild(column, row_first); + nodeAPI->addChild(row_first, toggle_first); + nodeAPI->addChild(row_first, toggle_second); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value TogglePositionTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // first toggle + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue value[] = {{.f32 = 10000}, {.f32 = 20000}}; + ArkUI_AttributeItem value_item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_POSITION, &value_item); + + // 创建一个column中包含2个row,并设置row的边框为1,宽高为150vp + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto row_first = nodeAPI->createNode(ARKUI_NODE_ROW); + ArkUI_NumberValue col_height_value[] = {{.f32 = 150}}; + ArkUI_NumberValue col_width_value[] = {{.f32 = 150}}; + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(row_first, NODE_HEIGHT, &col_height_item); + nodeAPI->setAttribute(row_first, NODE_WIDTH, &col_width_item); + nodeAPI->setAttribute(row_first, NODE_BORDER_WIDTH, &border_item); + + // 子组件加入到父容器 + nodeAPI->addChild(column, row_first); + nodeAPI->addChild(row_first, toggle); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleMarginLargeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_position_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_position_test.h new file mode 100644 index 0000000000000000000000000000000000000000..0c9020d5b8735c4332ca5485fdff1442e3664adf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_position_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_POSITION_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_POSITION_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class TogglePositionTest { +public: + ~TogglePositionTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_POSITION_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_selectedcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_selectedcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bf404163d3b31bbe9c28d17536ff07f3646c2325 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_selectedcolor_test.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_selectedcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleSelectedColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleSelectedColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleSelectedColorTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // toggle1开关状态为开,选中颜色为红色0xFFFFAAAA + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue selected_color_value[] = {{.u32 = 0xFFFFAAAA}}; + ArkUI_AttributeItem selected_color_item = {selected_color_value, + sizeof(selected_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_TOGGLE_SELECTED_COLOR, &selected_color_item); + ArkUI_NumberValue switch_value[] = {{.i32 = true}}; + ArkUI_AttributeItem switch_item = {switch_value, sizeof(switch_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_TOGGLE_VALUE, &switch_item); + + // toggle2开关状态为开,选中颜色为透明色0x00000000 + auto toggle_small = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue selected_color_small_value[] = {{.u32 = 0x00000000}}; + ArkUI_AttributeItem selected_small_color_item = {selected_color_small_value, + sizeof(selected_color_small_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_small, NODE_TOGGLE_SELECTED_COLOR, &selected_small_color_item); + ArkUI_NumberValue switch_small_value[] = {{.i32 = true}}; + ArkUI_AttributeItem switch_small_item = {switch_small_value, + sizeof(switch_small_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_small, NODE_TOGGLE_VALUE, &switch_small_item); + + // toggle3开关状态为开,选中颜色为白色0xFFFFFFFF + auto toggle_large = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue selected_color_large_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem selected_large_color_item = {selected_color_large_value, + sizeof(selected_color_large_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_large, NODE_TOGGLE_SELECTED_COLOR, &selected_large_color_item); + ArkUI_NumberValue switch_large_value[] = {{.i32 = true}}; + ArkUI_AttributeItem switch_large_item = {switch_large_value, + sizeof(switch_large_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_large, NODE_TOGGLE_VALUE, &switch_small_item); + + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, toggle); + nodeAPI->addChild(column, toggle_small); + nodeAPI->addChild(column, toggle_large); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleSelectedColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_selectedcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_selectedcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..381655fdc6db9a5a5694b17c42f4d1ac9f429fc8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_selectedcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_SELECTEDCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_SELECTEDCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleSelectedColorTest { +public: + ~ToggleSelectedColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_SELECTEDCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switch_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switch_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..219581b4fb52e8d7314b5696cd3252cd2e7ad51b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switch_test.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_switch_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleSwitchTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleSwitchTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleSwitchTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + // toggle默认状态 + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + + // 子组件挂载到父控件 + nodeAPI->addChild(column, toggle); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleSwitchTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switch_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switch_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8357ebb48a6804e6498b1761e091ca3db12f1663 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switch_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_SWITCH_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_SWITCH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleSwitchTest { +public: + ~ToggleSwitchTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_SWITCH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switchpointcolor_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switchpointcolor_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0a8333b4ad38c91031f1ae1d7459bc6ffdd7a4aa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switchpointcolor_test.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_switchpointcolor_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleSwitchPointColorTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleSwitchPointColorTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleSwitchPointColorTest", + "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // first toggle圆形滑块颜色为红色0xFFFFAAAA + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue switch_point_color_value[] = {{.u32 = 0xFFFFAAAA}}; + ArkUI_AttributeItem switch_point_color_item = {switch_point_color_value, + sizeof(switch_point_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_color_item); + + // second toggle圆形滑块颜色为透明0x00000000 + auto toggle_small = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue switch_point_color_small_value[] = {{.u32 = 0x00000000}}; + ArkUI_AttributeItem switch_point_small_color_item = { + switch_point_color_small_value, sizeof(switch_point_color_small_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_small, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_small_color_item); + + // third toggle圆形滑块颜色为白色0xFFFFFFFF + auto toggle_large = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue switch_point_color_large_value[] = {{.u32 = 0xFFFFFFFF}}; + ArkUI_AttributeItem switch_point_large_color_item = { + switch_point_color_large_value, sizeof(switch_point_color_large_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_large, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_large_color_item); + + // 子控件添加到父控件 + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, toggle); + nodeAPI->addChild(column, toggle_small); + nodeAPI->addChild(column, toggle_large); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleSwitchPointColorTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switchpointcolor_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switchpointcolor_test.h new file mode 100644 index 0000000000000000000000000000000000000000..3a18d600811ea448b735d0f201319b44ff4a8095 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_switchpointcolor_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_SWITCHPOINTCOLOR_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_SWITCHPOINTCOLOR_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleSwitchPointColorTest { +public: + ~ToggleSwitchPointColorTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_SWITCHPOINTCOLOR_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0bb1d06ed6695e7e04b8ab9c29a29b3088adc398 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_width_test.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "toggle_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +napi_value ToggleWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleWidthTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + + // first toggle设置宽100vp,高30vp + auto toggle = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue width_value[] = {{.f32 = 100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_WIDTH, &width_item); + ArkUI_NumberValue height_value[] = {{.f32 = 30}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle, NODE_HEIGHT, &height_item); + nodeAPI->addChild(column, toggle); + + // second toggle设置宽-100vp,高30vp,背景色为红色0xFFFF0000 + auto toggle_abnormal = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue width_value_abnormal[] = {{.f32 = -100}}; + ArkUI_AttributeItem width_item_abnormal = {width_value_abnormal, + sizeof(width_value_abnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_abnormal, NODE_WIDTH, &width_item_abnormal); + ArkUI_NumberValue height_value_abnormal[] = {{.f32 = 30}}; + ArkUI_AttributeItem height_item_abnormal = {height_value_abnormal, + sizeof(height_value_abnormal) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_abnormal, NODE_HEIGHT, &height_item_abnormal); + ArkUI_NumberValue switch_point_color_value[] = {{.u32 = 0xFFFF0000}}; + ArkUI_AttributeItem switch_point_color_item = {switch_point_color_value, + sizeof(switch_point_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_abnormal, NODE_TOGGLE_SWITCH_POINT_COLOR, &switch_point_color_item); + nodeAPI->addChild(column, toggle_abnormal); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value ToggleWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleWidthTest", "CreateNativeNode"); + + size_t argc = 1; + napi_value args[1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = 64; + size_t strLength = 0; + char xComponentID[64] = {0}; + napi_get_value_string_utf8(env, args[0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleWidthTest", "GetContext env or info is null"); + return nullptr; + } + + // parent column + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = 1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = 200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = 300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // first toggle + auto toggle_large = nodeAPI->createNode(ARKUI_NODE_TOGGLE); + ArkUI_NumberValue width_value_large[] = {{.f32 = 10000}}; + ArkUI_AttributeItem width_item_large = {width_value_large, sizeof(width_value_large) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_large, NODE_WIDTH, &width_item_large); + ArkUI_NumberValue height_value_large[] = {{.f32 = 3000}}; + ArkUI_AttributeItem height_item_large = {height_value_large, + sizeof(height_value_large) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(toggle_large, NODE_HEIGHT, &height_item_large); + nodeAPI->addChild(column, toggle_large); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ToggleWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..6bde7de00f11976ad539b133e235e5e479930c8e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/toggle/toggle_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_TOGGLE_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_TOGGLE_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class ToggleWidthTest { +public: + ~ToggleWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_TOGGLE_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/types/libnativerender/index.d.ts b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/types/libnativerender/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..88af441980ea6cb2e072c08c25077d1abb99a022 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/types/libnativerender/index.d.ts @@ -0,0 +1,2355 @@ +export const buttonOnClickTest: (a: string) => void; + +export const buttonFontSizeTest: (a: string) => void; + +export const buttonFontColorTest: (a: string) => void; + +export const buttonFontWeightTest: (a: string) => void; + +export const buttonBackgroundColorTest: (a: string) => void; + +export const checkboxSelectTest: (a: string) => void; + +export const checkboxSelectedColorTest: (a: string) => void; + +export const checkboxUnselectedColorTest: (a: string) => void; + +export const checkboxMarkTest: (a: string) => void; + +export const checkboxShapeTest: (a: string) => void; + +export const checkboxOnChangeTest: (a: string) => void; + +export const commonAttrsAlignTest: (a: string) => void; + +export const commonAttrsDirectionTest: (a: string) => void; + +export const commonAttrsEnabledTest: (a: string) => void; + +export const commonAttrsFocusableTest: (a: string) => void; + +export const commonAttrsForegroundBlurStyleTest: (a: string) => void; + +export const commonEventOnAreaChangeTest: (a: string) => void; + +export const commonEventOnAppearTest: (a: string) => void; + +export const commonEventOnBlurTest: (a: string) => void; + +export const commonEventOnTouchTest: (a: string) => void; + +export const commonEventOnFocusTest: (a: string) => void; + +export const commonEventOnClickTest: (a: string) => void; + +export const commonAttrsFlexBasisFlexRowTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexBasisFlexRowReverseTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexBasisFlexColumnTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexBasisFlexColumnReverseTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexBasisColumnTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexBasisRowTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexGrowFlexRowTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexGrowFlexRowReverseTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexGrowFlexColumnTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexGrowFlexColumnReverseTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexGrowColumnTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexGrowRowTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexShrinkFlexRowTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexShrinkFlexRowReverseTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexShrinkFlexColumnTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexShrinkFlexColumnReverseTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexShrinkColumnTest: (a: string, b: number, c: number) => void; + +export const commonAttrsFlexShrinkRowTest: (a: string, b: number, c: number) => void; + +export const commonAttrsAlignSelfTest: (a: string) => void; + +export const commonAttrsAlignSelfChangeTypeTest: (a: number) => void; + +export const commonAttrsAlignContentChangeTypeTest: (a: number) => void; + +export const commonAttrsAlignContentTest: (a: string) => void; + +export const commonAttrsJustifyContentTest: (a: string) => void; + +export const commonAttrsJustifyContentChangeTypeTest: (a: number) => void; + +export const commonAttrsAlignItemsTest: (a: string) => void; + +export const commonAttrsAlignItemsChangeTypeTest: (a: number) => void; + +export const commonAttrsRadialGradientTest: (a: string) => void; + +export const commonAttrsSweepGradientTest: (a: string) => void; + +export const commonAttrsGrayscaleTest: (a: string) => void; + +export const commonAttrsHitTestBehaviorTest: (a: string) => void; + +export const commonAttrsIdTest: (a: string) => void; + +export const commonAttrsOpacityTest: (a: string) => void; + +export const commonAttrsSepiaTest: (a: string) => void; + +export const commonAttrsInvertTest: (a: string) => void; + +export const commonAttrsContrastTest: (a: string) => void; + +export const commonAttrsTransformTest: (a: string) => void; + +export const commonAttrsTransformAbnormalTest: (a: string) => void; + +export const commonAttrsMaskTest: (a: string) => void; + +export const commonAttrsMaskAbnormalTest: (a: string) => void; + +export const commonAttrsBlendModeTest: (a: string) => void; + +export const commonAttrsWidthTest: (a: string) => void; + +export const commonAttrsHeightTest: (a: string) => void; + +export const commonAttrsBackgroundColorTest: (a: string) => void; + +export const commonAttrsPositionTest: (a: string) => void; + +export const commonAttrsBorderWidthTest: (a: string) => void; + +export const commonAttrsBorderColorTest: (a: string) => void; + +export const commonAttrsBorderRadiusTest: (a: string) => void; + +export const commonAttrsBorderStyleTest: (a: string) => void; + +export const commonAttrsClipCircleTest: (a: string) => void; + +export const commonAttrsClipEllipseTest: (a: string) => void; + +export const commonAttrsClipPathTest: (a: string) => void; + +export const commonAttrsClipRectangleTest: (a: string) => void; + +export const commonAttrsLinearGradientLeftTest: (a: string) => void; + +export const commonAttrsLinearGradientTopTest: (a: string) => void; + +export const commonAttrsLinearGradientBottomTest: (a: string) => void; + +export const commonAttrsLinearGradientRightTopTest: (a: string) => void; + +export const commonAttrsLinearGradientRightBottomTest: (a: string) => void; + +export const commonAttrsLinearGradientNoneTest: (a: string) => void; + +export const commonAttrsLinearGradientCustomTest: (a: string) => void; + +export const commonAttrsLinearGradientLowerBoundAbnormalTest: (a: string) => void; + +export const commonAttrsLinearGradientIllegalColorAbnormalTest: (a: string) => void; + +export const commonAttrsShadowUltraSmallShadowTest: (a: string) => void; + +export const commonAttrsShadowSmallShadowTest: (a: string) => void; + +export const commonAttrsShadowLargeShadowTest: (a: string) => void; + +export const commonAttrsShadowFloatingShadowTest: (a: string) => void; + +export const commonAttrsShadowFloatingSmallShadowTest: (a: string) => void; + +export const commonAttrsShadowLowerBoundAbnormalTest: (a: string) => void; + +export const commonAttrsShadowUpperBoundAbnormalTest: (a: string) => void; + +export const commonAttrsScaleReduceXYTest: (a: string) => void; + +export const commonAttrsScaleReduceXTest: (a: string) => void; + +export const commonAttrsScaleEnlargeXYTest: (a: string) => void; + +export const commonAttrsScaleEnlargeXTest: (a: string) => void; + +export const commonAttrsScaleAbnormalTest: (a: string) => void; + +export const commonAttrsMarginUnifiedTest: (a: string) => void; + +export const commonAttrsMarginRespectivelyTest: (a: string) => void; + +export const commonAttrsMarginUnifiedNegativeTest: (a: string) => void; + +export const commonAttrsMarginRespectivelyNegativeTest: (a: string) => void; + +export const commonAttrsConstraintSizeMaxSetMinTest: (a: string) => void; + +export const commonAttrsConstraintSizeMaxMinSetTest: (a: string) => void; + +export const commonAttrsConstraintSizeSetMaxMinTest: (a: string) => void; + +export const commonAttrsConstraintSizeMinSetMaxTest: (a: string) => void; + +export const commonAttrsConstraintSizeMinMaxSetTest: (a: string) => void; + +export const commonAttrsConstraintSizeSetMinMaxTest: (a: string) => void; + +export const commonAttrsLinearGradientRightTest: (a: string) => void; + +export const commonAttrsLinearGradientLeftTopTest: (a: string) => void; + +export const commonAttrsLinearGradientLeftBottomTest: (a: string) => void; + +export const commonAttrsShadowMiddleShadowTest: (a: string) => void; + +export const customComponentOnMeasureTest: (a: string) => void; + +export const customComponentOnLayoutTest: (a: string) => void; + +export const customComponentOnDrawTest: (a: string) => void; + +export const listBackgroundColorTest: (a: string) => void; + +export const listBlurAbnormalTest: (a: string) => void; + +export const listBlurDefaultValueTest: (a: string) => void; + +export const listBlurTest: (a: string) => void; + +export const listBorderColorRespectivelySettingsTest: (a: string) => void; + +export const listBorderColorUnifiedSettingsTest: (a: string) => void; + +export const listBorderRadiusRespectivelySettingsLowerBoundAbnormalTest: (a: string) => void; + +export const listBorderRadiusRespectivelySettingsTest: (a: string) => void; + +export const listBorderRadiusUnifiedSettingsLowerBoundAbnormalTest: (a: string) => void; + +export const listBorderRadiusUnifiedSettingsTest: (a: string) => void; + +export const listBorderWidthRespectivelySettingsLowerBoundAbnormalTest: (a: string) => void; + +export const listBorderWidthRespectivelySettingsTest: (a: string) => void; + +export const listBorderWidthUnifiedSettingsLowerBoundAbnormalTest: (a: string) => void; + +export const listBorderWidthUnifiedSettingsTest: (a: string) => void; + +export const listBrightnessLowerBoundAbnormalTest: (a: string) => void; + +export const listBrightnessMaxTest: (a: string) => void; + +export const listBrightnessMinTest: (a: string) => void; + +export const listBrightnessUpperBoundAbnormalTest: (a: string) => void; + +export const listClipCircleTest: (a: string) => void; + +export const listClipCutTest: (a: string) => void; + +export const listClipEllipseTest: (a: string) => void; + +export const listClipPathTest: (a: string) => void; + +export const listClipRectangleTest: (a: string) => void; + +export const listClipUncutTest: (a: string) => void; + +export const listEnableScrollInteractionLowerBoundAbnormalTest: (a: string, b: string) => void; + +export const listEnableScrollInteractionNotSupportedTest: (a: string, b: string) => void; + +export const listEnableScrollInteractionSupportedTest: (a: string, b: string) => void; + +export const listEnableScrollInteractionUpperBoundAbnormalTest: (a: string, b: string) => void; + +export const listFrictionAbnormalTest: (a: string, b: string) => void; + +export const listFrictionDefaultTest: (a: string, b: string) => void; + +export const listFrictionNormalTest: (a: string, b: string) => void; + +export const listHeightBeyondParentComponentTest: (a: string) => void; + +export const listHeightLowerBoundAbnormalContainsSubComponentTest: (a: string) => void; + +export const listHeightLowerBoundAbnormalTest: (a: string) => void; + +export const listHeightTest: (a: string) => void; + +export const listHitTestBehaviorBlockTest: (a: string) => void; + +export const listHitTestBehaviorDefaultTest: (a: string) => void; + +export const listHitTestBehaviorNoneTest: (a: string) => void; + +export const listHitTestBehaviorTransparentTest: (a: string) => void; + +export const listLinearGradientBottomTest: (a: string) => void; + +export const listLinearGradientCustomTest: (a: string) => void; + +export const listLinearGradientIllegalColorAbnormalTest: (a: string) => void; + +export const listLinearGradientLeftBottomTest: (a: string) => void; + +export const listLinearGradientLeftTest: (a: string) => void; + +export const listLinearGradientLeftTopTest: (a: string) => void; + +export const listLinearGradientLowerBoundAbnormalTest: (a: string) => void; + +export const listLinearGradientNoneTest: (a: string) => void; + +export const listLinearGradientRightBottomTest: (a: string) => void; + +export const listLinearGradientRightTest: (a: string) => void; + +export const listLinearGradientRightTopTest: (a: string) => void; + +export const listLinearGradientTopTest: (a: string) => void; + +export const listListDirectionHorizontalTest: (a: string) => void; + +export const listListDirectionLowerBoundAbnormalTest: (a: string) => void; + +export const listListDirectionUpperBoundAbnormalTest: (a: string) => void; + +export const listListDirectionVerticalTest: (a: string) => void; + +export const listOpacityLowerBoundAbnormalTest: (a: string) => void; + +export const listOpacityMaxTest: (a: string) => void; + +export const listOpacityMiddleTest: (a: string) => void; + +export const listOpacityMinTest: (a: string) => void; + +export const listOpacityUpperBoundAbnormalTest: (a: string) => void; + +export const listRotateDefaultValueTest: (a: string) => void; + +export const listRotateSetNegativeNumbersTest: (a: string) => void; + +export const listRotateSetRotationAngleTest: (a: string) => void; + +export const listRotateSetSightDistanceTest: (a: string) => void; + +export const listRotateSetXYZTest: (a: string) => void; + +export const listRotateTest: (a: string) => void; + +export const listSaturateLowerBoundAbnormalTest: (a: string) => void; + +export const listSaturateMaxTest: (a: string) => void; + +export const listSaturateMinTest: (a: string) => void; + +export const listSaturateUpperBoundAbnormalTest: (a: string) => void; + +export const listScaleAbnormalTest: (a: string) => void; + +export const listScaleEnlargeXTest: (a: string) => void; + +export const listScaleEnlargeXYTest: (a: string) => void; + +export const listScaleReduceXTest: (a: string) => void; + +export const listScaleReduceXYTest: (a: string) => void; + +export const listScrollBarAutoTest: (a: string, b: string) => void; + +export const listScrollBarLowerBoundAbnormalTest: (a: string) => void; + +export const listScrollBarOffTest: (a: string) => void; + +export const listScrollBarOnTest: (a: string) => void; + +export const listScrollBarUpperBoundAbnormalTest: (a: string) => void; + +export const listShadowFloatingShadowTest: (a: string) => void; + +export const listShadowFloatingSmallShadowTest: (a: string) => void; + +export const listShadowLargeShadowTest: (a: string) => void; + +export const listShadowLowerBoundAbnormalTest: (a: string) => void; + +export const listShadowMiddleShadowTest: (a: string) => void; + +export const listShadowSmallShadowTest: (a: string) => void; + +export const listShadowUltraSmallShadowTest: (a: string) => void; + +export const listShadowUpperBoundAbnormalTest: (a: string) => void; + +export const listStickyBothTest: (a: string, b: string) => void; + +export const listStickyFooterTest: (a: string, b: string) => void; + +export const listStickyHeaderTest: (a: string, b: string) => void; + +export const listStickyLowerBoundAbnormalTest: (a: string, b: string) => void; + +export const listStickyNoneTest: (a: string, b: string) => void; + +export const listStickyUpperBoundAbnormalTest: (a: string, b: string) => void; + +export const listTranslateSetXMinusTest: (a: string) => void; + +export const listTranslateSetXTest: (a: string) => void; + +export const listTranslateSetXYZMinusTest: (a: string) => void; + +export const listTranslateSetXYZTest: (a: string) => void; + +export const listTranslateUnifiedAbnormalTest: (a: string) => void; + +export const listTranslateUnifiedMinusAbnormalTest: (a: string) => void; + +export const listWidthBeyondParentComponentTest: (a: string) => void; + +export const listWidthLowerBoundAbnormalContainsSubComponentTest: (a: string) => void; + +export const listWidthLowerBoundAbnormalTest: (a: string) => void; + +export const listWidthTest: (a: string) => void; + +export const listCachedCountTest: (a: string) => void; + +export const listItemBackgroundColorTest: (a: string) => void; + +export const listItemBlurAbnormalTest: (a: string) => void; + +export const listItemBlurDefaultValueTest: (a: string) => void; + +export const listItemBlurTest: (a: string) => void; + +export const listItemBorderColorRespectivelySettingsTest: (a: string) => void; + +export const listItemBorderColorUnifiedSettingsTest: (a: string) => void; + +export const listItemBorderRadiusRespectivelySettingsLowerBoundAbnormalTest: (a: string) => void; + +export const listItemBorderRadiusRespectivelySettingsTest: (a: string) => void; + +export const listItemBorderRadiusUnifiedSettingsLowerBoundAbnormalTest: (a: string) => void; + +export const listItemBorderRadiusUnifiedSettingsTest: (a: string) => void; + +export const listItemBorderWidthRespectivelySettingsLowerBoundAbnormalTest: (a: string) => void; + +export const listItemBorderWidthRespectivelySettingsTest: (a: string) => void; + +export const listItemBorderWidthUnifiedSettingsLowerBoundAbnormalTest: (a: string) => void; + +export const listItemBorderWidthUnifiedSettingsTest: (a: string) => void; + +export const listItemBrightnessLowerBoundAbnormalTest: (a: string) => void; + +export const listItemBrightnessMaxTest: (a: string) => void; + +export const listItemBrightnessMinTest: (a: string) => void; + +export const listItemBrightnessUpperBoundAbnormalTest: (a: string) => void; + +export const listItemClipCircleTest: (a: string) => void; + +export const listItemClipCutTest: (a: string) => void; + +export const listItemClipEllipseTest: (a: string) => void; + +export const listItemClipPathTest: (a: string) => void; + +export const listItemClipRectangleTest: (a: string) => void; + +export const listItemClipUncutTest: (a: string) => void; + +export const listItemHeightBeyondParentComponentTest: (a: string) => void; + +export const listItemHeightLowerBoundAbnormalContainsSubComponentTest: (a: string) => void; + +export const listItemHeightLowerBoundAbnormalTest: (a: string) => void; + +export const listItemHeightTest: (a: string) => void; + +export const listItemHitTestBehaviorBlockTest: (a: string) => void; + +export const listItemHitTestBehaviorDefaultTest: (a: string) => void; + +export const listItemHitTestBehaviorNoneTest: (a: string) => void; + +export const listItemHitTestBehaviorTransparentTest: (a: string) => void; + +export const listItemLinearGradientBottomTest: (a: string) => void; + +export const listItemLinearGradientCustomTest: (a: string) => void; + +export const listItemLinearGradientIllegalColorAbnormalTest: (a: string) => void; + +export const listItemLinearGradientLeftBottomTest: (a: string) => void; + +export const listItemLinearGradientLeftTest: (a: string) => void; + +export const listItemLinearGradientLeftTopTest: (a: string) => void; + +export const listItemLinearGradientLowerBoundAbnormalTest: (a: string) => void; + +export const listItemLinearGradientNoneTest: (a: string) => void; + +export const listItemLinearGradientRightBottomTest: (a: string) => void; + +export const listItemLinearGradientRightTest: (a: string) => void; + +export const listItemLinearGradientRightTopTest: (a: string) => void; + +export const listItemLinearGradientTopTest: (a: string) => void; + +export const listItemOpacityLowerBoundAbnormalTest: (a: string) => void; + +export const listItemOpacityMaxTest: (a: string) => void; + +export const listItemOpacityMiddleTest: (a: string) => void; + +export const listItemOpacityMinTest: (a: string) => void; + +export const listItemOpacityUpperBoundAbnormalTest: (a: string) => void; + +export const listItemRotateDefaultValueTest: (a: string) => void; + +export const listItemRotateSetNegativeNumbersTest: (a: string) => void; + +export const listItemRotateSetRotationAngleTest: (a: string) => void; + +export const listItemRotateSetSightDistanceTest: (a: string) => void; + +export const listItemRotateSetXYZTest: (a: string) => void; + +export const listItemRotateTest: (a: string) => void; + +export const listItemSaturateLowerBoundAbnormalTest: (a: string) => void; + +export const listItemSaturateMaxTest: (a: string) => void; + +export const listItemSaturateMinTest: (a: string) => void; + +export const listItemSaturateUpperBoundAbnormalTest: (a: string) => void; + +export const listItemScaleAbnormalTest: (a: string) => void; + +export const listItemScaleEnlargeXTest: (a: string) => void; + +export const listItemScaleEnlargeXYTest: (a: string) => void; + +export const listItemScaleReduceXTest: (a: string) => void; + +export const listItemScaleReduceXYTest: (a: string) => void; + +export const listItemShadowFloatingShadowTest: (a: string) => void; + +export const listItemShadowFloatingSmallShadowTest: (a: string) => void; + +export const listItemShadowLargeShadowTest: (a: string) => void; + +export const listItemShadowLowerBoundAbnormalTest: (a: string) => void; + +export const listItemShadowMiddleShadowTest: (a: string) => void; + +export const listItemShadowSmallShadowTest: (a: string) => void; + +export const listItemShadowUltraSmallShadowTest: (a: string) => void; + +export const listItemShadowUpperBoundAbnormalTest: (a: string) => void; + +export const listItemTranslateSetXMinusTest: (a: string) => void; + +export const listItemTranslateSetXTest: (a: string) => void; + +export const listItemTranslateSetXYZMinusTest: (a: string) => void; + +export const listItemTranslateSetXYZTest: (a: string) => void; + +export const listItemTranslateUnifiedAbnormalTest: (a: string) => void; + +export const listItemTranslateUnifiedMinusAbnormalTest: (a: string) => void; + +export const listItemWidthBeyondParentComponentTest: (a: string) => void; + +export const listItemWidthLowerBoundAbnormalContainsSubComponentTest: (a: string) => void; + +export const listItemWidthLowerBoundAbnormalTest: (a: string) => void; + +export const listItemWidthTest: (a: string) => void; + +export const scrollHeightTest: (a: string) => void; + +export const scrollHeightLargeTest: (a: string) => void; + +export const scrollNestedScrollTest: (a: string) => void; + +export const scrollNestedScrollChangeTestType: (b: number) => void; + +export const scrollPositionTest: (a: string) => void; + +export const scrollWidthTest: (a: string) => void; + +export const scrollWidthLargeTest: (a: string) => void; + +export const scrollScrollBarAutoTest: (a: string, b: string) => void; + +export const scrollScrollBarOnTest: (a: string) => void; + +export const scrollScrollBarOffTest: (a: string) => void; + +export const scrollScrollBarAbnormalTest: (a: string) => void; + +export const scrollScrollBarColorBlackTest: (a: string) => void; + +export const scrollScrollBarColorWhiteTest: (a: string) => void; + +export const scrollScrollBarColorTest: (a: string) => void; + +export const scrollScrollAbleTest: (a: string) => void; + +export const scrollScrollAbleAbnormalTest: (a: string) => void; + +export const scrollScrollAbleHorizontalTest: (a: string) => void; + +export const scrollScrollAbleNoneTest: (a: string) => void; + +export const scrollSaturateMaxTest: (a: string) => void; + +export const scrollSaturateMinTest: (a: string) => void; + +export const scrollSaturateNormalTest: (a: string) => void; + +export const scrollSaturateDefaultTest: (a: string) => void; + +export const scrollBackgroundColorTest: (a: string) => void; + +export const scrollBackgroundColorWhiteTest: (a: string) => void; + +export const scrollBackgroundColorBlackTest: (a: string) => void; + +export const scrollBorderColorTest: (a: string) => void; + +export const scrollBorderColorAbnormalTest: (a: string) => void; + +export const scrollBorderRadiusSingleTest: (a: string) => void; + +export const scrollBorderRadiusAbnormalTest: (a: string) => void; + +export const scrollBorderRadiusAllParamTest: (a: string) => void; + +export const scrollBorderWidthSingleTest: (a: string) => void; + +export const scrollClipTrueTest: (a: string) => void; + +export const scrollClipAbnormalTest: (a: string) => void; + +export const scrollEnableScrollInteractionTrueTest: (a: string) => void; + +export const scrollEnableScrollInteractionAbnormalTest: (a: string) => void; + +export const scrollBackgroundColorAbnormalTest: (a: string) => void; + +export const scrollBorderWidthAbnormalTest: (a: string) => void; + +export const scrollBorderWidthAllParamTest: (a: string) => void; + +export const scrollClipFalseTest: (a: string) => void; + +export const scrollEnableScrollInteractionFalseTest: (a: string) => void; + +export const scrollOpacityMinTest: (a: string) => void; + +export const scrollTranslateTest: (a: string) => void; + +export const scrollScaleTest: (a: string) => void; + +export const scrollRotateTest: (a: string) => void; + +export const scrollBrightnessTest: (a: string) => void; + +export const scrollBlurTest: (a: string) => void; + +export const scrollOpacityMaxTest: (a: string) => void; + +export const scrollOpacityMiddleTest: (a: string) => void; + +export const scrollOpacityAbnormalTest: (a: string) => void; + +export const scrollTranslateDefaultTest: (a: string) => void; + +export const scrollScaleAbNormalTest: (a: string) => void; + +export const scrollScaleNormalTest: (a: string) => void; + +export const scrollRotateAbNormalTest: (a: string) => void; + +export const scrollRotateNormalTest: (a: string) => void; + +export const scrollBrightnessAbnormalTest: (a: string) => void; + +export const scrollBrightnessMaxTest: (a: string) => void; + +export const scrollBrightnessMinTest: (a: string) => void; + +export const scrollBlurDefaultTest: (a: string) => void; + +export const scrollShadowMinTest: (a: string) => void; + +export const scrollShadowBigTest: (a: string) => void; + +export const scrollShadowMiddleTest: (a: string) => void; + +export const scrollShadowFloatMiddleTest: (a: string) => void; + +export const scrollShadowFloatLittleTest: (a: string) => void; + +export const scrollShadowLittleTest: (a: string) => void; + +export const scrollOnScrollFrameBeginTest: (a: string) => void; + +export const scrollOnScrollTest: (a: string) => void; + +export const scrollOnAppearTest: (a: string) => void; + +export const scrollOnScrollEdgeTest: (a: string) => void; + +export const scrollOnScrollStartTest: (a: string) => void; + +export const scrollOnScrollStopTest: (a: string) => void; + +export const scrollScrollEdgeTest: (a: string, b: number) => void; + +export const scrollEdgeEffectNoneTest: (a: string) => void; + +export const scrollEdgeEffectSpringTest: (a: string) => void; + +export const scrollEdgeEffectFadeTest: (a: string) => void; + +export const scrollFrictionDefaultTest: (a: string, b: string) => void; + +export const scrollFrictionNormalTest: (a: string, b: string) => void; + +export const scrollFrictionAbNormalTest: (a: string, b: string) => void; + +export const scrollScrollSnapNoneTest: (a: string, b: string) => void; + +export const scrollScrollSnapCenterTest: (a: string, b: string) => void; + +export const scrollScrollSnapEndTest: (a: string, b: string) => void; + +export const scrollScrollSnapStartTest: (a: string, b: string) => void; + +export const scrollCurrentOffsetLinearTest: (a: string) => void; + +export const scrollCurrentOffsetEaseTest: (a: string) => void; + +export const scrollCurrentOffsetEaseInOutTest: (a: string) => void; + +export const scrollCurrentOffsetEaseInTest: (a: string) => void; + +export const scrollCurrentOffsetEaseOutTest: (a: string) => void; + +export const scrollCurrentOffsetExtremeDecelerationTest: (a: string) => void; + +export const scrollCurrentOffsetFastOutLinearInTest: (a: string) => void; + +export const scrollCurrentOffsetFastOutSlowInTest: (a: string) => void; + +export const scrollCurrentOffsetFrictionTest: (a: string) => void; + +export const scrollCurrentOffsetLinearOutSlowInTest: (a: string) => void; + +export const scrollCurrentOffsetRhythmTest: (a: string) => void; + +export const scrollCurrentOffsetSharpTest: (a: string) => void; + +export const scrollCurrentOffsetSmoothTest: (a: string) => void; + +export const scrollScrollToTest: (a: string, b: string) => void; + +export const scrollOverlayTest: (a: string, b: string) => void; + +export const scrollHitTestBehaviorTest: (a: string) => void; + +export const scrollLinearGradientTest: (a: string, b: string) => void; + +export const scrollPageEnableTrueTest: (a: string) => void; + +export const scrollPageEnableFalseTest: (a: string) => void; + +export const toggleChangeTest: (a: string, b: string) => void; + +export const toggleColorTest: (a: string) => void; + +export const swiperDisplayArrowTest: (a: string) => void; + +export const swiperDisplayCountTest: (a: string) => void; + +export const swiperIndexTest: (a: string) => void; + +export const swiperItemSpaceTest: (a: string) => void; + +export const swiperVerticalTest: (a: string) => void; + +export const swiperBackgroundColorTest: (a: string) => void; + +export const swiperBackgroundImageTest: (a: string) => void; + +export const swiperWidthTest: (a: string) => void; + +export const swiperWidthLargeTest: (a: string) => void; + +export const swiperCachedCountTest: (a: string) => void; + +export const toggleBackgroundColorTest: (a: string) => void; + +export const toggleSelectedColorTest: (a: string) => void; + +export const toggleSwitchPointColorTest: (a: string) => void; + +export const toggleWidthTest: (a: string) => void; + +export const toggleWidthLargeTest: (a: string) => void; + +export const toggleHeightTest: (a: string) => void; + +export const toggleHeightLargeTest: (a: string) => void; + +export const togglePositionTest: (a: string) => void; + +export const togglePositionLargeTest: (a: string) => void; + +export const toggleOnChangeTest: (a: string) => void; + +export const toggleFocusableTest: (a: string) => void; + +export const toggleMarginTest: (a: string) => void; + +export const toggleMarginLargeTest: (a: string) => void; + +export const toggleMarginMiddleTest: (a: string) => void; + +export const toggleMarginFourLargeTest: (a: string) => void; + +export const toggleEnabledTest: (a: string) => void; + +export const toggleClipTest: (a: string) => void; + +export const toggleSwitchTest: (a: string) => void; + +export const swiperAutoPlayTest: (a: string) => void; + +export const swiperAutoPlayToEndTest: (a: string) => void; + +export const swiperHeightTest: (a: string) => void; + +export const swiperHeightLargeTest: (a: string) => void; + +export const swiperPositionTest: (a: string) => void; + +export const swiperClipTest: (a: string) => void; + +export const swiperIndicatorTest: (a: string) => void; + +export const swiperDisableSwipeTest: (a: string) => void; + +export const stackBackgroundColorTest: (a: string) => void; + +export const stackBorderColorTest: (a: string) => void; + +export const stackBorderRadiusTest: (a: string) => void; + +export const stackBrightnessTest: (a: string) => void; + +export const stackSaturateTest: (a: string) => void; + +export const stackOpacityTest: (a: string) => void; + +export const stackScaleTest: (a: string) => void; + +export const stackRotateTest: (a: string) => void; + +export const stackClipTest: (a: string) => void; + +export const stackTranslateTest: (a: string) => void; + +export const stackBackgroundImageSizeTest: (a: string) => void; + +export const stackBackgroundBlurStyleTest: (a: string) => void; + +export const stackShadowTest: (a: string) => void; + +export const textPositionTest: (a: string) => void; + +export const stackBackgroundImagePositionTest: (a: string) => void; + +export const stackBorderWidthTest: (a: string) => void; + +export const stackLinearGradientTest: (a: string) => void; + +export const stackTransitionTest: (a: string) => void; + +export const textEnabledTest: (a: string) => void; + +export const stackIdTest: (a: string) => void; + +export const stackBackgroundImageTest: (a: string) => void; + +export const stackOnAreaChangeTest: (a: string) => void; + +export const stackOnTouchTest: (a: string) => void; + +export const stackMarginTest: (a: string) => void; + +export const stackAlignTest: (a: string) => void; + +export const stackHitTestBehaviorTest: (a: string) => void; + +export const stackWidthTest: (a: string) => void; + +export const stackWidthLargeTest: (a: string) => void; + +export const stackHeightTest: (a: string) => void; + +export const stackHeightLargeTest: (a: string) => void; + +export const stackPositionTest: (a: string) => void; + +export const stackBorderStyleTest: (a: string) => void; + +export const stackTransformTest: (a: string) => void; + +export const textWidthTest: (a: string) => void; + +export const textWidthLargeTest: (a: string) => void; + +export const textHeightTest: (a: string) => void; + +export const textHeightLargeTest: (a: string) => void; + +export const textBackgroundColorTest: (a: string) => void; + +export const textBackgroundImageTest: (a: string) => void; + +export const textBorderWidthTest: (a: string) => void; + +export const textBorderColorTest: (a: string) => void; + +export const textBorderRadiusTest: (a: string) => void; + +export const textOpacityTest: (a: string) => void; + +export const textFontColorTest: (a: string) => void; + +export const textFontSizeTest: (a: string) => void; + +export const textMaxLinesTest: (a: string) => void; + +export const textLineHeightTest: (a: string) => void; + +export const textTextOverflowTest: (a: string) => void; + +export const textTextAlignTest: (a: string) => void; + +export const textDecorationTest: (a: string) => void; + +export const textFontWeightTest: (a: string) => void; + +export const textFontStyleTest: (a: string) => void; + +export const textPaddingTest: (a: string) => void; + +export const textBaselineOffsetTest: (a: string) => void; + +export const textTextShadowTest: (a: string) => void; + +export const textLetterSpacingTest: (a: string) => void; + +export const textTextCaseTest: (a: string) => void; + +export const textVisibilityTest: (a: string) => void; + +export const textOffsetTest: (a: string) => void; + +export const textMaskTest: (a: string) => void; + +export const textShadowTest: (a: string) => void; + +export const textLinearGradientTest: (a: string) => void; + +export const textScaleTest: (a: string) => void; + +export const textTransformTest: (a: string) => void; + +export const textTextIndentTest: (a: string) => void; + +export const textMinFontSizeTest: (a: string) => void; + +export const textMaxFontSizeTest: (a: string) => void; + +export const textHeightAdaptivePolicyTest: (a: string) => void; + +export const textOverlayTest: (a: string) => void; + +export const textFontFamilyTest: (a: string) => void; + +export const textClipTest: (a: string) => void; + +export const textRadialGradientTest: (a: string) => void; + +export const textSweepGradientTest: (a: string) => void; + +export const textFontTest: (a: string) => void; + +export const textAlignTest: (a: string) => void; + +export const imageWidthTest: (a: string) => void; + +export const imageWidthLargeTest: (a: string) => void; + +export const imageHeightTest: (a: string) => void; + +export const imageHeightLargeTest: (a: string) => void; + +export const imagePositionTest: (a: string) => void; + +export const imageBackgroundColorTest: (a: string) => void; + +export const imageBorderColorTest: (a: string) => void; + +export const imageBorderWidthTest: (a: string) => void; + +export const imageBorderRadiusTest: (a: string) => void; + +export const imageOpacityTest: (a: string) => void; + +export const imageHitTestBehaviorTest: (a: string) => void; + +export const imageRotateTest: (a: string) => void; + +export const imageScaleTest: (a: string) => void; + +export const imageTranslateTest: (a: string) => void; + +export const imageBlurTest: (a: string) => void; + +export const imageBrightnessTest: (a: string) => void; + +export const imageSaturateTest: (a: string) => void; + +export const imageAutoResizeTest: (a: string) => void; + +export const imageLinearGradientTest: (a: string) => void; + +export const imageShadowTest: (a: string) => void; + +export const imageInterpolationTest: (a: string) => void; + +export const imageObjectFitTest: (a: string) => void; + +export const imageObjectRepeatTest: (a: string) => void; + +export const imageBorderStyleTest: (a: string) => void; + +export const imageColorFilterTest: (a: string) => void; + +export const imageSrcTest: (a: string) => void; + +export const imageClipTest: (a: string) => void; + +export const imageIdTest: (a: string) => void; + +export const imageTransformTest: (a: string) => void; + +export const imageAltTest: (a: string) => void; + +export const imageOnCompleteTest: (a: string) => void; + +export const imageOnErrorTest: (a: string) => void; + +export const imageRadialGradientTest: (a: string) => void; + +export const imageSweepGradientTest: (a: string) => void; + +export const calendarPickerEdgeAlignStartTest: (a: string) => void; + +export const calendarPickerEdgeAlignCenterTest: (a: string) => void; + +export const calendarPickerEdgeAlignEndTest: (a: string) => void; + +export const calendarPickerEdgeAlignDefaultTest: (a: string) => void; + +export const calendarPickerTextStyleTest: (a: string) => void; + +export const textCopyOptionTest: (a: string) => void; + +export const customDialogOpenTest: (a: string) => void; + +export const calendarPickerOnChangeTest: (a: string) => void; + +export const datePickerLunarTest: (a: string) => void; + +export const textPickerRangeTest: (a: string) => void; + +export const textPickerSelectedTest: (a: string) => void; + +export const textPickerValueTest: (a: string) => void; + +export const textPickerDisappearTextStyleTest: (a: string) => void; + +export const textPickerTextStyleTest: (a: string) => void; + +export const textPickerSelectedTextStyleTest: (a: string) => void; + +export const textPickerSelectedIndexTest: (a: string) => void; + +export const textPickerCanLoopTest: (a: string) => void; + +export const textPickerDefaultPickerItemHeightTest: (a: string) => void; + +export const textPickerOnChangeTest: (a: string) => void; + +export const xComponentSourceIdTest: (a: string) => void; + +export const xComponentTypeTest: (a: string) => void; + +export const customDialogCloseTest: (a: string) => void; + +export const textLineBreakStrategyTest: (a: string) => void; + +export const textAlignRulesTest: (a: string) => void; + +export const timePickerUseMilitaryTimeTest: (a: string) => void; + +export const customDialogAlignmentTopStartTest: (a: string) => void; + +export const customDialogAlignmentTopTest: (a: string) => void; + +export const customDialogAlignmentTopEndTest: (a: string) => void; + +export const customDialogAlignmentStartTest: (a: string) => void; + +export const customDialogAlignmentCenterTest: (a: string) => void; + +export const customDialogAlignmentEndTest: (a: string) => void; + +export const customDialogAlignmentBottomStartTest: (a: string) => void; + +export const customDialogAlignmentBottomTest: (a: string) => void; + +export const customDialogAlignmentBottomEndTest: (a: string) => void; + +export const customDialogAlignmentAbnormalTest: (a: string) => void; + +export const customDialogCustomStyleTest: (a: string) => void; + +export const customDialogMaskColorTest: (a: string) => void; + +export const datePickerOnDateChangeTest: (a: string) => void; + +export const datePickerStartTest: (a: string) => void; + +export const datePickerEndTest: (a: string) => void; + +export const datePickerSelectedTest: (a: string) => void; + +export const datePickerSelectedTextStyleTest: (a: string) => void; + +export const datePickerDisappearTextStyleTest: (a: string) => void; + +export const datePickerTextStyleTest: (a: string) => void; + +export const timePickerOnChangeTest: (a: string) => void; + +export const timePickerHeightTest: (a: string) => void; + +export const timePickerSelectedTest: (a: string) => void; + +export const timePickerSelectedTextStyleTest: (a: string) => void; + +export const timePickerDisappearTextStyleTest: (a: string) => void; + +export const timePickerTextStyleTest: (a: string) => void; + +export const columnWidthTest: (a: string) => void; + +export const columnWidthLargeTest: (a: string) => void; + +export const columnHeightTest: (a: string) => void; + +export const columnHeightLargeTest: (a: string) => void; + +export const columnForegroundBlurStyleTest: (a: string) => void; + +export const sliderWidthTest: (a: string) => void; + +export const sliderWidthLargeTest: (a: string) => void; + +export const sliderHeightTest: (a: string) => void; + +export const sliderHeightLargeTest: (a: string) => void; + +export const rowHeightTest: (a: string) => void; + +export const rowHeightLargeTest: (a: string) => void; + +export const columnPaddingTest: (a: string) => void; + +export const textAreaWidthTest: (a: string) => void; + +export const textAreaWidthLargeTest: (a: string) => void; + +export const textAreaHeightTest: (a: string) => void; + +export const textAreaHeightLargeTest: (a: string) => void; + +export const textAreaPositionTest: (a: string) => void; + +export const textAreaEnabledTest: (a: string) => void; + +export const textInputWidthTest: (a: string) => void; + +export const textInputWidthLargeTest: (a: string) => void; + +export const textInputHeightTest: (a: string) => void; + +export const textInputHeightLargeTest: (a: string) => void; + +export const textInputPositionTest: (a: string) => void; + +export const textInputShowPasswordIconTest: (a: string) => void; + +export const textInputSelectedBackgroundColorTest: (a: string) => void; + +export const textInputCaretStyleTest: (a: string) => void; + +export const textInputCaretStyleLargeTest: (a: string) => void; + +export const textInputCaretStyleAbnormalTest: (a: string) => void; + +export const textInputEnabledTest: (a: string) => void; + +export const textInputEnterKeyTypeTest: (a: string) => void; + +export const textInputTypeTest: (a: string) => void; + +export const textInputOnChangeTest: (a: string) => void; + +export const textInputEnableKeyboardOnFocusTest: (a: string) => void; + +export const textInputEnableKeyboardOnFocusDisableTest: (a: string) => void; + +export const textInputEnableKeyboardOnFocusAbnormalTest: (a: string) => void; + +export const sliderEnabledTest: (a: string) => void; + +export const spanTextCaseTest: (a: string) => void; + +export const spanLetterSpacingTest: (a: string) => void; + +export const spanDecorationTest: (a: string) => void; + +export const spanLineHeightTest: (a: string) => void; + +export const calendarPickerWidthTest: (a: string) => void; + +export const calendarPickerWidthLargeTest: (a: string) => void; + +export const calendarPickerEnabledTest: (a: string) => void; + +export const datePickerWidthTest: (a: string) => void; + +export const datePickerWidthLargeTest: (a: string) => void; + +export const datePickerEnabledTest: (a: string) => void; + +export const checkboxWidthTest: (a: string) => void; + +export const checkboxWidthLargeTest: (a: string) => void; + +export const checkboxHeightTest: (a: string) => void; + +export const checkboxHeightLargeTest: (a: string) => void; + +export const checkboxEnabledTest: (a: string) => void; + +export const xComponentWidthTest: (a: string) => void; + +export const xComponentWidthLargeTest: (a: string) => void; + +export const xComponentHeightTest: (a: string) => void; + +export const xComponentHeightLargeTest: (a: string) => void; + +export const textPickerWidthTest: (a: string) => void; + +export const textPickerWidthLargeTest: (a: string) => void; + +export const textPickerHeightTest: (a: string) => void; + +export const textPickerHeightLargeTest: (a: string) => void; + +export const flexWidthTest: (a: string) => void; + +export const flexWidthLargeTest: (a: string) => void; + +export const flexHeightTest: (a: string) => void; + +export const flexHeightLargeTest: (a: string) => void; + +export const imageSpanWidthTest: (a: string) => void; + +export const imageSpanWidthLargeTest: (a: string) => void; + +export const imageSpanHeightTest: (a: string) => void; + +export const imageSpanHeightLargeTest: (a: string) => void; + +export const imageSpanObjectFitTest: (a: string) => void; + +export const imageSpanVerticalAlignTest: (a: string) => void; + +export const imageSpanPaddingTest: (a: string) => void; + +export const spanFontStyleTest: (a: string) => void; + +export const spanFontWeightTest: (a: string) => void; + +export const spanFontColorTest: (a: string) => void; + +export const spanFontSizeTest: (a: string) => void; + +export const customComponentAlignTest: (a: string) => void; + +export const customComponentDirectionTest: (a: string) => void; + +export const customComponentEnabledTest: (a: string) => void; + +export const customComponentFocusableTest: (a: string) => void; + +export const customComponentFlexBasisFlexRowTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexBasisFlexRowReverseTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexBasisFlexColumnTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexBasisFlexColumnReverseTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexBasisColumnTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexBasisRowTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexGrowFlexRowTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexGrowFlexRowReverseTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexGrowFlexColumnTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexGrowFlexColumnReverseTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexGrowColumnTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexGrowRowTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexShrinkFlexRowTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexShrinkFlexRowReverseTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexShrinkFlexColumnTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexShrinkFlexColumnReverseTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexShrinkColumnTest: (a: string, b: number, c: number) => void; + +export const customComponentFlexShrinkRowTest: (a: string, b: number, c: number) => void; + +export const customComponentAlignSelfTest: (a: string) => void; + +export const customComponentAlignSelfChangeTypeTest: (a: number) => void; + +export const customComponentAlignItemsChangeTypeTest: (a: number) => void; + +export const customComponentRadialGradientTest: (a: string) => void; + +export const customComponentSweepGradientTest: (a: string) => void; + +export const customComponentGrayscaleTest: (a: string) => void; + +export const customComponentHitTestBehaviorTest: (a: string) => void; + +export const customComponentIdTest: (a: string) => void; + +export const customComponentOpacityTest: (a: string) => void; + +export const customComponentSepiaTest: (a: string) => void; + +export const customComponentInvertTest: (a: string) => void; + +export const customComponentContrastTest: (a: string) => void; + +export const customComponentTransformTest: (a: string) => void; + +export const customComponentTransformAbnormalTest: (a: string) => void; + +export const customComponentMaskTest: (a: string) => void; + +export const customComponentMaskAbnormalTest: (a: string) => void; + +export const customComponentBlendModeTest: (a: string) => void; + +export const customComponentWidthTest: (a: string) => void; + +export const customComponentHeightTest: (a: string) => void; + +export const customComponentBackgroundColorTest: (a: string) => void; + +export const customComponentPositionTest: (a: string) => void; + +export const customComponentBorderWidthTest: (a: string) => void; + +export const customComponentBorderColorTest: (a: string) => void; + +export const customComponentBorderRadiusTest: (a: string) => void; + +export const customComponentBorderStyleTest: (a: string) => void; + +export const customComponentClipCircleTest: (a: string) => void; + +export const customComponentClipEllipseTest: (a: string) => void; + +export const customComponentClipPathTest: (a: string) => void; + +export const customComponentClipRectangleTest: (a: string) => void; + +export const customComponentLinearGradientLeftTest: (a: string) => void; + +export const customComponentLinearGradientTopTest: (a: string) => void; + +export const customComponentLinearGradientBottomTest: (a: string) => void; + +export const customComponentLinearGradientRightTopTest: (a: string) => void; + +export const customComponentLinearGradientRightBottomTest: (a: string) => void; + +export const customComponentLinearGradientNoneTest: (a: string) => void; + +export const customComponentLinearGradientCustomTest: (a: string) => void; + +export const customComponentLinearGradientLowerBoundAbnormalTest: (a: string) => void; + +export const customComponentLinearGradientIllegalColorAbnormalTest: (a: string) => void; + +export const customComponentShadowUltraSmallShadowTest: (a: string) => void; + +export const customComponentShadowSmallShadowTest: (a: string) => void; + +export const customComponentShadowLargeShadowTest: (a: string) => void; + +export const customComponentShadowFloatingShadowTest: (a: string) => void; + +export const customComponentShadowFloatingSmallShadowTest: (a: string) => void; + +export const customComponentShadowLowerBoundAbnormalTest: (a: string) => void; + +export const customComponentShadowUpperBoundAbnormalTest: (a: string) => void; + +export const customComponentScaleReduceXYTest: (a: string) => void; + +export const customComponentScaleReduceXTest: (a: string) => void; + +export const customComponentScaleEnlargeXYTest: (a: string) => void; + +export const customComponentScaleEnlargeXTest: (a: string) => void; + +export const customComponentScaleAbnormalTest: (a: string) => void; + +export const customComponentMarginUnifiedTest: (a: string) => void; + +export const customComponentMarginRespectivelyTest: (a: string) => void; + +export const customComponentMarginUnifiedNegativeTest: (a: string) => void; + +export const customComponentMarginRespectivelyNegativeTest: (a: string) => void; + +export const customComponentConstraintSizeMaxSetMinTest: (a: string) => void; + +export const customComponentConstraintSizeMaxMinSetTest: (a: string) => void; + +export const customComponentConstraintSizeSetMaxMinTest: (a: string) => void; + +export const customComponentConstraintSizeMinSetMaxTest: (a: string) => void; + +export const customComponentConstraintSizeMinMaxSetTest: (a: string) => void; + +export const customComponentConstraintSizeSetMinMaxTest: (a: string) => void; + +export const customComponentLinearGradientRightTest: (a: string) => void; + +export const customComponentLinearGradientLeftTopTest: (a: string) => void; + +export const customComponentLinearGradientLeftBottomTest: (a: string) => void; + +export const customComponentShadowMiddleShadowTest: (a: string) => void; + +export const customComponentOnAreaChangeTest: (a: string) => void; + +export const customComponentOnAppearTest: (a: string) => void; + +export const customComponentOnBlurTest: (a: string) => void; + +export const customComponentOnTouchTest: (a: string) => void; + +export const customComponentOnFocusTest: (a: string) => void; + +export const customComponentOnClickTest: (a: string) => void; + +export const customComponentAccessibilityGroupTrueTest: (a: string) => void; + +export const customComponentAccessibilityGroupFalseTest: (a: string) => void; + +export const customComponentAccessibilityTextTest: (a: string) => void; + +export const customComponentAccessibilityTextNullTest: (a: string) => void; + +export const customComponentAccessibilityLevelAutoTest: (a: string) => void; + +export const customComponentAccessibilityLevelDescendantsTest: (a: string) => void; + +export const customComponentAccessibilityLevelDisabledTest: (a: string) => void; + +export const customComponentAccessibilityLevelEnabledTest: (a: string) => void; + +export const customComponentAccessibilityDescriptionTest: (a: string) => void; + +export const customComponentAccessibilityDescriptionNullTest: (a: string) => void; + +export const customComponentForegroundBlurStyleTest: (a: string) => void; + +export const textInputAccessibilityGroupTrueTest: (a: string) => void; + +export const textInputAccessibilityGroupFalseTest: (a: string) => void; + +export const textInputAccessibilityTextTest: (a: string) => void; + +export const textInputAccessibilityTextNullTest: (a: string) => void; + +export const textInputAccessibilityLevelAutoTest: (a: string) => void; + +export const textInputAccessibilityLevelDescendantsTest: (a: string) => void; + +export const textInputAccessibilityLevelDisabledTest: (a: string) => void; + +export const textInputAccessibilityLevelEnabledTest: (a: string) => void; + +export const textInputAccessibilityDescriptionTest: (a: string) => void; + +export const textInputAccessibilityDescriptionNullTest: (a: string) => void; + +export const textAreaAccessibilityGroupTrueTest: (a: string) => void; + +export const textAreaAccessibilityGroupFalseTest: (a: string) => void; + +export const textAreaAccessibilityTextTest: (a: string) => void; + +export const textAreaAccessibilityTextNullTest: (a: string) => void; + +export const textAreaAccessibilityLevelAutoTest: (a: string) => void; + +export const textAreaAccessibilityLevelDescendantsTest: (a: string) => void; + +export const textAreaAccessibilityLevelDisabledTest: (a: string) => void; + +export const textAreaAccessibilityLevelEnabledTest: (a: string) => void; + +export const textAreaAccessibilityDescriptionTest: (a: string) => void; + +export const textAreaAccessibilityDescriptionNullTest: (a: string) => void; + +export const swiperAccessibilityGroupTrueTest: (a: string) => void; + +export const swiperAccessibilityGroupFalseTest: (a: string) => void; + +export const swiperAccessibilityTextTest: (a: string) => void; + +export const swiperAccessibilityTextNullTest: (a: string) => void; + +export const swiperAccessibilityLevelAutoTest: (a: string) => void; + +export const swiperAccessibilityLevelDescendantsTest: (a: string) => void; + +export const swiperAccessibilityLevelDisabledTest: (a: string) => void; + +export const swiperAccessibilityLevelEnabledTest: (a: string) => void; + +export const swiperAccessibilityDescriptionTest: (a: string) => void; + +export const swiperAccessibilityDescriptionNullTest: (a: string) => void; + +export const scrollAccessibilityGroupTrueTest: (a: string) => void; + +export const scrollAccessibilityGroupFalseTest: (a: string) => void; + +export const scrollAccessibilityTextTest: (a: string) => void; + +export const scrollAccessibilityTextNullTest: (a: string) => void; + +export const scrollAccessibilityLevelAutoTest: (a: string) => void; + +export const scrollAccessibilityLevelDescendantsTest: (a: string) => void; + +export const scrollAccessibilityLevelDisabledTest: (a: string) => void; + +export const scrollAccessibilityLevelEnabledTest: (a: string) => void; + +export const scrollAccessibilityDescriptionTest: (a: string) => void; + +export const scrollAccessibilityDescriptionNullTest: (a: string) => void; + +export const listAccessibilityGroupTrueTest: (a: string) => void; + +export const listAccessibilityGroupFalseTest: (a: string) => void; + +export const listAccessibilityTextTest: (a: string) => void; + +export const listAccessibilityTextNullTest: (a: string) => void; + +export const listAccessibilityLevelAutoTest: (a: string) => void; + +export const listAccessibilityLevelDescendantsTest: (a: string) => void; + +export const listAccessibilityLevelDisabledTest: (a: string) => void; + +export const listAccessibilityLevelEnabledTest: (a: string) => void; + +export const listAccessibilityDescriptionTest: (a: string) => void; + +export const listAccessibilityDescriptionNullTest: (a: string) => void; + +export const toggleAccessibilityGroupTrueTest: (a: string) => void; + +export const toggleAccessibilityGroupFalseTest: (a: string) => void; + +export const toggleAccessibilityTextTest: (a: string) => void; + +export const toggleAccessibilityTextNullTest: (a: string) => void; + +export const toggleAccessibilityLevelAutoTest: (a: string) => void; + +export const toggleAccessibilityLevelDescendantsTest: (a: string) => void; + +export const toggleAccessibilityLevelDisabledTest: (a: string) => void; + +export const toggleAccessibilityLevelEnabledTest: (a: string) => void; + +export const toggleAccessibilityDescriptionTest: (a: string) => void; + +export const toggleAccessibilityDescriptionNullTest: (a: string) => void; + +export const textAccessibilityGroupTrueTest: (a: string) => void; + +export const textAccessibilityGroupFalseTest: (a: string) => void; + +export const textAccessibilityTextTest: (a: string) => void; + +export const textAccessibilityTextNullTest: (a: string) => void; + +export const textAccessibilityLevelAutoTest: (a: string) => void; + +export const textAccessibilityLevelDescendantsTest: (a: string) => void; + +export const textAccessibilityLevelDisabledTest: (a: string) => void; + +export const textAccessibilityLevelEnabledTest: (a: string) => void; + +export const textAccessibilityDescriptionTest: (a: string) => void; + +export const textAccessibilityDescriptionNullTest: (a: string) => void; + +export const refreshAccessibilityGroupTrueTest: (a: string) => void; + +export const refreshAccessibilityGroupFalseTest: (a: string) => void; + +export const refreshAccessibilityTextTest: (a: string) => void; + +export const refreshAccessibilityTextNullTest: (a: string) => void; + +export const refreshAccessibilityLevelAutoTest: (a: string) => void; + +export const refreshAccessibilityLevelDescendantsTest: (a: string) => void; + +export const refreshAccessibilityLevelDisabledTest: (a: string) => void; + +export const refreshAccessibilityLevelEnabledTest: (a: string) => void; + +export const refreshAccessibilityDescriptionTest: (a: string) => void; + +export const refreshAccessibilityDescriptionNullTest: (a: string) => void; + +export const datePickerAccessibilityGroupTrueTest: (a: string) => void; + +export const datePickerAccessibilityGroupFalseTest: (a: string) => void; + +export const datePickerAccessibilityTextTest: (a: string) => void; + +export const datePickerAccessibilityTextNullTest: (a: string) => void; + +export const datePickerAccessibilityLevelAutoTest: (a: string) => void; + +export const datePickerAccessibilityLevelDescendantsTest: (a: string) => void; + +export const datePickerAccessibilityLevelDisabledTest: (a: string) => void; + +export const datePickerAccessibilityLevelEnabledTest: (a: string) => void; + +export const datePickerAccessibilityDescriptionTest: (a: string) => void; + +export const datePickerAccessibilityDescriptionNullTest: (a: string) => void; + +export const timePickerAccessibilityGroupTrueTest: (a: string) => void; + +export const timePickerAccessibilityGroupFalseTest: (a: string) => void; + +export const timePickerAccessibilityTextTest: (a: string) => void; + +export const timePickerAccessibilityTextNullTest: (a: string) => void; + +export const timePickerAccessibilityLevelAutoTest: (a: string) => void; + +export const timePickerAccessibilityLevelDescendantsTest: (a: string) => void; + +export const timePickerAccessibilityLevelDisabledTest: (a: string) => void; + +export const timePickerAccessibilityLevelEnabledTest: (a: string) => void; + +export const timePickerAccessibilityDescriptionTest: (a: string) => void; + +export const timePickerAccessibilityDescriptionNullTest: (a: string) => void; + +export const sliderAccessibilityGroupTrueTest: (a: string) => void; + +export const sliderAccessibilityGroupFalseTest: (a: string) => void; + +export const sliderAccessibilityTextTest: (a: string) => void; + +export const sliderAccessibilityTextNullTest: (a: string) => void; + +export const sliderAccessibilityLevelAutoTest: (a: string) => void; + +export const sliderAccessibilityLevelDescendantsTest: (a: string) => void; + +export const sliderAccessibilityLevelDisabledTest: (a: string) => void; + +export const sliderAccessibilityLevelEnabledTest: (a: string) => void; + +export const sliderAccessibilityDescriptionTest: (a: string) => void; + +export const sliderAccessibilityDescriptionNullTest: (a: string) => void; + +export const buttonAccessibilityGroupTrueTest: (a: string) => void; + +export const buttonAccessibilityGroupFalseTest: (a: string) => void; + +export const buttonAccessibilityTextTest: (a: string) => void; + +export const buttonAccessibilityTextNullTest: (a: string) => void; + +export const buttonAccessibilityLevelAutoTest: (a: string) => void; + +export const buttonAccessibilityLevelDescendantsTest: (a: string) => void; + +export const buttonAccessibilityLevelDisabledTest: (a: string) => void; + +export const buttonAccessibilityLevelEnabledTest: (a: string) => void; + +export const buttonAccessibilityDescriptionTest: (a: string) => void; + +export const buttonAccessibilityDescriptionNullTest: (a: string) => void; + +export const textPickerAccessibilityGroupTrueTest: (a: string) => void; + +export const textPickerAccessibilityGroupFalseTest: (a: string) => void; + +export const textPickerAccessibilityTextTest: (a: string) => void; + +export const textPickerAccessibilityTextNullTest: (a: string) => void; + +export const textPickerAccessibilityLevelAutoTest: (a: string) => void; + +export const textPickerAccessibilityLevelDescendantsTest: (a: string) => void; + +export const textPickerAccessibilityLevelDisabledTest: (a: string) => void; + +export const textPickerAccessibilityLevelEnabledTest: (a: string) => void; + +export const textPickerAccessibilityDescriptionTest: (a: string) => void; + +export const textPickerAccessibilityDescriptionNullTest: (a: string) => void; + +export const checkboxAccessibilityGroupTrueTest: (a: string) => void; + +export const checkboxAccessibilityGroupFalseTest: (a: string) => void; + +export const checkboxAccessibilityTextTest: (a: string) => void; + +export const checkboxAccessibilityTextNullTest: (a: string) => void; + +export const checkboxAccessibilityLevelAutoTest: (a: string) => void; + +export const checkboxAccessibilityLevelDescendantsTest: (a: string) => void; + +export const checkboxAccessibilityLevelDisabledTest: (a: string) => void; + +export const checkboxAccessibilityLevelEnabledTest: (a: string) => void; + +export const checkboxAccessibilityDescriptionTest: (a: string) => void; + +export const checkboxAccessibilityDescriptionNullTest: (a: string) => void; + +export const progressAccessibilityGroupTrueTest: (a: string) => void; + +export const progressAccessibilityGroupFalseTest: (a: string) => void; + +export const progressAccessibilityTextTest: (a: string) => void; + +export const progressAccessibilityTextNullTest: (a: string) => void; + +export const progressAccessibilityLevelAutoTest: (a: string) => void; + +export const progressAccessibilityLevelDescendantsTest: (a: string) => void; + +export const progressAccessibilityLevelDisabledTest: (a: string) => void; + +export const progressAccessibilityLevelEnabledTest: (a: string) => void; + +export const progressAccessibilityDescriptionTest: (a: string) => void; + +export const progressAccessibilityDescriptionNullTest: (a: string) => void; + +export const textInputAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const textInputAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const textAreaAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const textAreaAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const swiperAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const swiperAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const scrollAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const scrollAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const listAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const listAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const toggleAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const toggleAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const textAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const textAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const refreshAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const refreshAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const datePickerAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const datePickerAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const timePickerAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const timePickerAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const sliderAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const sliderAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const buttonAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const buttonAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const textPickerAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const textPickerAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const checkboxAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const checkboxAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const progressAccessibilityLevelLowerAbnormalTest: (a: string) => void; + +export const progressAccessibilityLevelUpperAbnormalTest: (a: string) => void; + +export const textInputBackgroundColorTest: (a: string) => void; + +export const textInputBackgroundImageTest: (a: string) => void; + +export const textInputClipTest: (a: string) => void; + +export const textInputFontColorTest: (a: string) => void; + +export const textInputCaretColorTest: (a: string) => void; + +export const textInputFontSizeTest: (a: string) => void; + +export const textInputFontStyleTest: (a: string) => void; + +export const textInputFontWeightTest: (a: string) => void; + +export const textInputTextAlignTest: (a: string) => void; + +export const textInputShowUnderLineTest: (a: string) => void; + +export const textInputPaddingTest: (a: string) => void; + +export const textInputOnBlurTest: (a: string) => void; + +export const textInputOnFocusTest: (a: string) => void; + +export const textInputOnSubmitTest: (a: string) => void; + +export const textInputOnCutTest: (a: string) => void; + +export const textInputOnPasteTest: (a: string) => void; + +export const textInputDefaultFocusTrueTest: (a: string) => void; + +export const textInputDefaultFocusFalseTest: (a: string) => void; + +export const textInputDefaultFocusNoneTest: (a: string) => void; + +export const textInputDefaultFocusSingleTest: (a: string) => void; + +export const textInputDefaultFocusMultiTest: (a: string) => void; + +export const sliderBlockColorTest: (a: string) => void; + +export const sliderBlockStyleTest: (a: string) => void; + +export const sliderBlockStyleAbnormalTest: (a: string) => void; + +export const sliderDirectionTest: (a: string) => void; + +export const sliderDirectionAbnormalTest: (a: string) => void; + +export const sliderValueTest: (a: string) => void; + +export const sliderValueAbnormalTest: (a: string) => void; + +export const sliderValueLargeTest: (a: string) => void; + +export const sliderMinTest: (a: string) => void; + +export const sliderMinAbnormalTest: (a: string) => void; + +export const sliderMinLargeTest: (a: string) => void; + +export const sliderMaxTest: (a: string) => void; + +export const sliderMaxAbnormalTest: (a: string) => void; + +export const sliderMaxLargeTest: (a: string) => void; + +export const sliderReverseTest: (a: string) => void; + +export const sliderReverseAbnormalTest: (a: string) => void; + +export const sliderReverseLargeTest: (a: string) => void; + +export const sliderSelectedColorTest: (a: string) => void; + +export const sliderShowStepsTest: (a: string) => void; + +export const sliderShowStepsAbnormalTest: (a: string) => void; + +export const sliderStepTest: (a: string) => void; + +export const sliderStepAbnormalTest: (a: string) => void; + +export const sliderStepLargeTest: (a: string) => void; + +export const sliderStyleTest: (a: string) => void; + +export const sliderStyleAbnormalTest: (a: string) => void; + +export const sliderStyleLargeTest: (a: string) => void; + +export const sliderTrackColorTest: (a: string) => void; + +export const sliderOnChangeTest: (a: string) => void; + +export const textInputLineHeightTest: (a: string) => void; + +export const textInputLineHeightAbnormalTest: (a: string) => void; + +export const textInputStopEditingTrueTest: (a: string) => void; + +export const textInputStopEditingNoneFalseTest: (a: string) => void; + +export const textInputStopEditingNoneTrueTest: (a: string) => void; + +export const textInputStopEditingChangeType: (a: number) => void; + +export const textInputStopEditingFalseTest: (a: string) => void; + +export const textAreaFontColorTest: (a: string) => void; + +export const textAreaFontColorBlackTest: (a: string) => void; + +export const textAreaFontColorWhiteTest: (a: string) => void; + +export const textAreaFontSizeTest: (a: string) => void; + +export const textAreaFontSizeNoneTest: (a: string) => void; + +export const textAreaFontSizeAbnormalTest: (a: string) => void; + +export const textAreaFontFamilyTest: (a: string) => void; + +export const textAreaFontFamilyNoneTest: (a: string) => void; + +export const textAreaFontStyleNormalTest: (a: string) => void; + +export const textAreaFontStyleItalicTest: (a: string) => void; + +export const textAreaFontWeightTest: (a: string) => void; + +export const textAreaFontWeightChangeTypeTest: (a: number) => void; + +export const textAreaMaxLengthTest: (a: string) => void; + +export const textAreaMaxLengthNoneTest: (a: string) => void; + +export const textAreaMaxLengthAbnormalTest: (a: string) => void; + +export const textAreaPlaceHolderColorTest: (a: string) => void; + +export const textAreaPlaceHolderColorBlackTest: (a: string) => void; + +export const textAreaPlaceHolderColorWhiteTest: (a: string) => void; + +export const textAreaPlaceholderFontTest: (a: string) => void; + +export const textAreaPlaceholderFontChangeTypeTest: (a: number) => void; + +export const textAreaTextAlignStartTest: (a: string) => void; + +export const textAreaTextAlignCenterTest: (a: string) => void; + +export const textAreaTextAlignEndTest: (a: string) => void; + +export const textAreaTextAlignJustifyTest: (a: string) => void; + +export const textAreaTextAlignAbnormalTest: (a: string) => void; + +export const textAreaPaddingTest: (a: string) => void; + +export const textAreaPaddingAllTest: (a: string) => void; + +export const textAreaBackgroundColorTest: (a: string) => void; + +export const textAreaBackgroundColorBlackTest: (a: string) => void; + +export const textAreaBackgroundColorWhiteTest: (a: string) => void; + +export const textAreaBorderRadiusSingleTest: (a: string) => void; + +export const textAreaBorderRadiusAbnormalTest: (a: string) => void; + +export const textAreaBorderRadiusAllParamTest: (a: string) => void; + +export const textAreaCaretColorTest: (a: string) => void; + +export const textAreaCaretColorBlackTest: (a: string) => void; + +export const textAreaCaretColorWhiteTest: (a: string) => void; + +export const textAreaLineHeightTest: (a: string) => void; + +export const textAreaLineHeightNoneTest: (a: string) => void; + +export const textAreaOnBlurTest: (a: string) => void; + +export const textAreaStopEditingTrueTest: (a: string) => void; + +export const textAreaStopEditingNoneFalseTest: (a: string) => void; + +export const textAreaStopEditingNoneTrueTest: (a: string) => void; + +export const textAreaStopEditingChangeType: (a: number) => void; + +export const textAreaKeyTest: (a: string) => void; + +export const textInputKeyTest: (a: string) => void; + +export const textAreaStopEditingFalseTest: (a: string) => void; + +export const loadingProgressColorTest: (a: string) => void; + +export const loadingProgressColorBlackTest: (a: string) => void; + +export const loadingProgressColorWhiteTest: (a: string) => void; + +export const loadingProgressEnableLoadingTrueTest: (a: string) => void; + +export const loadingProgressEnableLoadingFalseTest: (a: string) => void; + +export const progressColorTest: (a: string) => void; + +export const progressColorBlackTest: (a: string) => void; + +export const progressColorWhiteTest: (a: string) => void; + +export const progressBackgroundColorTest: (a: string) => void; + +export const progressBackgroundColorBlackTest: (a: string) => void; + +export const progressBackgroundColorWhiteTest: (a: string) => void; + +export const progressStyleLinearTest: (a: string) => void; + +export const progressStyleRingTest: (a: string) => void; + +export const progressStyleScaleRingTest: (a: string) => void; + +export const progressStyleEclipseTest: (a: string) => void; + +export const progressStyleCapsuleTest: (a: string) => void; + +export const textAreaOnFocusTest: (a: string) => void; + +export const textAreaOnChangeTest: (a: string) => void; + +export const refreshOnStateChangeTest: (a: string) => void; + +export const refreshOnRefreshingTest: (a: string) => void; + +export const textInputMaxLengthTest: (a: string) => void; + +export const textInputMaxLengthNoneTest: (a: string) => void; + +export const textInputMaxLengthAbnormalTest: (a: string) => void; + +export const textInputPlaceholderColorTest: (a: string) => void; + +export const textInputPlaceholderColorBlackTest: (a: string) => void; + +export const textInputPlaceholderColorWhiteTest: (a: string) => void; + +export const textInputPlaceholderFontTest: (a: string) => void; + +export const textInputPlaceholderFontChangeTypeTest: (a: number) => void; + +export const textInputFontFamilySingleTest: (a: string) => void; + +export const textInputFontFamilyAddTest: (a: string) => void; + +export const textInputClearButtonModeInputTest: (a: string) => void; + +export const textInputClearButtonModeInvisibleTest: (a: string) => void; + +export const textInputClearButtonModeConstantTest: (a: string) => void; + +export const textInputClearButtonModeAbnormalTest: (a: string) => void; + +export const textInputResponseRegionSingleTest: (a: string) => void; + +export const textInputResponseRegionDoubleTest: (a: string) => void; + +export const textAreaResponseRegionSingleTest: (a: string) => void; + +export const textAreaResponseRegionDoubleTest: (a: string) => void; + +export const textAreaDefaultFocusTrueTest: (a: string) => void; + +export const textAreaDefaultFocusFalseTest: (a: string) => void; + +export const textAreaDefaultFocusNoneTest: (a: string) => void; + +export const textAreaDefaultFocusSingleTest: (a: string) => void; + +export const textAreaDefaultFocusMultiTest: (a: string) => void; + +export const listBackgroundColorNullTest: (a: string) => void; + +export const listBackgroundColorUndefinedTest: (a: string) => void; + +export const listBorderColorNullTest: (a: string) => void; + +export const listBorderColorUndefinedTest: (a: string) => void; + +export const listCachedCountAbnormalTest: (a: string) => void; + +export const listEdgeEffectFadeTest: (a: string, b: string) => void; + +export const listEdgeEffectLowerBoundAbnormalTest: (a: string, b: string) => void; + +export const listEdgeEffectNoneTest: (a: string, b: string) => void; + +export const listEdgeEffectSpringTest: (a: string, b: string) => void; + +export const listEdgeEffectUpperBoundAbnormalTest: (a: string, b: string) => void; + +export const listItemEdgeEffectFadeTest: (a: string, b: string) => void; + +export const listItemEdgeEffectLowerBoundAbnormalTest: (a: string, b: string) => void; + +export const listItemEdgeEffectNoneTest: (a: string, b: string) => void; + +export const listItemEdgeEffectSpringTest: (a: string, b: string) => void; + +export const listItemEdgeEffectUpperBoundAbnormalTest: (a: string, b: string) => void; + +export const listItemBackgroundColorNullTest: (a: string) => void; + +export const listItemBackgroundColorUndefinedTest: (a: string) => void; + +export const listItemBorderColorNullTest: (a: string) => void; + +export const listItemBorderColorUndefinedTest: (a: string) => void; + +export const listItemCachedCountAbnormalTest: (a: string) => void; + +export const scrollBorderColorNullTest: (a: string) => void; + +export const scrollBorderColorUndefinedTest: (a: string) => void; + +export const sliderMaxEqualMinTest: (a: string) => void; + +export const sliderStepUnevenTest: (a: string) => void; + +export const textInputStopEditingAbnormalTest: (a: string) => void; + +export const textInputStopEditingNoneAbnormalTest: (a: string) => void; + +export const textInputDefaultFocusAbnormalTest: (a: string) => void; + +export const textAreaStopEditingAbnormalTest: (a: string) => void; + +export const textAreaStopEditingNoneAbnormalTest: (a: string) => void; + +export const textAreaDefaultFocusAbnormalTest: (a: string) => void; + +export const textInputCaretStyleDecimalTest: (a: string) => void; + +export const datePickerStartAbnormalTest: (a: string) => void; + +export const datePickerEndAbnormalTest: (a: string) => void; + +export const datePickerSelectedAbnormalTest: (a: string) => void; + +export const textPickerDisappearTextStyleBoldTest: (a: string) => void; + +export const textPickerDisappearTextStyleNormalTest: (a: string) => void; + +export const textPickerDisappearTextStyleBolderTest: (a: string) => void; + +export const textPickerDisappearTextStyleLighterTest: (a: string) => void; + +export const textPickerDisappearTextStyleMediumTest: (a: string) => void; + +export const textPickerDisappearTextStyleRegularTest: (a: string) => void; + +export const textPickerTextStyleBoldTest: (a: string) => void; + +export const textPickerTextStyleNormalTest: (a: string) => void; + +export const textPickerTextStyleBolderTest: (a: string) => void; + +export const textPickerTextStyleLighterTest: (a: string) => void; + +export const textPickerTextStyleMediumTest: (a: string) => void; + +export const textPickerTextStyleRegularTest: (a: string) => void; + +export const textPickerSelectedTextStyleBoldTest: (a: string) => void; + +export const textPickerSelectedTextStyleNormalTest: (a: string) => void; + +export const textPickerSelectedTextStyleBolderTest: (a: string) => void; + +export const textPickerSelectedTextStyleLighterTest: (a: string) => void; + +export const textPickerSelectedTextStyleMediumTest: (a: string) => void; + +export const textPickerSelectedTextStyleRegularTest: (a: string) => void; + +export const timePickerTextStyleBoldTest: (a: string) => void; + +export const timePickerTextStyleNormalTest: (a: string) => void; + +export const timePickerTextStyleBolderTest: (a: string) => void; + +export const timePickerTextStyleLighterTest: (a: string) => void; + +export const timePickerTextStyleMediumTest: (a: string) => void; + +export const timePickerTextStyleRegularTest: (a: string) => void; + +export const timePickerSelectedTextStyleBoldTest: (a: string) => void; + +export const timePickerSelectedTextStyleNormalTest: (a: string) => void; + +export const timePickerSelectedTextStyleBolderTest: (a: string) => void; + +export const timePickerSelectedTextStyleLighterTest: (a: string) => void; + +export const timePickerSelectedTextStyleMediumTest: (a: string) => void; + +export const timePickerSelectedTextStyleRegularTest: (a: string) => void; + +export const timePickerDisappearTextStyleBoldTest: (a: string) => void; + +export const timePickerDisappearTextStyleNormalTest: (a: string) => void; + +export const timePickerDisappearTextStyleBolderTest: (a: string) => void; + +export const timePickerDisappearTextStyleLighterTest: (a: string) => void; + +export const timePickerDisappearTextStyleMediumTest: (a: string) => void; + +export const timePickerDisappearTextStyleRegularTest: (a: string) => void; + +export const swiperLoopTest: (a: string) => void; + +export const swiperIntervalTest: (a: string) => void; + +export const swiperCurveTest: (a: string) => void; + +export const swiperDurationTest: (a: string) => void; + +export const commonAttrsFocusableCombineTest: (a: string) => void; + +export const toggleFocusableCombineTest: (a: string) => void; + +export const scrollScrollBarColorNullTest: (a: string) => void; + +export const scrollScrollBarColorUndefinedTest: (a: string) => void; + +export const scrollScrollSnapLowerAbnormalTest: (a: string, b: string) => void; + +export const scrollScrollSnapUpperAbnormalTest: (a: string, b: string) => void; \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/types/libnativerender/oh-package.json5 b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/types/libnativerender/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..fa7874d5940d85b92897a2ea31cb1e3db1fab564 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/types/libnativerender/oh-package.json5 @@ -0,0 +1,6 @@ +{ + "name": "libnativerender.so", + "types": "./index.d.ts", + "version": "", + "description": "Please describe the basic information." +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_height_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_height_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..af07d03e8de95505688c5983c1d3e8986bb1f11c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_height_test.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "xComponent_height_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define SIZE_NEGATIVE_50 (-50) + +napi_value XComponentHeightTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentHeightTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentHeightTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置XComponent组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置XComponent组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置XComponent组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置XComponent组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first xComponent + auto xComponent = nodeAPI->createNode(ARKUI_NODE_XCOMPONENT); + nodeAPI->setAttribute(xComponent, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(xComponent, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(xComponent, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(xComponent, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_HEIGHT, &height_item); + + // second xComponent + auto xComponentSecond = nodeAPI->createNode(ARKUI_NODE_XCOMPONENT); + nodeAPI->setAttribute(xComponentSecond, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(xComponentSecond, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(xComponentSecond, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(xComponentSecond, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue height_second_value[] = {{.f32 = SIZE_NEGATIVE_50}}; + ArkUI_AttributeItem height_second_item = {height_second_value, + sizeof(height_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponentSecond, NODE_HEIGHT, &height_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, xComponent); + nodeAPI->insertChildAfter(column, xComponentSecond, xComponent); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentHeightTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value XComponentHeightTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentHeightTest", "CreateNativeNodeLarge"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentHeightTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置高度为500 + auto xComponent = nodeAPI->createNode(ARKUI_NODE_XCOMPONENT); + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_HEIGHT, &height_item); + + // 设置XComponent组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置宽度为200 + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_WIDTH, &width_item); + + nodeAPI->addChild(column, xComponent); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentHeightTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_height_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_height_test.h new file mode 100644 index 0000000000000000000000000000000000000000..377a153a01a1e12412699fbb77dc719ac22e5f7c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_height_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_XCOMPONENT_HEIGHT_TEST_H +#define ARKUI_CAPI_DEMO_XCOMPONENT_HEIGHT_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class XComponentHeightTest { +public: + ~XComponentHeightTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_XCOMPONENT_HEIGHT_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_sourceid_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_sourceid_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e82dde372fa93f9e9875b7f00961906dfb58f4d8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_sourceid_test.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "xcomponent_sourceid_test.h" +#include "../manager/plugin_manager.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto createChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI) +{ + auto xComponent = nodeAPI->createNode(ARKUI_NODE_XCOMPONENT); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_WIDTH, &width_item); + + ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_HEIGHT, &height_item); + + nodeAPI->registerNodeEvent(xComponent, NODE_ON_CLICK, ON_CLICK_EVENT_ID, nullptr); + + return xComponent; +} + +napi_value XComponentSourceIdTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSourceIdTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto xComponent = createChildNode(nodeAPI); + + nodeAPI->addChild(column, xComponent); + + ArkUI_AttributeItem idItem = {}; + idItem.string = "xComponentKey"; + nodeAPI->setAttribute(xComponent, NODE_XCOMPONENT_ID, &idItem); + + auto sourceId = nodeAPI->getAttribute(xComponent, NODE_XCOMPONENT_ID); + if (sourceId != nullptr) { + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_BACKGROUND_COLOR, &background_color_item); + } + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSourceIdTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_sourceid_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_sourceid_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8928490b713666e91f07f83b073f29363307f677 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_sourceid_test.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_XCOMPONENT_SOURCEID_TEST_H +#define ARKUI_CAPI_DEMO_XCOMPONENT_SOURCEID_TEST_H + +#include "../common/common.h" +#include +#include +#include + +namespace ArkUICApiDemo { + +class XComponentSourceIdTest { +public: + ~XComponentSourceIdTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_XCOMPONENT_SOURCEID_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_egl_core.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_egl_core.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4853b5d3375d6af7ea9b3c5fb94890db804a8117 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_egl_core.cpp @@ -0,0 +1,512 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "xcomponent_surface_egl_core.h" + +#include +#include +#include +#include +#include +#include + +#include "../common/common.h" +#include "xcomponent_surface_render.h" + +namespace ArkUICApiDemo { +namespace { +constexpr int32_t NUM_4 = 4; +/** + * Vertex shader. + */ +const char VERTEX_SHADER[] = "#version 300 es\n" + "layout(location = 0) in vec4 a_position;\n" + "layout(location = 1) in vec4 a_color; \n" + "out vec4 v_color; \n" + "void main() \n" + "{ \n" + " gl_Position = a_position; \n" + " v_color = a_color; \n" + "} \n"; + +/** + * Fragment shader. + */ +const char FRAGMENT_SHADER[] = "#version 300 es\n" + "precision mediump float; \n" + "in vec4 v_color; \n" + "out vec4 fragColor; \n" + "void main() \n" + "{ \n" + " fragColor = v_color; \n" + "} \n"; + +/** + * Background color #f4f4f4. + */ +const GLfloat BACKGROUND_COLOR[] = {244.0f / 255, 244.0f / 255, 244.0f / 255, 1.0f}; + +/** + * Draw color #7E8FFB. + */ +const GLfloat DRAW_COLOR[] = {126.0f / 255, 143.0f / 255, 251.0f / 255, 1.0f}; + +/** + * Background area. + */ +const GLfloat BACKGROUND_RECTANGLE_VERTICES[] = {-1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f}; + +/** + * Get context parameter count. + */ +const size_t GET_CONTEXT_PARAM_CNT = 1; + +/** + * Fifty percent. + */ +const float FIFTY_PERCENT = 0.5; + +/** + * Pointer size. + */ +const GLint POINTER_SIZE = 2; + +/** + * Triangle fan size. + */ +const GLsizei TRIANGLE_FAN_SIZE = 4; + +/** + * Egl red size default. + */ +const int EGL_RED_SIZE_DEFAULT = 8; + +/** + * Egl green size default. + */ +const int EGL_GREEN_SIZE_DEFAULT = 8; + +/** + * Egl blue size default. + */ +const int EGL_BLUE_SIZE_DEFAULT = 8; + +/** + * Egl alpha size default. + */ +const int EGL_ALPHA_SIZE_DEFAULT = 8; + +/** + * Default x position. + */ +const int DEFAULT_X_POSITION = 0; + +/** + * Default y position. + */ +const int DEFAULT_Y_POSITION = 0; + +/** + * Gl red default. + */ +const GLfloat GL_RED_DEFAULT = 0.0; + +/** + * Gl green default. + */ +const GLfloat GL_GREEN_DEFAULT = 0.0; + +/** + * Gl blue default. + */ +const GLfloat GL_BLUE_DEFAULT = 0.0; + +/** + * Gl alpha default. + */ +const GLfloat GL_ALPHA_DEFAULT = 1.0; + +/** + * Program error. + */ +const GLuint PROGRAM_ERROR = 0; + +/** + * Shape vertices size. + */ +const int SHAPE_VERTICES_SIZE = 8; + +/** + * Position handle name. + */ +const char POSITION_NAME[] = "a_position"; + +/** + * Position error. + */ +const GLint POSITION_ERROR = -1; + +/** + * Config attribute list. + */ +const EGLint ATTRIB_LIST[] = { + // Key,value. + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RED_SIZE, EGL_RED_SIZE_DEFAULT, EGL_GREEN_SIZE, EGL_GREEN_SIZE_DEFAULT, + EGL_BLUE_SIZE, EGL_BLUE_SIZE_DEFAULT, EGL_ALPHA_SIZE, EGL_ALPHA_SIZE_DEFAULT, EGL_RENDERABLE_TYPE, + EGL_OPENGL_ES2_BIT, + // End. + EGL_NONE}; + +/** + * Context attributes. + */ +const EGLint CONTEXT_ATTRIBS[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE}; +} // namespace +bool XComponentSurfaceEGLCore::EglContextInit(void *window, int width, int height) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "EglContextInit execute"); + if ((window == nullptr) || (width <= 0) || (height <= 0)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "EglContextInit: param error"); + return false; + } + + UpdateSize(width, height); + eglWindow_ = static_cast(window); + + // Init display. + eglDisplay_ = eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (eglDisplay_ == EGL_NO_DISPLAY) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "eglGetDisplay: unable to get EGL display"); + return false; + } + + EGLint majorVersion; + EGLint minorVersion; + if (!eglInitialize(eglDisplay_, &majorVersion, &minorVersion)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "eglInitialize: unable to get initialize EGL display"); + return false; + } + + // Select configuration. + const EGLint maxConfigSize = 1; + EGLint numConfigs; + if (!eglChooseConfig(eglDisplay_, ATTRIB_LIST, &eglConfig_, maxConfigSize, &numConfigs)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "eglChooseConfig: unable to choose configs"); + return false; + } + + return CreateEnvironment(); +} + +bool XComponentSurfaceEGLCore::CreateEnvironment() +{ + // Create surface. + if (eglWindow_ == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "eglWindow_ is null"); + return false; + } + eglSurface_ = eglCreateWindowSurface(eglDisplay_, eglConfig_, eglWindow_, NULL); + if (eglSurface_ == nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "eglCreateWindowSurface: unable to create surface"); + return false; + } + // Create context. + eglContext_ = eglCreateContext(eglDisplay_, eglConfig_, EGL_NO_CONTEXT, CONTEXT_ATTRIBS); + if (!eglMakeCurrent(eglDisplay_, eglSurface_, eglSurface_, eglContext_)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "eglMakeCurrent failed"); + return false; + } + // Create program. + program_ = CreateProgram(VERTEX_SHADER, FRAGMENT_SHADER); + if (program_ == PROGRAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "CreateProgram: unable to create program"); + return false; + } + return true; +} + +void XComponentSurfaceEGLCore::Draw() +{ + flag_ = false; + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "Draw"); + GLint position = PrepareDraw(); + if (position == POSITION_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "Draw get position failed"); + return; + } + + if (!ExecuteDraw(position, BACKGROUND_COLOR, BACKGROUND_RECTANGLE_VERTICES, + sizeof(BACKGROUND_RECTANGLE_VERTICES))) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "Draw execute draw background failed"); + return; + } + + // Divided into five quadrilaterals and calculate one of the quadrilateral's Vertices + GLfloat rotateX = 0; + GLfloat rotateY = FIFTY_PERCENT * height_; + GLfloat centerX = 0; + // Convert DEG(54° & 18°) to RAD + GLfloat centerY = -rotateY * (M_PI / 180 * 54) * (M_PI / 180 * 18); + // Convert DEG(18°) to RAD + GLfloat leftX = -rotateY * (M_PI / 180 * 18); + GLfloat leftY = 0; + // Convert DEG(18°) to RAD + GLfloat rightX = rotateY * (M_PI / 180 * 18); + GLfloat rightY = 0; + + const GLfloat shapeVertices[] = {centerX / width_, centerY / height_, leftX / width_, leftY / height_, + rotateX / width_, rotateY / height_, rightX / width_, rightY / height_}; + + if (!ExecuteDrawStar(position, DRAW_COLOR, shapeVertices, sizeof(shapeVertices))) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "Draw execute draw shape failed"); + return; + } + + // Convert DEG(72°) to RAD + GLfloat rad = M_PI / 180 * 72; + // Rotate four times + for (int i = 0; i < NUM_4; ++i) { + Rotate2d(centerX, centerY, &rotateX, &rotateY, rad); + Rotate2d(centerX, centerY, &leftX, &leftY, rad); + Rotate2d(centerX, centerY, &rightX, &rightY, rad); + + const GLfloat shapeVertices[] = {centerX / width_, centerY / height_, leftX / width_, leftY / height_, + rotateX / width_, rotateY / height_, rightX / width_, rightY / height_}; + + if (!ExecuteDrawStar(position, DRAW_COLOR, shapeVertices, sizeof(shapeVertices))) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "Draw execute draw shape failed"); + return; + } + } + + if (!FinishDraw()) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "Draw FinishDraw failed"); + return; + } + + flag_ = true; +} + +GLint XComponentSurfaceEGLCore::PrepareDraw() +{ + if ((eglDisplay_ == nullptr) || (eglSurface_ == nullptr) || (eglContext_ == nullptr) || + (!eglMakeCurrent(eglDisplay_, eglSurface_, eglSurface_, eglContext_))) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "PrepareDraw: param error"); + return POSITION_ERROR; + } + + // The gl function has no return value. + glViewport(DEFAULT_X_POSITION, DEFAULT_Y_POSITION, width_, height_); + glClearColor(GL_RED_DEFAULT, GL_GREEN_DEFAULT, GL_BLUE_DEFAULT, GL_ALPHA_DEFAULT); + glClear(GL_COLOR_BUFFER_BIT); + glUseProgram(program_); + + return glGetAttribLocation(program_, POSITION_NAME); +} + +bool XComponentSurfaceEGLCore::ExecuteDraw(GLint position, const GLfloat *color, const GLfloat shapeVertices[], + unsigned long vertSize) +{ + if ((position > 0) || (color == nullptr) || (vertSize / sizeof(shapeVertices[0])) != SHAPE_VERTICES_SIZE) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "ExecuteDraw: param error"); + return false; + } + + // The gl function has no return value. + glVertexAttribPointer(position, POINTER_SIZE, GL_FLOAT, GL_FALSE, 0, shapeVertices); + glEnableVertexAttribArray(position); + glVertexAttrib4fv(1, color); + glDrawArrays(GL_TRIANGLE_FAN, 0, TRIANGLE_FAN_SIZE); + glDisableVertexAttribArray(position); + + return true; +} + +bool XComponentSurfaceEGLCore::ExecuteDrawStar(GLint position, const GLfloat *color, const GLfloat shapeVertices[], + unsigned long vertSize) +{ + if ((position > 0) || (color == nullptr) || (vertSize / sizeof(shapeVertices[0])) != SHAPE_VERTICES_SIZE) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "ExecuteDraw: param error"); + return false; + } + + // The gl function has no return value. + glVertexAttribPointer(position, POINTER_SIZE, GL_FLOAT, GL_FALSE, 0, shapeVertices); + glVertexAttribPointer(1, POINTER_SIZE, GL_FLOAT, GL_FALSE, 0, color); + glEnableVertexAttribArray(position); + glEnableVertexAttribArray(1); + glVertexAttrib4fv(1, color); + glDrawArrays(GL_TRIANGLE_FAN, 0, TRIANGLE_FAN_SIZE); + glDisableVertexAttribArray(position); + glDisableVertexAttribArray(1); + + return true; +} + +void XComponentSurfaceEGLCore::Rotate2d(GLfloat centerX, GLfloat centerY, GLfloat *rotateX, GLfloat *rotateY, + GLfloat theta) +{ + GLfloat tempX = cos(theta) * (*rotateX - centerX) - sin(theta) * (*rotateY - centerY); + GLfloat tempY = sin(theta) * (*rotateX - centerX) + cos(theta) * (*rotateY - centerY); + *rotateX = tempX + centerX; + *rotateY = tempY + centerY; +} + +bool XComponentSurfaceEGLCore::FinishDraw() +{ + // The gl function has no return value. + glFlush(); + glFinish(); + return eglSwapBuffers(eglDisplay_, eglSurface_); +} + +GLuint XComponentSurfaceEGLCore::LoadShader(GLenum type, const char *shaderSrc) +{ + if ((type <= 0) || (shaderSrc == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "glCreateShader type or shaderSrc error"); + return PROGRAM_ERROR; + } + + GLuint shader = glCreateShader(type); + if (shader == 0) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "glCreateShader unable to load shader"); + return PROGRAM_ERROR; + } + + // The gl function has no return value. + glShaderSource(shader, 1, &shaderSrc, nullptr); + glCompileShader(shader); + + GLint compiled; + glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); + if (compiled != 0) { + return shader; + } + + GLint infoLen = 0; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); + if (infoLen <= 1) { + glDeleteShader(shader); + return PROGRAM_ERROR; + } + + char *infoLog = (char *)malloc(sizeof(char) * (infoLen + 1)); + if (infoLog != nullptr) { + memset(infoLog, 0, infoLen + 1); + glGetShaderInfoLog(shader, infoLen, nullptr, infoLog); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "glCompileShader error = %s", + infoLog); + free(infoLog); + infoLog = nullptr; + } + glDeleteShader(shader); + return PROGRAM_ERROR; +} + +GLuint XComponentSurfaceEGLCore::CreateProgram(const char *vertexShader, const char *fragShader) +{ + if ((vertexShader == nullptr) || (fragShader == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "createProgram: vertexShader or fragShader is null"); + return PROGRAM_ERROR; + } + + GLuint vertex = LoadShader(GL_VERTEX_SHADER, vertexShader); + if (vertex == PROGRAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "createProgram vertex error"); + return PROGRAM_ERROR; + } + + GLuint fragment = LoadShader(GL_FRAGMENT_SHADER, fragShader); + if (fragment == PROGRAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "createProgram fragment error"); + return PROGRAM_ERROR; + } + + GLuint program = glCreateProgram(); + if (program == PROGRAM_ERROR) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "createProgram program error"); + glDeleteShader(vertex); + glDeleteShader(fragment); + return PROGRAM_ERROR; + } + + // The gl function has no return value. + glAttachShader(program, vertex); + glAttachShader(program, fragment); + glLinkProgram(program); + + GLint linked; + glGetProgramiv(program, GL_LINK_STATUS, &linked); + if (linked != 0) { + glDeleteShader(vertex); + glDeleteShader(fragment); + return program; + } + + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "createProgram linked error"); + GLint infoLen = 0; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLen); + if (infoLen > 1) { + char *infoLog = (char *)malloc(sizeof(char) * (infoLen + 1)); + memset(infoLog, 0, infoLen + 1); + glGetProgramInfoLog(program, infoLen, nullptr, infoLog); + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "glLinkProgram error = %s", + infoLog); + free(infoLog); + infoLog = nullptr; + } + glDeleteShader(vertex); + glDeleteShader(fragment); + glDeleteProgram(program); + return PROGRAM_ERROR; +} + +void XComponentSurfaceEGLCore::UpdateSize(int width, int height) +{ + width_ = width; + height_ = height; + if (width_ > 0) { + widthPercent_ = FIFTY_PERCENT * height_ / width_; + } +} + +void XComponentSurfaceEGLCore::Release() +{ + if ((eglDisplay_ == nullptr) || (eglSurface_ == nullptr) || (!eglDestroySurface(eglDisplay_, eglSurface_))) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "Release eglDestroySurface failed"); + } + + if ((eglDisplay_ == nullptr) || (eglContext_ == nullptr) || (!eglDestroyContext(eglDisplay_, eglContext_))) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", + "Release eglDestroyContext failed"); + } + + if ((eglDisplay_ == nullptr) || (!eglTerminate(eglDisplay_))) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentSurfaceEGLCore", "Release eglTerminate failed"); + } +} +} // namespace ArkUICApiDemo diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_egl_core.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_egl_core.h new file mode 100644 index 0000000000000000000000000000000000000000..b1b9d12c7ea8897c042e8aece25cadaa490025b6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_egl_core.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ +#ifndef ARKUI_CAPI_DEMO_XCOMPONENT_EGL_CORE_H +#define ARKUI_CAPI_DEMO_XCOMPONENT_EGL_CORE_H + +#include +#include +#include + +namespace ArkUICApiDemo { +class XComponentSurfaceEGLCore { +public: + explicit XComponentSurfaceEGLCore(){}; + ~XComponentSurfaceEGLCore() {} + bool EglContextInit(void *window, int width, int height); + bool CreateEnvironment(); + void Draw(); + void Release(); + void UpdateSize(int width, int height); + +private: + GLuint LoadShader(GLenum type, const char *shaderSrc); + GLuint CreateProgram(const char *vertexShader, const char *fragShader); + GLint PrepareDraw(); + bool ExecuteDraw(GLint position, const GLfloat *color, const GLfloat shapeVertices[], unsigned long vertSize); + bool ExecuteDrawStar(GLint position, const GLfloat *color, const GLfloat shapeVertices[], unsigned long vertSize); + void Rotate2d(GLfloat centerX, GLfloat centerY, GLfloat *rotateX, GLfloat *rotateY, GLfloat theta); + bool FinishDraw(); + +private: + EGLNativeWindowType eglWindow_; + EGLDisplay eglDisplay_ = EGL_NO_DISPLAY; + EGLConfig eglConfig_ = EGL_NO_CONFIG_KHR; + EGLSurface eglSurface_ = EGL_NO_SURFACE; + EGLContext eglContext_ = EGL_NO_CONTEXT; + GLuint program_; + bool flag_ = false; + int width_; + int height_; + GLfloat widthPercent_; +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_XCOMPONENT_EGL_CORE_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_render.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_render.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bcf5125c20ac3ef9d9d12d6ef294b144f805e3f6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_render.cpp @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include +#include +#include + +#include "xcomponent_surface_render.h" + +namespace ArkUICApiDemo { +namespace { +void OnSurfaceCreatedCB(OH_NativeXComponent *component, void *window) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "Callback", "OnSurfaceCreatedCB"); + if ((component == nullptr) || (window == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Callback", + "OnSurfaceCreatedCB: component or window is null"); + return; + } + + char idStr[OH_XCOMPONENT_ID_LEN_MAX + 1] = {'\0'}; + uint64_t idSize = OH_XCOMPONENT_ID_LEN_MAX + 1; + if (OH_NativeXComponent_GetXComponentId(component, idStr, &idSize) != OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Callback", + "OnSurfaceCreatedCB: Unable to get XComponent id"); + return; + } + + std::string id(idStr); + auto render = XComponentSurfaceRender::GetInstance(id); + uint64_t width; + uint64_t height; + int32_t xSize = OH_NativeXComponent_GetXComponentSize(component, window, &width, &height); + if ((xSize == OH_NATIVEXCOMPONENT_RESULT_SUCCESS) && (render != nullptr)) { + if (render->eglCore_->EglContextInit(window, width, height)) { + render->eglCore_->Draw(); + } + } +} + +void OnSurfaceChangedCB(OH_NativeXComponent *component, void *window) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "Callback", "OnSurfaceChangedCB"); + if ((component == nullptr) || (window == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Callback", + "OnSurfaceChangedCB: component or window is null"); + return; + } + + char idStr[OH_XCOMPONENT_ID_LEN_MAX + 1] = {'\0'}; + uint64_t idSize = OH_XCOMPONENT_ID_LEN_MAX + 1; + if (OH_NativeXComponent_GetXComponentId(component, idStr, &idSize) != OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Callback", + "OnSurfaceChangedCB: Unable to get XComponent id"); + return; + } + + std::string id(idStr); + auto render = XComponentSurfaceRender::GetInstance(id); + if (render != nullptr) { + render->OnSurfaceChanged(component, window); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "Callback", "surface changed"); + } +} + +void OnSurfaceDestroyedCB(OH_NativeXComponent *component, void *window) +{ + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "Callback", "OnSurfaceDestroyedCB"); + if ((component == nullptr) || (window == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Callback", + "OnSurfaceDestroyedCB: component or window is null"); + return; + } + + char idStr[OH_XCOMPONENT_ID_LEN_MAX + 1] = {'\0'}; + uint64_t idSize = OH_XCOMPONENT_ID_LEN_MAX + 1; + if (OH_NativeXComponent_GetXComponentId(component, idStr, &idSize) != OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Callback", + "OnSurfaceDestroyedCB: Unable to get XComponent id"); + return; + } + + std::string id(idStr); + XComponentSurfaceRender::Release(id); +} +} // namespace + +std::unordered_map XComponentSurfaceRender::instance_; + +XComponentSurfaceRender::XComponentSurfaceRender(std::string &id) +{ + this->id_ = id; + this->eglCore_ = new XComponentSurfaceEGLCore(); +} + +XComponentSurfaceRender *XComponentSurfaceRender::GetInstance(std::string &id) +{ + if (instance_.find(id) == instance_.end()) { + XComponentSurfaceRender *instance = new XComponentSurfaceRender(id); + instance_[id] = instance; + return instance; + } else { + return instance_[id]; + } +} + +void XComponentSurfaceRender::Release(std::string &id) +{ + XComponentSurfaceRender *render = XComponentSurfaceRender::GetInstance(id); + if (render != nullptr) { + render->eglCore_->Release(); + delete render->eglCore_; + render->eglCore_ = nullptr; + delete render; + render = nullptr; + instance_.erase(instance_.find(id)); + } +} + +void XComponentSurfaceRender::OnSurfaceChanged(OH_NativeXComponent *component, void *window) +{ + char idStr[OH_XCOMPONENT_ID_LEN_MAX + 1] = {'\0'}; + uint64_t idSize = OH_XCOMPONENT_ID_LEN_MAX + 1; + if (OH_NativeXComponent_GetXComponentId(component, idStr, &idSize) != OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Callback", "OnSurfaceChanged: Unable to get XComponent id"); + return; + } + + std::string id(idStr); + XComponentSurfaceRender *render = XComponentSurfaceRender::GetInstance(id); + double offsetX; + double offsetY; + OH_NativeXComponent_GetXComponentOffset(component, window, &offsetX, &offsetY); + OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "OH_NativeXComponent_GetXComponentOffset", + "offsetX = %{public}lf, offsetY = %{public}lf", offsetX, offsetY); + uint64_t width; + uint64_t height; + OH_NativeXComponent_GetXComponentSize(component, window, &width, &height); + if (render != nullptr) { + render->eglCore_->UpdateSize(width, height); + } +} + +void XComponentSurfaceRender::RegisterCallback(OH_NativeXComponent *nativeXComponent) +{ + renderCallback_.OnSurfaceCreated = OnSurfaceCreatedCB; + renderCallback_.OnSurfaceChanged = OnSurfaceChangedCB; + renderCallback_.OnSurfaceDestroyed = OnSurfaceDestroyedCB; + OH_NativeXComponent_RegisterCallback(nativeXComponent, &renderCallback_); +} +} // namespace ArkUICApiDemo diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_render.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_render.h new file mode 100644 index 0000000000000000000000000000000000000000..569a2cce316c8721aa4e01901f54311e2c48abbf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_surface_render.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ +#ifndef ARKUI_CAPI_DEMO_XCOMPONENT_PLUGIN_RENDER_H +#define ARKUI_CAPI_DEMO_XCOMPONENT_PLUGIN_RENDER_H + +#include "../common/common.h" +#include +#include +#include +#include + +#include "xcomponent_surface_egl_core.h" + +namespace ArkUICApiDemo { +class XComponentSurfaceRender { +public: + explicit XComponentSurfaceRender(std::string &id); + ~XComponentSurfaceRender() + { + if (eglCore_ != nullptr) { + eglCore_->Release(); + delete eglCore_; + eglCore_ = nullptr; + } + } + static XComponentSurfaceRender *GetInstance(std::string &id); + static void Release(std::string &id); + void OnSurfaceChanged(OH_NativeXComponent *component, void *window); + void RegisterCallback(OH_NativeXComponent *nativeXComponent); + +public: + static std::unordered_map instance_; + XComponentSurfaceEGLCore *eglCore_; + std::string id_; + +private: + OH_NativeXComponent_Callback renderCallback_; + OH_NativeXComponent_MouseEvent_Callback mouseCallback_; +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_XCOMPONENT_PLUGIN_RENDER_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_type_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_type_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0c529efd2f513085e9e190d920e9cb8a096cfbdb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_type_test.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "xcomponent_type_test.h" +#include "../manager/plugin_manager.h" +#include "xcomponent/xcomponent_surface_render.h" +#include +#include + +namespace ArkUICApiDemo { + +static auto CreateDefaultChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, std::string id) +{ + auto nodeHandle = nodeAPI->createNode(ARKUI_NODE_XCOMPONENT); + + ArkUI_NumberValue size_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem size_item = {size_value, sizeof(size_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_WIDTH, &size_item); + nodeAPI->setAttribute(nodeHandle, NODE_HEIGHT, &size_item); + + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &background_color_item); + + auto innerView = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue inner_size_value[] = {{.f32 = SIZE_30}}; + ArkUI_AttributeItem inner_size_item = {inner_size_value, sizeof(inner_size_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView, NODE_WIDTH, &inner_size_item); + nodeAPI->setAttribute(innerView, NODE_HEIGHT, &inner_size_item); + ArkUI_NumberValue inner_background_color_value[] = {{.u32 = COLOR_GREEN}}; + ArkUI_AttributeItem inner_background_color_item = { + inner_background_color_value, sizeof(inner_background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(innerView, NODE_BACKGROUND_COLOR, &inner_background_color_item); + nodeAPI->addChild(nodeHandle, innerView); + + XComponentSurfaceRender *render = XComponentSurfaceRender::GetInstance(id); + if ((render != nullptr) && (nodeHandle != nullptr)) { + if (render != nullptr) { + render->RegisterCallback(OH_NativeXComponent_GetNativeXComponent(nodeHandle)); + } + } + + return nodeHandle; +} + +static auto CreateChildNode(ArkUI_NativeNodeAPI_1 *nodeAPI, int32_t type, std::string id) +{ + auto nodeHandle = CreateDefaultChildNode(nodeAPI, id); + + ArkUI_NumberValue type_value[] = {{.i32 = type}}; + ArkUI_AttributeItem type_item = {type_value, sizeof(type_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(nodeHandle, NODE_XCOMPONENT_TYPE, &type_item); + + return nodeHandle; +} + +napi_value XComponentTypeTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentTypeTest", "GetContext env or info is null"); + return nullptr; + } + + // 创建nodeAPI + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + auto surface = CreateChildNode(nodeAPI, ARKUI_XCOMPONENT_TYPE_SURFACE, "XComponentTypeSurface"); + auto texture = CreateChildNode(nodeAPI, ARKUI_XCOMPONENT_TYPE_TEXTURE, "XComponentTypeTexture"); + auto def = CreateDefaultChildNode(nodeAPI, "XComponentTypeDefault"); + + nodeAPI->addChild(column, surface); + nodeAPI->addChild(column, texture); + nodeAPI->addChild(column, def); + + // 所有组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentTypeTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_type_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_type_test.h new file mode 100644 index 0000000000000000000000000000000000000000..8eb9e08a7a78b253e964a864851f08e00726768a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_type_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_XCOMPONENT_TYPE_TEST_H +#define ARKUI_CAPI_DEMO_XCOMPONENT_TYPE_TEST_H + +#include "../common/common.h" +#include +#include +#include +#include "xcomponent_surface_egl_core.h" + +namespace ArkUICApiDemo { + +class XComponentTypeTest { +public: + ~XComponentTypeTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); +}; + +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_XCOMPONENT_TYPE_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_width_test.cpp b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_width_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..86e34f723a149bfa1a74e7649003ebed8b63489c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_width_test.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#include "xComponent_width_test.h" +#include "../manager/plugin_manager.h" +#include + +namespace ArkUICApiDemo { + +#define SIZE_NEGATIVE_100 (-100) + +napi_value XComponentWidthTest::CreateNativeNode(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentWidthTest", "CreateNativeNode"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentWidthTest", "GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // 设置XComponent组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + + // 设置XComponent组件宽度 + ArkUI_NumberValue default_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem default_width_item = {default_width_value, + sizeof(default_width_value) / sizeof(ArkUI_NumberValue)}; + + // 设置XComponent组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + + // 设置XComponent组件margin + ArkUI_NumberValue margin_value[] = {{.f32 = DEFAULT_MARGIN}}; + ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)}; + + // first xComponent + auto xComponent = nodeAPI->createNode(ARKUI_NODE_XCOMPONENT); + nodeAPI->setAttribute(xComponent, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(xComponent, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(xComponent, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(xComponent, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_WIDTH, &width_item); + + // second xComponent + auto xComponentSecond = nodeAPI->createNode(ARKUI_NODE_XCOMPONENT); + nodeAPI->setAttribute(xComponentSecond, NODE_WIDTH, &default_width_item); + nodeAPI->setAttribute(xComponentSecond, NODE_HEIGHT, &default_height_item); + nodeAPI->setAttribute(xComponentSecond, NODE_BACKGROUND_COLOR, &background_color_item); + nodeAPI->setAttribute(xComponentSecond, NODE_MARGIN, &margin_item); + + ArkUI_NumberValue width_second_value[] = {{.f32 = SIZE_NEGATIVE_100}}; + ArkUI_AttributeItem width_second_item = {width_second_value, + sizeof(width_second_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponentSecond, NODE_WIDTH, &width_second_item); + + // parent node + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + nodeAPI->addChild(column, xComponent); + nodeAPI->insertChildAfter(column, xComponentSecond, xComponent); + + // xComponent组件挂载到XComponent + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentWidthTest", + "OH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +napi_value XComponentWidthTest::CreateNativeNodeLarge(napi_env env, napi_callback_info info) +{ + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentWidthTest", "CreateNativeNodeLarge"); + + size_t argc = PARAM_1; + napi_value args[PARAM_1] = {nullptr}; + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + size_t length = PARAM_64; + size_t strLength = PARAM_0; + char xComponentID[PARAM_64] = {PARAM_0}; + napi_get_value_string_utf8(env, args[PARAM_0], xComponentID, length, &strLength); + + if ((env == nullptr) || (info == nullptr)) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentWidthTest", + "CreateNativeNodeLarge:GetContext env or info is null"); + return nullptr; + } + + ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr; + OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI); + + // parent column + auto column = nodeAPI->createNode(ARKUI_NODE_COLUMN); + ArkUI_NumberValue border_value[] = {{.f32 = PARAM_1}}; + ArkUI_AttributeItem border_item = {border_value, sizeof(border_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_BORDER_WIDTH, &border_item); + + ArkUI_NumberValue col_width_value[] = {{.f32 = SIZE_200}}; + ArkUI_AttributeItem col_width_item = {col_width_value, sizeof(col_width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_WIDTH, &col_width_item); + ArkUI_NumberValue col_height_value[] = {{.f32 = SIZE_300}}; + ArkUI_AttributeItem col_height_item = {col_height_value, sizeof(col_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(column, NODE_HEIGHT, &col_height_item); + + // 设置宽度为500 + auto xComponent = nodeAPI->createNode(ARKUI_NODE_XCOMPONENT); + ArkUI_NumberValue width_value[] = {{.f32 = SIZE_500}}; + ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_WIDTH, &width_item); + + // 设置XComponent组件背景色 + ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_RED}}; + ArkUI_AttributeItem background_color_item = {background_color_value, + sizeof(background_color_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_BACKGROUND_COLOR, &background_color_item); + + // 设置XComponent组件高度 + ArkUI_NumberValue default_height_value[] = {{.f32 = SIZE_100}}; + ArkUI_AttributeItem default_height_item = {default_height_value, + sizeof(default_height_value) / sizeof(ArkUI_NumberValue)}; + nodeAPI->setAttribute(xComponent, NODE_HEIGHT, &default_height_item); + + nodeAPI->addChild(column, xComponent); + + std::string id(xComponentID); + if (OH_NativeXComponent_AttachNativeRootNode(PluginManager::GetInstance()->GetNativeXComponent(id), column) == + INVALID_PARAM) { + OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "XComponentWidthTest", + "CreateNativeNode:LargeOH_NativeXComponent_AttachNativeRootNode failed"); + } + + napi_value exports; + if (napi_create_object(env, &exports) != napi_ok) { + napi_throw_type_error(env, NULL, "napi_create_object failed"); + return nullptr; + } + + return exports; +} + +} // namespace ArkUICApiDemo \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_width_test.h b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_width_test.h new file mode 100644 index 0000000000000000000000000000000000000000..2e942a7d0a7adbbf10ac22e01111e6d576888ac9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/cpp/xcomponent/xcomponent_width_test.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +#ifndef ARKUI_CAPI_DEMO_XCOMPONENT_WIDTH_TEST_H +#define ARKUI_CAPI_DEMO_XCOMPONENT_WIDTH_TEST_H + +#include "../common/common.h" + +#include +#include +#include + +namespace ArkUICApiDemo { + +class XComponentWidthTest { +public: + ~XComponentWidthTest(); + static napi_value CreateNativeNode(napi_env env, napi_callback_info info); + static napi_value CreateNativeNodeLarge(napi_env env, napi_callback_info info); +}; +} // namespace ArkUICApiDemo +#endif // ARKUI_CAPI_DEMO_XCOMPONENT_WIDTH_TEST_H diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/ets/entryability/EntryAbility.ts b/scenario/arkui/arkui_capi_demo/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..1d53c8339c55458c5d032fa141bf87b12a710310 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,41 @@ +import UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +}; diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/ets/pages/Index.ets b/scenario/arkui/arkui_capi_demo/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..840c8b4cf31a6b6775bf98743b8aa3cbad77a863 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,33 @@ +@Entry +@Component +struct Index { + build() { + Column() { + Column({ space: 10 }) { + Text('TextWidthTest') + .fontSize('32fp') + .fontWeight(500) + .margin({ bottom: 24 }) + + XComponent({ + id: 'xComponentId', + type: XComponentType.NODE, + libraryname: 'nativerender' + }).onDestroy(() => { + console.log('onDestroy'); + }).onAppear(() => { + + }).width('100%') + .height('100%') + }.margin({ + top: 27, + left: 12, + right: 12 + }) + .height('40%') + .width('90%') + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/module.json5 b/scenario/arkui/arkui_capi_demo/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9b07af70a189c0165e30b9f4bedc3bfd22b53cda --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/module.json5 @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/element/color.json b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/element/string.json b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/media/icon.png b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/media/icon.png differ diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/media/icon_small.png b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/media/icon_small.png new file mode 100644 index 0000000000000000000000000000000000000000..adb226051b3771a741509382c683606d029e5b25 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/media/icon_small.png differ diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/media/src.jpg b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/media/src.jpg new file mode 100644 index 0000000000000000000000000000000000000000..36a19cd6b90bb98511116f5015c74fe2f860249d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/media/src.jpg differ diff --git a/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/profile/main_pages.json b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/Application/AbilityStage.ts b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..35d7138e9c498ded1b55d2daf4f9d58630841647 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/Application/AbilityStage.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024 Huawei Device 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 AbilityStage from '@ohos.app.ability.AbilityStage'; + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log('[Demo] MyAbilityStage onCreate'); + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/MainAbility.ts b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..bb42e0040a8974b56a591f1e662fe7b7e64842d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/MainAbility.ts @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 Huawei Device 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 Ability from '@ohos.app.ability.UIAbility'; +import Settings from '../test/common/Settings'; + +const TAG: string = '[createWindow]' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + // Ability is creating, initialize resources for this ability + console.log(`${TAG} MainAbility onCreate`); + globalThis.abilityWant = want; + globalThis.abilityLaunchParam = launchParam; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log(`${TAG} MainAbility onDestroy`); + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log(`${TAG} MainAbility onWindowStageCreate windowStage=` + windowStage); + globalThis.windowStage = windowStage; + globalThis.context = this.context; + + setTimeout(() => { + console.info(`${TAG} setTimeout`) + Settings.createWindow('MainAbility/pages/DemoIndex', { + width: 720, height: 1280, dpi: 230 + }) + }, 1000) + } + + onWindowStageDestroy() { + //Main window is destroyed, release UI related resources + console.log(`${TAG} MainAbility onWindowStageDestroy`); + } + + onForeground() { + // Ability has brought to foreground + console.log(`${TAG} MainAbility onForeground`); + } + + onBackground() { + // Ability has back to background + console.log(`${TAG} MainAbility onBackground`); + } +}; \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/componet/CommonView.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/componet/CommonView.ets new file mode 100644 index 0000000000000000000000000000000000000000..39c8ee14eb5ad85d4021cbf3f0ac6c2331e12b40 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/componet/CommonView.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +@Component +export struct CommonView { + pageTag: string = ''; + + build() { + Column() { + Column({ space: 10 }) { + XComponent({ + id: this.pageTag, + type: XComponentType.NODE, + libraryname: 'nativerender' + }).onDestroy(() => { + console.log('onDestroy'); + }).backgroundColor('#FFEEEEEE') + .width('100%') + .height('100%') + }.margin(20) + .height('100%') + .width('100%') + } + .id(this.pageTag) + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/DemoIndex.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/DemoIndex.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e9adc265a2b3e7260371437cdedd90608f51df5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/DemoIndex.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../../test/List.test'; + +@Entry +@Component +struct DemoIndex { + aboutToAppear() { + setTimeout(() => { + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, 2000) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ARKUI CAPI DEMO') + .fontSize(36) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7beebb793034699d385322a545035b620e527a3a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'ButtonAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a81686282e913d9f27127750d74c3e1889ede35d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityDescriptionTest { + PAGE_TAG: string = 'ButtonAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0a5a26f33ca834e5fdc48adb22b962acf0fda0d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityGroupFalseTest { + PAGE_TAG: string = 'ButtonAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..68620c52f9a8a839b9366c874ee24d73113bf6d0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityGroupTrueTest { + PAGE_TAG: string = 'ButtonAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e99530e3513c9dfcab319142f982f9f2f3315a1e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityLevelAutoTest { + PAGE_TAG: string = 'ButtonAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4379bab341cbf68534e054339601919f663ea832 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'ButtonAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dfe4d691f565f9da4961279f9b1a74beff7ffe6a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'ButtonAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f557b3e859fe827ae941aabdc0473d187a2c7f6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'ButtonAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba8711f113c992b63ec1ed5e3cd9ad94f6977cf9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'ButtonAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..296e783f29ece03f7bd8101d74def7132d549d49 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'ButtonAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1dff929151ed8f0703476d4287ddcfa8f5d2ac7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityTextNullTest { + PAGE_TAG: string = 'ButtonAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e310b6f6a78dc8e7decfb341a5df901a720fd192 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ButtonAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonAccessibilityTextTest { + PAGE_TAG: string = 'ButtonAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d8ea39dbd4aad4595bd8db9c71943140eb7c3f0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'CheckboxAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..79124aa873732f1e715c8f079f21a426a37625d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityDescriptionTest { + PAGE_TAG: string = 'CheckboxAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..48297474ab5f10f1e574928cae16a1aaf8851585 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityGroupFalseTest { + PAGE_TAG: string = 'CheckboxAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..be5db6ca8c4d5eb1d8bb40d5c0f6291c42fbb90e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityGroupTrueTest { + PAGE_TAG: string = 'CheckboxAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f14a6f1710621d2c435ee206479cc4817f0d91f2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityLevelAutoTest { + PAGE_TAG: string = 'CheckboxAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1bbcdea1e16c8735b23462ad35cddfcc5e40e94b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'CheckboxAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4fc6336b2e1034976598bfa4eb6f414b5e40fc3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'CheckboxAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ee04a60be976c5091edc2aaa0bcd9769d1f81a1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'CheckboxAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..03d9acd28ffe45b81cd28aefa01bd81a1458ed94 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'CheckboxAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..031c089725daa282dff50e40c3c84054cd1f64d6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'CheckboxAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b6ef38d009b61a00d9551a97c4b4b21e42abc7ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityTextNullTest { + PAGE_TAG: string = 'CheckboxAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..915dd035046c2b0ee862ee571ad12b254aa87839 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/CheckboxAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxAccessibilityTextTest { + PAGE_TAG: string = 'CheckboxAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..632607d2d3fcb2e2c5a66d371844bf9956d2cbd4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'DatePickerAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..35ba3b918e53cbe7cea57f42027afaa24d6928e3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityDescriptionTest { + PAGE_TAG: string = 'DatePickerAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1378cd46e8a5dda82e7bc05df161ad2fda7dc39b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityGroupFalseTest { + PAGE_TAG: string = 'DatePickerAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..442219be9efdd2d46f5e46aac9198e4a6a82e3d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityGroupTrueTest { + PAGE_TAG: string = 'DatePickerAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3f11b9e55fd42d436f186541c359c4e96a73db2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityLevelAutoTest { + PAGE_TAG: string = 'DatePickerAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..695dfa3f701b664ee7db701355232ccd2c84bbd7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'DatePickerAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eedb6c0175232cb61cd797fcb8d365a2815e5984 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'DatePickerAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f53028d76ef322912b6447c8a9daa98fd554d5c9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'DatePickerAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..674b6917cf05fd286ce997f796fa5d30c95aac15 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'DatePickerAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..45a02f7ba9cb861f2b7801f8fca2744e3c0263d7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'DatePickerAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c5e3d492c10fb937b199b0db3ca5c8ea4d5a6cf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityTextNullTest { + PAGE_TAG: string = 'DatePickerAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..286313292b1e5440d88f62b7e9daff848ef7b358 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/DatePickerAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerAccessibilityTextTest { + PAGE_TAG: string = 'DatePickerAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a8b8a8f7eab8a0c85b1fcbc5ca66364a0b92bae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'ListAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ecd00eda1e7a8f0db5af5e04c7fb55888862235 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityDescriptionTest { + PAGE_TAG: string = 'ListAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d213ace0f4574d0156c6f0cce8f6f4d3565bf958 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityGroupFalseTest { + PAGE_TAG: string = 'ListAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6bd989eeac1048dbaf94f3b457a3812593531213 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityGroupTrueTest { + PAGE_TAG: string = 'ListAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb3a6f53e1121302c116779e5a22a82720e5316f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityLevelAutoTest { + PAGE_TAG: string = 'ListAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..019a7163fc288ef773ac9de006db0d7ef18e79bb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'ListAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8ec42869f8b08f4df239759187b5228727431ffa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'ListAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..453f0f46618325dac45f4f30fef35d3b0cb9a6c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'ListAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..05130a16847930d90fa356c55ee582e068b53e6d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'ListAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce94892caa669f8e4b302fb0e07e5d848690840d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'ListAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..56f15fdb285848b194471dbee23993fa2d30718b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityTextNullTest { + PAGE_TAG: string = 'ListAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1060096180ae5a3d4fd2bfc664b88d42e1022a42 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ListAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListAccessibilityTextTest { + PAGE_TAG: string = 'ListAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bf7d2844eb66879ca69e808b9bed940815318594 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'ProgressAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c197b86cd6d19c4c0f4bd26a033efced97a56d39 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityDescriptionTest { + PAGE_TAG: string = 'ProgressAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4644d679826183e674916a9f963c84f5769dcaeb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityGroupFalseTest { + PAGE_TAG: string = 'ProgressAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b56cf9bd7c95e21336f406f9458eda6e9a732d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityGroupTrueTest { + PAGE_TAG: string = 'ProgressAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d4e6c7ede7d35657d32f20b888360ea4f49d90a3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityLevelAutoTest { + PAGE_TAG: string = 'ProgressAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..79c77ee6df7e5ce06f08aaa4ee6c46d3a905f0b8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'ProgressAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a42816fa1e3014fd68b7e853fe1868c546d80e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'ProgressAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6ab37d4f6a647faf56a718f57f0bb511460c5220 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'ProgressAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5cb6dbd77ab04d1d689d5f0d9019600f5bacd404 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'ProgressAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9af82831a12691f5203541865f631f4431282ce9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'ProgressAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b6225350035b165238d7af950e8761ff14d0532b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityTextNullTest { + PAGE_TAG: string = 'ProgressAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7fa97542d1bbcd006a05c698c6291b3f236a614b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ProgressAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressAccessibilityTextTest { + PAGE_TAG: string = 'ProgressAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cb378203643f4eb36d28c8dacf3953aa37269e4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'RefreshAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..407cefc282071a4ddeb433e71105d3783f58bc31 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityDescriptionTest { + PAGE_TAG: string = 'RefreshAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..59d9f67b0b79484be62b0edcb5119a528e2a2b54 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityGroupFalseTest { + PAGE_TAG: string = 'RefreshAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1280d81c71c12053042989642394c223842798a4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityGroupTrueTest { + PAGE_TAG: string = 'RefreshAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c54049d0a7a7d60cee5e2f7a5b6dc54e7f7a68f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityLevelAutoTest { + PAGE_TAG: string = 'RefreshAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3f7238716696512d5494ceb5b4c210aec5aae9e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'RefreshAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..68a8dab8159c80e22a2806c559b5ee202412d7bc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'RefreshAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5768cfa867bb800df5fbdf6a6d1aee98e19cbc7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'RefreshAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7bbc96e302304533d6cf2ef945324af17b24a4f2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'RefreshAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e45561b7429c4df0874312df0e0281604d7f747 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'RefreshAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..29d00c559785c1ec5e6039760021f3e3e6f372c6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityTextNullTest { + PAGE_TAG: string = 'RefreshAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c9f5ed1e5d4d91f6d67e0837a51a895f6eff362 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/RefreshAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshAccessibilityTextTest { + PAGE_TAG: string = 'RefreshAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1d42df7820761822135b2eef0da39b7fa92417d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'ScrollAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..50c287712ef2b9583b3c300e8fc37b1a0f295202 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityDescriptionTest { + PAGE_TAG: string = 'ScrollAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3faf61fa424a9a3a9097acc27eec7b13892edaad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityGroupFalseTest { + PAGE_TAG: string = 'ScrollAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2cd268c01dabcf5495488f07de219b306230b057 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityGroupTrueTest { + PAGE_TAG: string = 'ScrollAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..041ea3b2a49484be4a90bdef4b128517458e8531 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityLevelAutoTest { + PAGE_TAG: string = 'ScrollAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..21214b0af62a26da068ca3f48e90a4f3a49ece35 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'ScrollAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f683682e8e5665d829a874bffd58d1a888363b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'ScrollAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b8996bcf7c9d2133625658cc9787f3c19abf7e1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'ScrollAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5a99373c8e65252be334f9399541a224d5086db --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'ScrollAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e0d3def89beade86a011a6908e275ecc00893d9e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'ScrollAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a2e602ab1450b946b7bfd0311648af0fd6f0762a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityTextNullTest { + PAGE_TAG: string = 'ScrollAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f662da439e2a12e9721c10c57dbfcaa9ff17f79a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ScrollAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollAccessibilityTextTest { + PAGE_TAG: string = 'ScrollAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf3c7cc3b4208ac9491645807721798402abf7b0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'SliderAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6cd81d88fe5e8e24531560681c7e27d4d66de5ce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityDescriptionTest { + PAGE_TAG: string = 'SliderAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d815974f7caeb068300357bd4ccaa0f7e50c37d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityGroupFalseTest { + PAGE_TAG: string = 'SliderAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..97210f08e26dbadc295a3c377b4dcba4ec4289f2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityGroupTrueTest { + PAGE_TAG: string = 'SliderAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..86255f1ca5eeda3208e66154aabe2a47621d037b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityLevelAutoTest { + PAGE_TAG: string = 'SliderAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fdcc936aa53488b170d63df5b85ea90109813f3d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'SliderAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bac1a3e0857046445831bf5cbcd0837dc8055940 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'SliderAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..002468007a090cf0c68bb96fc598b9780a834334 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'SliderAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1e229eb5f7f28b3bf01b2653c8e8bd3c8e9188cb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'SliderAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ef7824abe44a9f9e9548eccef7ed89d2acf4673 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'SliderAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..00929097c9b1c8667e28d5817abef91ff4a66870 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityTextNullTest { + PAGE_TAG: string = 'SliderAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..85b57a4935e7bd1d4a599d036a87619a89977f5b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SliderAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderAccessibilityTextTest { + PAGE_TAG: string = 'SliderAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed20c020244face769a5e0e29c20ee9d55fdcb49 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'SwiperAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..abd729c9ec7a794104adb79e2874667cb7adb967 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityDescriptionTest { + PAGE_TAG: string = 'SwiperAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..80cd5eb289f541bb075dc3afed1830fedeedc6ab --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityGroupFalseTest { + PAGE_TAG: string = 'SwiperAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..33ffc7951e1c3d77cb9f8d12273bb4ec9c6ba79d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityGroupTrueTest { + PAGE_TAG: string = 'SwiperAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b01365746430e5e2c65bf6c22e13d81463250d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityLevelAutoTest { + PAGE_TAG: string = 'SwiperAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..38db6ae7a1581cadcf3dd763920f9697d953bff6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'SwiperAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9eb9bc24b94cc62bb6343948448b2951cd741c34 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'SwiperAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..67c94abeecd19f83fe5ea61b90c1fc29dffddb15 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'SwiperAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6855600b07f4a6a1d66a87ef6067e923043bd84e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'SwiperAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..645f4299f1395ff750e9a5e6ffa3757a2db4859c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'SwiperAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae29842169177015f00d99ed4e6d80c3a92562f1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityTextNullTest { + PAGE_TAG: string = 'SwiperAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c7d231e79f2d9eeacdc9871bdaae4b95a606bbb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/SwiperAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAccessibilityTextTest { + PAGE_TAG: string = 'SwiperAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a6143409de92e3db2d44ddcd1f8717b11dc1922 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'TextAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..82402aef91fa676b0812f19b5d157819627ddc6f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityDescriptionTest { + PAGE_TAG: string = 'TextAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0260cf65524d72260b6d3bed61475208066884bf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityGroupFalseTest { + PAGE_TAG: string = 'TextAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b71584c0aba89d499ff73809de24e1e0d401ae1e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityGroupTrueTest { + PAGE_TAG: string = 'TextAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3df99fde06d75a7ab8f241af3d16234ac57f7847 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityLevelAutoTest { + PAGE_TAG: string = 'TextAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..18a203fe80ad61ecb684318ff8a9f17c006a148c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'TextAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..46b498ad026bc393a3f5838da82dad72fb1e4544 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'TextAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e078511446618e96a24d10b652ad3127e04079c9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'TextAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2cd19adda9351abac8c37a8946d6e15baf64a371 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'TextAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d115c740cc489009969881bb874b0fdd2f38fa36 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'TextAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..be6193a5df2a35559d0382f1da61d0e82b601b3e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityTextNullTest { + PAGE_TAG: string = 'TextAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f737cb022aef65bab4ef61d1505dc385cab44ce4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAccessibilityTextTest { + PAGE_TAG: string = 'TextAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a1076e532169382fa8e311d16c1a88dbed83d839 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'TextAreaAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cc7c5c20ab44e94f281880efc9b54a3fa64f6c11 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityDescriptionTest { + PAGE_TAG: string = 'TextAreaAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6725bedbb751498e80d61a5a08076d82e892690c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityGroupFalseTest { + PAGE_TAG: string = 'TextAreaAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f5e61e024aa4f4a64f3e78789572264095b8758d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityGroupTrueTest { + PAGE_TAG: string = 'TextAreaAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff7d5edf386cca9f4f81b223e8ae197eb30b2e39 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityLevelAutoTest { + PAGE_TAG: string = 'TextAreaAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..20db53554d0f6ab0b446e7c0bf9837e1e29e27fc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'TextAreaAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..372a8c99a0373d69fc78cefaf5c82d82523ad741 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'TextAreaAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9bf17245fb3c2278c3ad1d9bba9a61a2faed93bd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'TextAreaAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d43a9e47c5890ac8af0915d0a06437c74ac9ca2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'TextAreaAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9aaa94e947ea6a1c4e942c5893c9db400d70222c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'TextAreaAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1d96836df4660d068d1f7f64631aedd2b9bf0c9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityTextNullTest { + PAGE_TAG: string = 'TextAreaAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..961ce7969e49ba4a39e03f98f74fd6a562a3e71c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextAreaAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaAccessibilityTextTest { + PAGE_TAG: string = 'TextAreaAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e72dfed44c3efe63958e216f769b9faae27646ab --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'TextInputAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..68e829602aac90a835eb835947a3267eb5160e85 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityDescriptionTest { + PAGE_TAG: string = 'TextInputAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e19765f8fad103d1c006e6240a40a4025b26a345 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityGroupFalseTest { + PAGE_TAG: string = 'TextInputAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..32ebdddb887efaaf22391fd9e9f8bcb71d5ce4fe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityGroupTrueTest { + PAGE_TAG: string = 'TextInputAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ba8dc9d44111cd218b7d41c2bb84be402ecc403 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityLevelAutoTest { + PAGE_TAG: string = 'TextInputAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..64ec7464c6058def7c2d923939c487618d36b5f2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'TextInputAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..89b9358bc9fdd15782a485590cfd06e47d105a7a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'TextInputAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e9e8a6e3eb7802a0f74d75fd3b72f15a3dbd16d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'TextInputAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4f0fc049e583b2bc5206078bb2f474f748cd005f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'TextInputAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8183de74754221f776e7e670d633e69a8e472e13 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'TextInputAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..be9ce13347bf75c0943b2b1585516b8b070bee57 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityTextNullTest { + PAGE_TAG: string = 'TextInputAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8dd1875c0c736a8440b1a2f4982af8c963cc772c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextInputAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputAccessibilityTextTest { + PAGE_TAG: string = 'TextInputAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..60b1214d932623ece1e1c23823b8ed1ceebb0839 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'TextPickerAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ffd45ba12425710773ed6596dfa2e0e3bb6eaa1e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityDescriptionTest { + PAGE_TAG: string = 'TextPickerAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d195bd237875feda9a763a32958dedfedff2e9e4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityGroupFalseTest { + PAGE_TAG: string = 'TextPickerAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c9ff90d24d3cc4aac68eeac5330c1b8418d6d9e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityGroupTrueTest { + PAGE_TAG: string = 'TextPickerAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c15b60c8d066573d882ad873b4d0438672cd2a2c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityLevelAutoTest { + PAGE_TAG: string = 'TextPickerAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4a7e0678a5cedb8bd90346270bcc3c72a393544 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'TextPickerAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..017590a296e91706ea3b15b8d5b71d41c74c5fbf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'TextPickerAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..908a1589c468eb278a5bb5f145830681b30bded4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'TextPickerAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6af57071de1dcc40d9c043ecbb747ad476f42b43 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'TextPickerAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d5da9392eef24986ac62e20d0d02af262695a6bb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'TextPickerAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8a470e5de8d7fb08c7651102957f5acb61a2d6f5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityTextNullTest { + PAGE_TAG: string = 'TextPickerAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..63b846694189c7e74c77eecd5c7ea8d49364e235 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TextPickerAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerAccessibilityTextTest { + PAGE_TAG: string = 'TextPickerAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0bc51122807ceb4c0abad9fe69d5b087d27f8732 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'TimePickerAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b323e5fc5b81f5d92d17af79f1b4992c4dc33e9a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityDescriptionTest { + PAGE_TAG: string = 'TimePickerAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c697db76e6ba7a632ed1b65fe09e187d51687f3a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityGroupFalseTest { + PAGE_TAG: string = 'TimePickerAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2a584a3dd755cf1aaae77a0d59d8c93ebcb6f140 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityGroupTrueTest { + PAGE_TAG: string = 'TimePickerAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..85d015c88fcacf2f791dde2b0855a64ce549b362 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityLevelAutoTest { + PAGE_TAG: string = 'TimePickerAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b141a56c710801049bb9eb497665d7bb5773162d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'TimePickerAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..94da6a637e1194f2b423cb9496708993393697fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'TimePickerAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7fbb802b448a21eddddb2d734e3546ca5c64a122 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'TimePickerAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b64e439714da9a2fc64c5bec5436636a3e209dc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'TimePickerAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e125fc64771075a2fc99cf5bf7710b548db39a4b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'TimePickerAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d743ce1f03e1d74a4d4740217798561e403cb15 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityTextNullTest { + PAGE_TAG: string = 'TimePickerAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..131ee321c0c616b60be0a14f6a7f8cc7bedfb609 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/TimePickerAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerAccessibilityTextTest { + PAGE_TAG: string = 'TimePickerAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6461e131670874e40ab4b267da22960831fe29ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'ToggleAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa74a7c1bfe97d81e111abf7e69e3ab07fefa4f5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityDescriptionTest { + PAGE_TAG: string = 'ToggleAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae8f213ea6fb0711e66f76413a8e7b3514bc4a6e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityGroupFalseTest { + PAGE_TAG: string = 'ToggleAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cba87d768a5a38be760f0a45d2d3e9e472805249 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityGroupTrueTest { + PAGE_TAG: string = 'ToggleAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3217afa309c72e6c910263f085ceb44c02e77440 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityLevelAutoTest { + PAGE_TAG: string = 'ToggleAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..abe52bc1c00bff36a43573cdf2d159bedecdeb0c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'ToggleAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..79e9e84f6e0909217549e9bea88d61b4638ab012 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'ToggleAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3911564c0f286e810c5d1fc48d224ecd23fc7e4a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'ToggleAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1054eaf8dcab4f49b1a9ba3c6cf0bb28756df373 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityLevelLowerAbnormalTest { + PAGE_TAG: string = 'ToggleAccessibilityLevelLowerAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityLevelLowerAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a372fae7d4eac925675494c75d77eabcb9b71f0a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityLevelUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityLevelUpperAbnormalTest { + PAGE_TAG: string = 'ToggleAccessibilityLevelUpperAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityLevelUpperAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..99e2c5132e331051c1a3e6b02385aa90a39065e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityTextNullTest { + PAGE_TAG: string = 'ToggleAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8d11fadc41cbc4f628913b4ace08f9a259b5f9e5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/accessibility/ToggleAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleAccessibilityTextTest { + PAGE_TAG: string = 'ToggleAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..58903220ac040bde70a8723388e37f4d93d5cc76 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonBackgroundColorTest { + PAGE_TAG: string = 'ButtonBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonFontColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonFontColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e4a4e1e968fb8f0966afdd500abcebbcfe8907e7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonFontColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonFontColorTest { + PAGE_TAG: string = 'ButtonFontColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonFontColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonFontSizeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonFontSizeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae49372d565062091449774e48b4e66524d52702 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonFontSizeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonFontSizeTest { + PAGE_TAG: string = 'ButtonFontSizeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonFontSizeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonFontWeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonFontWeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..537bf6533c96ecdca2b43cf08a7376063a8a2871 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonFontWeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonFontWeightTest { + PAGE_TAG: string = 'ButtonFontWeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonFontWeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonOnClickTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonOnClickTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6598fdf9343894eb4d23eee22a75bba9dd1ec39b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/button/ButtonOnClickTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ButtonOnClickTest { + PAGE_TAG: string = 'ButtonOnClickTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.buttonOnClickTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignCenterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignCenterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b7fa3de01115b45fbdc0e39523596201591423bb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignCenterTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CalendarPickerEdgeAlignCenterTest { + PAGE_TAG: string = 'CalendarPickerEdgeAlignCenterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.calendarPickerEdgeAlignCenterTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignDefaultTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignDefaultTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d26798f39dbe1935d2e1743ab9b1a8b5ef2a2b8e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignDefaultTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CalendarPickerEdgeAlignDefaultTest { + PAGE_TAG: string = 'CalendarPickerEdgeAlignDefaultTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.calendarPickerEdgeAlignDefaultTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..25464ae6e42c59e5555c19e095c6a666c9cb6caf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignEndTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CalendarPickerEdgeAlignEndTest { + PAGE_TAG: string = 'CalendarPickerEdgeAlignEndTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.calendarPickerEdgeAlignEndTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd031f9106378b58350a6d64243f4f499538aa09 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignStartTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CalendarPickerEdgeAlignStartTest { + PAGE_TAG: string = 'CalendarPickerEdgeAlignStartTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.calendarPickerEdgeAlignStartTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..263483524a3c667c8b2eb30a6c97c45be67345bb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CalendarPickerEnabledTest { + PAGE_TAG: string = 'CalendarPickerEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.calendarPickerEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerOnChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerOnChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb84c0e29123a00ab935c55dded8dace87833d23 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerOnChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CalendarPickerOnChangeTest { + PAGE_TAG: string = 'CalendarPickerOnChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.calendarPickerOnChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerTextStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerTextStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0816a4ce2a2f819339a9d41fe1c01dde1c3db3d6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerTextStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CalendarPickerTextStyleTest { + PAGE_TAG: string = 'CalendarPickerTextStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.calendarPickerTextStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..24c8dd15c7c0e5617a87fc1a796c2a4327a6e8a7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CalendarPickerWidthLargeTest { + PAGE_TAG: string = 'CalendarPickerWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.calendarPickerWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6709b06faa5c77491c7d81ac159ae9848a623a52 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/calendarpicker/CalendarPickerWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CalendarPickerWidthTest { + PAGE_TAG: string = 'CalendarPickerWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.calendarPickerWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ccca83a5a49d8ca530db679407da0be3194bc7de --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxEnabledTest { + PAGE_TAG: string = 'CheckboxEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfc8c9fb82755dbc56838e194b71fb2df0ee44d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxHeightLargeTest { + PAGE_TAG: string = 'CheckboxHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..536d40f752a2268d09b070371b87bd1187ed9ac9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxHeightTest { + PAGE_TAG: string = 'CheckboxHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxMarkTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxMarkTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..762dbb55b91d4ed76ab11c9565a52f5c7e43741e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxMarkTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxMarkTest { + PAGE_TAG: string = 'CheckboxMarkTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxMarkTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxOnChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxOnChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b12c2c0dad33c6a1f09f3c04205866dc1adf97e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxOnChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxOnChangeTest { + PAGE_TAG: string = 'CheckboxOnChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxOnChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxSelectTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxSelectTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..26242f35bdc164fdd20d9d4069b47353c5ba3b48 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxSelectTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxSelectTest { + PAGE_TAG: string = 'CheckboxSelectTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxSelectTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxSelectedColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxSelectedColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..db5eb96bfcda284cf4e7819ed100429319df25c7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxSelectedColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxSelectedColorTest { + PAGE_TAG: string = 'CheckboxSelectedColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxSelectedColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxShapeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxShapeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..521a56cb9553c02552dd004fce63197b12a5990a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxShapeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxShapeTest { + PAGE_TAG: string = 'CheckboxShapeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxShapeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxUnselectedColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxUnselectedColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e947745a2b6cc5f7c5d593c98ca7a3e452738fca --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxUnselectedColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxUnselectedColorTest { + PAGE_TAG: string = 'CheckboxUnselectedColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxUnselectedColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..314942581492c651a58e4c9b03b5f8a0016eea1b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxWidthLargeTest { + PAGE_TAG: string = 'CheckboxWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f78f0ef3c840765805f5b0fbfbb054a875e2ff41 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/checkbox/CheckboxWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CheckboxWidthTest { + PAGE_TAG: string = 'CheckboxWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.checkboxWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnForegroundBlurStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnForegroundBlurStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4025bfd7803474788e54a9b676af63c9da880b68 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnForegroundBlurStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ColumnForegroundBlurStyleTest { + PAGE_TAG: string = 'ColumnForegroundBlurStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.columnForegroundBlurStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e4473e7f29f665e0228a31b7c85c7579265743a4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ColumnHeightLargeTest { + PAGE_TAG: string = 'ColumnHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.columnHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d955c3b39b5ef11ddda6a7f37ca0c860863e5883 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ColumnHeightTest { + PAGE_TAG: string = 'ColumnHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.columnHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnPaddingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnPaddingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bfd9db60794b5477b234a00c4b20be4483851401 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnPaddingTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ColumnPaddingTest { + PAGE_TAG: string = 'ColumnPaddingTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.columnPaddingTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bea7ac24b54fd5f453e473dc1b988e1140db2bbc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ColumnWidthLargeTest { + PAGE_TAG: string = 'ColumnWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.columnWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..42a8fa5eda1c4d61558a461d65de4716857e99c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/column/ColumnWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ColumnWidthTest { + PAGE_TAG: string = 'ColumnWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.columnWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignContentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignContentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab9b5fac95be488743993ff9a1f3a196a4b09120 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignContentTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct CommonAttrsAlignContentTest { + PAGE_TAG: string = 'CommonAttrsAlignContentTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 7777, (data: number) => { + render.commonAttrsAlignContentChangeTypeTest(data); + }) + } + + aboutToDisappear() { + events_emitter.off(7777) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsAlignContentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignItemsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignItemsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6996dfdc4ffef46565df56534f3e08de5f85fad7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignItemsTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct CommonAttrsAlignItemsTest { + PAGE_TAG: string = 'CommonAttrsAlignItemsTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 9999, (data: number) => { + render.commonAttrsAlignItemsChangeTypeTest(data); + }) + } + + aboutToDisappear() { + events_emitter.off(9999) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsAlignItemsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignSelfTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignSelfTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..966062ffd91744fd150a6188e50f31c826e243d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignSelfTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct CommonAttrsAlignSelfTest { + PAGE_TAG: string = 'CommonAttrsAlignSelfTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.commonAttrsAlignSelfChangeTypeTest(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsAlignSelfTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..da0c1e2678db1f0160badf5e1335bc295837381f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsAlignTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsAlignTest { + PAGE_TAG: string = 'CommonAttrsAlignTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsAlignTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..08c2e6b913e41f9dda40811e982f1ef1b5e96cde --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsBackgroundColorTest { + PAGE_TAG: string = 'CommonAttrsBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBlendModeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBlendModeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..08c4774d84ac8b17e88e3c6c4b508a9be91dad00 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBlendModeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsBlendModeTest { + PAGE_TAG: string = 'CommonAttrsBlendModeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsBlendModeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..988de0be58fd20a54873b0450c2f901697a176ad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsBorderColorTest { + PAGE_TAG: string = 'CommonAttrsBorderColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsBorderColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderRadiusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderRadiusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c6b48092c2cc1fa09fb8a6509bbdd032984660e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderRadiusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsBorderRadiusTest { + PAGE_TAG: string = 'CommonAttrsBorderRadiusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsBorderRadiusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6598583f1bdde060a39bf72cfb4f434660d5b1fc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsBorderStyleTest { + PAGE_TAG: string = 'CommonAttrsBorderStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsBorderStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cabe44c031043b252fdf355f54f04a80477e600f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsBorderWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsBorderWidthTest { + PAGE_TAG: string = 'CommonAttrsBorderWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsBorderWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipCircleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipCircleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d10942d74e32f145c338e741c865818fc3e375d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipCircleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsClipCircleTest { + PAGE_TAG: string = 'CommonAttrsClipCircleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsClipCircleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipEllipseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipEllipseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ba8930f83ddab51da4c26806449b5767d8162bd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipEllipseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsClipEllipseTest { + PAGE_TAG: string = 'CommonAttrsClipEllipseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsClipEllipseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipPathTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipPathTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..39c4db2eb6233faff0370b5ca777a6e80fde980f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipPathTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsClipPathTest { + PAGE_TAG: string = 'CommonAttrsClipPathTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsClipPathTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipRectangleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipRectangleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d9882f90009d1caef9c26f73241d1f52b3f3b389 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsClipRectangleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsClipRectangleTest { + PAGE_TAG: string = 'CommonAttrsClipRectangleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsClipRectangleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMaxMinSetTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMaxMinSetTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f64610acdfcd53091fb2fc68addd0443f4cfc06f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMaxMinSetTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsConstraintSizeMaxMinSetTest { + PAGE_TAG: string = 'CommonAttrsConstraintSizeMaxMinSetTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsConstraintSizeMaxMinSetTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMaxSetMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMaxSetMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e79541d45383768e8be489a9a91045595b8377c5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMaxSetMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsConstraintSizeMaxSetMinTest { + PAGE_TAG: string = 'CommonAttrsConstraintSizeMaxSetMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsConstraintSizeMaxSetMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMinMaxSetTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMinMaxSetTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..79665478a5c65fc3ef7404d07588afc29fbc51b4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMinMaxSetTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsConstraintSizeMinMaxSetTest { + PAGE_TAG: string = 'CommonAttrsConstraintSizeMinMaxSetTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsConstraintSizeMinMaxSetTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMinSetMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMinSetMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c41d7e990b0f0832605736f47c817d45df59d5ae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMinSetMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsConstraintSizeMinSetMaxTest { + PAGE_TAG: string = 'CommonAttrsConstraintSizeMinSetMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsConstraintSizeMinSetMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeSetMaxMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeSetMaxMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3acb9c003a095e98227109f826f50bfcf2ef1f97 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeSetMaxMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsConstraintSizeSetMaxMinTest { + PAGE_TAG: string = 'CommonAttrsConstraintSizeSetMaxMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsConstraintSizeSetMaxMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeSetMinMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeSetMinMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..76216af04f16c244636711caa02d156646951679 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsConstraintSizeSetMinMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsConstraintSizeSetMinMaxTest { + PAGE_TAG: string = 'CommonAttrsConstraintSizeSetMinMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsConstraintSizeSetMinMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsContrastTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsContrastTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..22f294f5d34ef4d43a06b93227cded390e4ea2ad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsContrastTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsInvertTest { + PAGE_TAG: string = 'CommonAttrsContrastTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsContrastTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsDirectionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsDirectionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6e43b9faed24910df9ffddafe2098fb8cbe773a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsDirectionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsDirectionTest { + PAGE_TAG: string = 'CommonAttrsDirectionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsDirectionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3f29044e536c6f503cc003a6f8a06d7344ac1d8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsEnabledTest { + PAGE_TAG: string = 'CommonAttrsEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..300e539e75785433d93459a21deab4d136bdc25b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexBasisColumnTest { + PAGE_TAG: string = 'CommonAttrsFlexBasisColumnTest'; + PARENT_CONTAINER: number = 2; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexBasisColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexColumnReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexColumnReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e2eead0ab9d9789d1c902dbacca62a0f22ae7f2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexColumnReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexBasisFlexColumnReverseTest { + PAGE_TAG: string = 'CommonAttrsFlexBasisFlexColumnReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 4; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexBasisFlexColumnReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e369e5511c9fc5600b7c55309def2e984bfa7e0a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexBasisFlexColumnTest { + PAGE_TAG: string = 'CommonAttrsFlexBasisFlexColumnTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 2; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexBasisFlexColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexRowReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexRowReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..653f2526d503e4931627711b3862e4f3bf5bd6a1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexRowReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexBasisFlexRowReverseTest { + PAGE_TAG: string = 'CommonAttrsFlexBasisFlexRowReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 3; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexBasisFlexRowReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfb4a24c6e7696471d247d60564ac19cc4fcdf15 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexBasisFlexRowTest { + PAGE_TAG: string = 'CommonAttrsFlexBasisFlexRowTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexBasisFlexRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae95b74c8d17be747ed33aed8117c410354180f8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexBasisRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexBasisRowTest { + PAGE_TAG: string = 'CommonAttrsFlexBasisRowTest'; + PARENT_CONTAINER: number = 1; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexBasisRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c2b36fbab74dee17f3448681978852d9b4c1cfa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexGrowColumnTest { + PAGE_TAG: string = 'CommonAttrsFlexGrowColumnTest'; + PARENT_CONTAINER: number = 2; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexGrowColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexColumnReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexColumnReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5627e4fa26a9a44d38f26d75b025428e7ad96f22 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexColumnReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexGrowFlexColumnReverseTest { + PAGE_TAG: string = 'CommonAttrsFlexGrowFlexColumnReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 4; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexGrowFlexColumnReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2067bc9dd2fbaa8bb07519a7efb74f7aad1abe6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexGrowFlexColumnTest { + PAGE_TAG: string = 'CommonAttrsFlexGrowFlexColumnTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 2; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexGrowFlexColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexRowReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexRowReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6986aed8eee631b36630ad6375e037e871648d13 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexRowReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexGrowFlexRowReverseTest { + PAGE_TAG: string = 'CommonAttrsFlexGrowFlexRowReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 3; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexGrowFlexRowReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..29e3085c341a0e4b2ff2c67f643e55c35073faa5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexGrowFlexRowTest { + PAGE_TAG: string = 'CommonAttrsFlexGrowFlexRowTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexGrowFlexRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cd5a1d53bbc4184ccf606c46caede138da09bbea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexGrowRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexGrowRowTest { + PAGE_TAG: string = 'CommonAttrsFlexGrowRowTest'; + PARENT_CONTAINER: number = 1; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexGrowRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bf4dda241d301f629b9a8c352850b220fc18289c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexShrinkColumnTest { + PAGE_TAG: string = 'CommonAttrsFlexShrinkColumnTest'; + PARENT_CONTAINER: number = 2; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexShrinkColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexColumnReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexColumnReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0a102d25329dd046712c7b60b19aba452e2ef08 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexColumnReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexShrinkFlexColumnReverseTest { + PAGE_TAG: string = 'CommonAttrsFlexShrinkFlexColumnReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 4; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexShrinkFlexColumnReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cea6d8427f5b4890cb567b4215d71e874048f83d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexShrinkFlexColumnTest { + PAGE_TAG: string = 'CommonAttrsFlexShrinkFlexColumnTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 2; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexShrinkFlexColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexRowReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexRowReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..04e473c106d2d03013d02d42b6c25dffc234953a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexRowReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexShrinkFlexRowReverseTest { + PAGE_TAG: string = 'CommonAttrsFlexShrinkFlexRowReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 3; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexShrinkFlexRowReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..787206fd1b580e6f97ac10f4c8a518e873966cb8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexShrinkFlexRowTest { + PAGE_TAG: string = 'CommonAttrsFlexShrinkFlexRowTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexShrinkFlexRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ac9604cc7e42065c6d8c9f0ccc19341432eeef4a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFlexShrinkRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFlexShrinkRowTest { + PAGE_TAG: string = 'CommonAttrsFlexShrinkRowTest'; + PARENT_CONTAINER: number = 1; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFlexShrinkRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFocusableCombineTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFocusableCombineTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..76289f3389f25da8e356eaff56c5a4a18950632d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFocusableCombineTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFocusableCombineTest { + PAGE_TAG: string = 'CommonAttrsFocusableCombineTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFocusableCombineTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFocusableTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFocusableTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..821072f22f4f77cafb31b30d9efcd02849365fad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsFocusableTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsFocusableTest { + PAGE_TAG: string = 'CommonAttrsFocusableTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsFocusableTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsForegroundBlurStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsForegroundBlurStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a9fcc4ef03216679092f300e2bd15bccaa6d269 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsForegroundBlurStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsForegroundBlurStyleTest { + PAGE_TAG: string = 'CommonAttrsForegroundBlurStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsForegroundBlurStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsGrayscaleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsGrayscaleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4bd266a02b84a20635647d5c50fde26bf3b754f5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsGrayscaleTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsGrayscaleTest { + PAGE_TAG: string = 'CommonAttrsGrayscaleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsGrayscaleTest(this.PAGE_TAG); + }) + } + } +} + diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee40359d3a3e9ff6497e63250dedaabf3834bdfb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsHeightTest { + PAGE_TAG: string = 'CommonAttrsHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsHitTestBehaviorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsHitTestBehaviorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..291b7299d3de1971aff653b730cc262297a9b93c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsHitTestBehaviorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsHitTestBehaviorTest { + PAGE_TAG: string = 'CommonAttrsHitTestBehaviorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsHitTestBehaviorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsIdTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsIdTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3758547f9e01cb37bec52d382afae39d4a706db --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsIdTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsIdTest { + PAGE_TAG: string = 'CommonAttrsIdTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsIdTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsInvertTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsInvertTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1b2ae21c25c75833da8cb03c21b01710c0921ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsInvertTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsInvertTest { + PAGE_TAG: string = 'CommonAttrsInvertTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsInvertTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsJustifyContentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsJustifyContentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..47d8d2a936b75076012235f630c952d657e55cf8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsJustifyContentTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct CommonAttrsJustifyContentTest { + PAGE_TAG: string = 'CommonAttrsJustifyContentTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 8888, (data: number) => { + render.commonAttrsJustifyContentChangeTypeTest(data); + }) + } + + aboutToDisappear() { + events_emitter.off(8888) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsJustifyContentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..79b3d906a42c8a51af3b5a8bff5409e4d7d1af9f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientBottomTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientCustomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientCustomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..91e111a48cce1f1d23a73e29e1d04c977142f950 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientCustomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientCustomTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientCustomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientCustomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientIllegalColorAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientIllegalColorAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a63a0b2ea644445b57d03a9df4e41c04deeca019 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientIllegalColorAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientIllegalColorAbnormalTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientIllegalColorAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientIllegalColorAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5bcb74dba8c3866492a3dc5c2a4f200f89b83b66 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientLeftBottomTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientLeftBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientLeftBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3316f16db70a1114f1ca0546fe407358cf4b5f10 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientLeftTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientLeftTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientLeftTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d815bd36a948ed08365ee0d5245a9851c62794c5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientLeftTopTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientLeftTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientLeftTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a37648d1116cf9a34f92529fdde23e23885aa5ac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientLowerBoundAbnormalTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bfc2fb02aa863a4b8ef8f350762a31c32a3199ae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientNoneTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d13afc77bb220107865790d5df58fc47eec614d3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientRightBottomTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientRightBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientRightBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c735a3e78d8e26d289b3517b3bc0746a4e606eaf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientRightTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientRightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientRightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8ec0f76cd99fd4f20e7c6cbf08fd7f38bb39ea6e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientRightTopTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientRightTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientRightTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfe504d978a732b7d9848f64d7faeadeedf3d6ac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsLinearGradientTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsLinearGradientTopTest { + PAGE_TAG: string = 'CommonAttrsLinearGradientTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsLinearGradientTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginRespectivelyNegativeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginRespectivelyNegativeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..de7e528c6eb8274d9749342b9341b7ff7f43f53a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginRespectivelyNegativeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsMarginRespectivelyNegativeTest { + PAGE_TAG: string = 'CommonAttrsMarginRespectivelyNegativeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsMarginRespectivelyNegativeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginRespectivelyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginRespectivelyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae1c3a885cca54fafff99efdabb137fa745c0a33 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginRespectivelyTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsMarginRespectivelyTest { + PAGE_TAG: string = 'CommonAttrsMarginRespectivelyTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsMarginRespectivelyTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginUnifiedNegativeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginUnifiedNegativeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b25d57e415cae1045da0ba2882f95d8b540acc47 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginUnifiedNegativeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsMarginUnifiedNegativeTest { + PAGE_TAG: string = 'CommonAttrsMarginUnifiedNegativeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsMarginUnifiedNegativeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginUnifiedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginUnifiedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b7f4ea6f638651c0e28065615ca1d6bb3bd8d00 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMarginUnifiedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsMarginUnifiedTest { + PAGE_TAG: string = 'CommonAttrsMarginUnifiedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsMarginUnifiedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMaskAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMaskAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2339ebcee0346ff8dd3d51415fbd86b46d61b029 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMaskAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsMaskAbnormalTest { + PAGE_TAG: string = 'CommonAttrsMaskAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsMaskAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMaskTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMaskTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce6464975da999fc7450daa77e56ed6c3fb83190 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsMaskTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsMaskTest { + PAGE_TAG: string = 'CommonAttrsMaskTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsMaskTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsOpacityTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsOpacityTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..22a993c7e6149b253ecf08eebd6561b91fc5fcfa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsOpacityTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsOpacityTest { + PAGE_TAG: string = 'CommonAttrsOpacityTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsOpacityTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsPositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsPositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..74abf5919e0cad53a8c1ea05b4de3757ef49b194 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsPositionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsPositionTest { + PAGE_TAG: string = 'CommonAttrsPositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsPositionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsRadialGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsRadialGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6367ac721696036b1443414b6b3ad98eba05e792 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsRadialGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsRadialGradientTest { + PAGE_TAG: string = 'CommonAttrsRadialGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsRadialGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c97d037f9b0022747d56228f91ef7774e310833a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsScaleAbnormalTest { + PAGE_TAG: string = 'CommonAttrsScaleAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsScaleAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleEnlargeXTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleEnlargeXTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d55feba03c80563fa3e2e9aa7c2c4ff48555af03 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleEnlargeXTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsScaleEnlargeXTest { + PAGE_TAG: string = 'CommonAttrsScaleEnlargeXTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsScaleEnlargeXTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleEnlargeXYTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleEnlargeXYTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..72c39a383ca5832cb385f906da04481d7ed6c14f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleEnlargeXYTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsScaleEnlargeXYTest { + PAGE_TAG: string = 'CommonAttrsScaleEnlargeXYTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsScaleEnlargeXYTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleReduceXTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleReduceXTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..81753e5f56ccec118abfbc4a77c57aeee2ff776d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleReduceXTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsScaleReduceXTest { + PAGE_TAG: string = 'CommonAttrsScaleReduceXTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsScaleReduceXTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleReduceXYTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleReduceXYTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1fdf0b2f9449367a385b8b942ac03652c6d3dce6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsScaleReduceXYTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsScaleReduceXYTest { + PAGE_TAG: string = 'CommonAttrsScaleReduceXYTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsScaleReduceXYTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsSepiaTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsSepiaTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b24f7c6fbad2068c90d62413292893d56d542ee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsSepiaTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsInvertTest { + PAGE_TAG: string = 'CommonAttrsSepiaTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsSepiaTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowFloatingShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowFloatingShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..49ffe983b441724b482ae06bade9bf3566d53c92 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowFloatingShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsShadowFloatingShadowTest { + PAGE_TAG: string = 'CommonAttrsShadowFloatingShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsShadowFloatingShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowFloatingSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowFloatingSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2a8aa8659e4cbed8b1fc37ada5e408f8ced68801 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowFloatingSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsShadowFloatingSmallShadowTest { + PAGE_TAG: string = 'CommonAttrsShadowFloatingSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsShadowFloatingSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowLargeShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowLargeShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9fba957eb6e7e887bf5d4c79923c4db6f46202e5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowLargeShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsShadowLargeShadowTest { + PAGE_TAG: string = 'CommonAttrsShadowLargeShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsShadowLargeShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0124fc7d8968331171b5688c0d3def75a34dee5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsShadowLowerBoundAbnormalTest { + PAGE_TAG: string = 'CommonAttrsShadowLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsShadowLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowMiddleShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowMiddleShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e794afdc2ed795eab4099b24bcb6741e4ad82fb5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowMiddleShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsShadowMiddleShadowTest { + PAGE_TAG: string = 'CommonAttrsShadowMiddleShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsShadowMiddleShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d818387745ca41ac7dba47f0d2977496755c4eeb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsShadowSmallShadowTest { + PAGE_TAG: string = 'CommonAttrsShadowSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsShadowSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowUltraSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowUltraSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4da2aa43d6270860754e7e3cf37eb2763514a618 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowUltraSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsShadowUltraSmallShadowTest { + PAGE_TAG: string = 'CommonAttrsShadowUltraSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsShadowUltraSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eceb916f7c343b2443026d7f2731698aa9f75e4a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsShadowUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsShadowUpperBoundAbnormalTest { + PAGE_TAG: string = 'CommonAttrsShadowUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsShadowUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsSweepGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsSweepGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..045aab88dbc6fb8575b317bf03b35b56b04ed9d4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsSweepGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsSweepGradientTest { + PAGE_TAG: string = 'CommonAttrsSweepGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsSweepGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsTransformAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsTransformAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee18d6d34fcb93842cd65aef3597762d0024702b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsTransformAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsTransformAbnormalTest { + PAGE_TAG: string = 'CommonAttrsTransformAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsTransformAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsTransformTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsTransformTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..06e0f0a694944db69d89a079d604105c0dcb8503 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsTransformTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsTransformTest { + PAGE_TAG: string = 'CommonAttrsTransformTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsTransformTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..533741a1d84e4ae8876b534303d46b1ea254021e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonattrs/CommonAttrsWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonAttrsWidthTest { + PAGE_TAG: string = 'CommonAttrsWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonAttrsWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnAppearTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnAppearTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6272bf2ef169e83e812208ee419f1add7edb180f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnAppearTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonEventOnAppearTest { + PAGE_TAG: string = 'CommonEventOnAppearTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonEventOnAppearTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnAreaChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnAreaChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f71b05966d990c0ba154b1c1c8ec04a8b6df842 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnAreaChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonEventOnAreaChangeTest { + PAGE_TAG: string = 'CommonEventOnAreaChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonEventOnAreaChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnBlurTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnBlurTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d7bd6dfabd936a1b7ba17fcb191735ba20cb16f0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnBlurTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonEventOnBlurTest { + PAGE_TAG: string = 'CommonEventOnBlurTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonEventOnBlurTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnClickTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnClickTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..06d25346ad36e5cb92e82fb563bb95d1cfc45d0f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnClickTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonEventOnClickTest { + PAGE_TAG: string = 'CommonEventOnClickTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonEventOnClickTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnFocusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnFocusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dde0a4b5cfa1b9e244cdbe1afa1273edb6194b4d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnFocusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonEventOnFocusTest { + PAGE_TAG: string = 'CommonEventOnFocusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonEventOnFocusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnTouchTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnTouchTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a77eba8077980d053f72a90d045c0d1ca8977609 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/commonevent/CommonEventOnTouchTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CommonEventOnTouchTest { + PAGE_TAG: string = 'CommonEventOnTouchTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.commonEventOnTouchTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityDescriptionNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityDescriptionNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..59b5649dbd6d2154b62284ba8446c64b6eb3dd1a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityDescriptionNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAccessibilityDescriptionNullTest { + PAGE_TAG: string = 'CustomComponentAccessibilityDescriptionNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAccessibilityDescriptionNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityDescriptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityDescriptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eee0b6d352849842747994e32e4d395439549dad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityDescriptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAccessibilityDescriptionTest { + PAGE_TAG: string = 'CustomComponentAccessibilityDescriptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAccessibilityDescriptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityGroupFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityGroupFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d363b479dcb56663a2d23b14b142c662ef8d316 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityGroupFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAccessibilityGroupFalseTest { + PAGE_TAG: string = 'CustomComponentAccessibilityGroupFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAccessibilityGroupFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityGroupTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityGroupTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e65d115113152217d6d5bb68349ad8272359003c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityGroupTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAccessibilityGroupTrueTest { + PAGE_TAG: string = 'CustomComponentAccessibilityGroupTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAccessibilityGroupTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ce64985bc94fc74fba5848d3e2fc3b4fc74934d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAccessibilityLevelAutoTest { + PAGE_TAG: string = 'CustomComponentAccessibilityLevelAutoTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAccessibilityLevelAutoTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelDescendantsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelDescendantsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f039002e3438eb508ca6a97de13a2763e46acedc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelDescendantsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAccessibilityLevelDescendantsTest { + PAGE_TAG: string = 'CustomComponentAccessibilityLevelDescendantsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAccessibilityLevelDescendantsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelDisabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelDisabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0dc8be30bd134b273f5cecb14932506539cc7cd3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelDisabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAccessibilityLevelDisabledTest { + PAGE_TAG: string = 'CustomComponentAccessibilityLevelDisabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAccessibilityLevelDisabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..66212a3eb28a6d022d5fe9116f45cf9751d40e89 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAccessibilityLevelEnabledTest { + PAGE_TAG: string = 'CustomComponentAccessibilityLevelEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAccessibilityLevelEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityTextNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityTextNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..12c34f306f76ea9099f14cc683912dd087ea9394 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityTextNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAccessibilityTextNullTest { + PAGE_TAG: string = 'CustomComponentAccessibilityTextNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAccessibilityTextNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityTextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityTextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad751a8c8403e0bd432b4b1d849d38b187c7c2c1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAccessibilityTextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAccessibilityTextTest { + PAGE_TAG: string = 'CustomComponentAccessibilityTextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAccessibilityTextTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAlignSelfTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAlignSelfTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..63ff550ed1828ce1f581ad869d8896ff00566228 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAlignSelfTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct CustomComponentAlignSelfTest { + PAGE_TAG: string = 'CustomComponentAlignSelfTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.customComponentAlignSelfChangeTypeTest(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAlignSelfTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAlignTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAlignTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb31f01d40beecffe177c8c1f7f261356c34add8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentAlignTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentAlignTest { + PAGE_TAG: string = 'CustomComponentAlignTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentAlignTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..55492c54d8187e244f5765c36bafacc50a09d325 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentBackgroundColorTest { + PAGE_TAG: string = 'CustomComponentBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBlendModeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBlendModeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c234633d1fad038de0a6528d300240f5e1910127 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBlendModeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentBlendModeTest { + PAGE_TAG: string = 'CustomComponentBlendModeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentBlendModeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8119421d228b29745d34fa2d71a2a34cf7a84711 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentBorderColorTest { + PAGE_TAG: string = 'CustomComponentBorderColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentBorderColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderRadiusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderRadiusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f567a9e945e4b958aaa1568f010f07a7902db4c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderRadiusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentBorderRadiusTest { + PAGE_TAG: string = 'CustomComponentBorderRadiusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentBorderRadiusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..aaf6fe59f824a3ba4f19e71032bada3cd1f876b8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentBorderStyleTest { + PAGE_TAG: string = 'CustomComponentBorderStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentBorderStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fc985d161fa047e9df75fb4c1b2125585afa57a5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentBorderWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentBorderWidthTest { + PAGE_TAG: string = 'CustomComponentBorderWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentBorderWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipCircleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipCircleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..380a155f69757d6f5cf966de51faf75d45945e5e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipCircleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentClipCircleTest { + PAGE_TAG: string = 'CustomComponentClipCircleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentClipCircleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipEllipseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipEllipseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a2d811fe1b83489b3f7586eb24be266c463a126 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipEllipseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentClipEllipseTest { + PAGE_TAG: string = 'CustomComponentClipEllipseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentClipEllipseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipPathTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipPathTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dc0c940b85c76a78c83194b047926e1c9f2cd5ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipPathTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentClipPathTest { + PAGE_TAG: string = 'CustomComponentClipPathTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentClipPathTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipRectangleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipRectangleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..33efed553bdb9c5a64c2b7211e4604bc3f513da3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentClipRectangleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentClipRectangleTest { + PAGE_TAG: string = 'CustomComponentClipRectangleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentClipRectangleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentComponentWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentComponentWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..20378224962fbfeb1a18afb307e66979eda965c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentComponentWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentWidthTest { + PAGE_TAG: string = 'CustomComponentWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMaxMinSetTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMaxMinSetTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f34c97815c66d0055721def1610b5526e8d458c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMaxMinSetTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentConstraintSizeMaxMinSetTest { + PAGE_TAG: string = 'CustomComponentConstraintSizeMaxMinSetTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentConstraintSizeMaxMinSetTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMaxSetMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMaxSetMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2de87345590e67b7fcefa48e5825603e7294faba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMaxSetMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentConstraintSizeMaxSetMinTest { + PAGE_TAG: string = 'CustomComponentConstraintSizeMaxSetMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentConstraintSizeMaxSetMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMinMaxSetTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMinMaxSetTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d61a1ab0a3f7547395849c3c7ade5bc32a4e744 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMinMaxSetTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentConstraintSizeMinMaxSetTest { + PAGE_TAG: string = 'CustomComponentConstraintSizeMinMaxSetTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentConstraintSizeMinMaxSetTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMinSetMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMinSetMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b43ae40361776f9c7cacb4006316f9e090ce28ec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeMinSetMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentConstraintSizeMinSetMaxTest { + PAGE_TAG: string = 'CustomComponentConstraintSizeMinSetMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentConstraintSizeMinSetMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeSetMaxMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeSetMaxMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..66f6e39fccba76dd66c76af0f907a3e4b5c767cc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeSetMaxMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentConstraintSizeSetMaxMinTest { + PAGE_TAG: string = 'CustomComponentConstraintSizeSetMaxMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentConstraintSizeSetMaxMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeSetMinMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeSetMinMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d07b06b63736bce917631dce943c134ad0c20b6c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentConstraintSizeSetMinMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentConstraintSizeSetMinMaxTest { + PAGE_TAG: string = 'CustomComponentConstraintSizeSetMinMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentConstraintSizeSetMinMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentContrastTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentContrastTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4ca7e185e2fa7a9bfa8d4dca4dba042cd059287 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentContrastTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentInvertTest { + PAGE_TAG: string = 'CustomComponentContrastTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentContrastTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentDirectionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentDirectionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..263fed87c422870044bbba305d1de0e4a7a0dc73 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentDirectionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentDirectionTest { + PAGE_TAG: string = 'CustomComponentDirectionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentDirectionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dce53a7adbc4cd9443d5aa9c3842b6ce8a2b5862 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentEnabledTest { + PAGE_TAG: string = 'CustomComponentEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d6352418f57ab59ca5682c4fff105de9a7eda1b5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexBasisColumnTest { + PAGE_TAG: string = 'CustomComponentFlexBasisColumnTest'; + PARENT_CONTAINER: number = 2; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexBasisColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexColumnReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexColumnReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bbd8e6efcfb32ef9dbdb30019602e4635ec0e346 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexColumnReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexBasisFlexColumnReverseTest { + PAGE_TAG: string = 'CustomComponentFlexBasisFlexColumnReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 4; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexBasisFlexColumnReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..56e2b0ae7e39dbc57706e4bdb93ad7e309848cd9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexBasisFlexColumnTest { + PAGE_TAG: string = 'CustomComponentFlexBasisFlexColumnTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 2; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexBasisFlexColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexRowReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexRowReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d26eadaef526149733009fee9d0334f7905ee578 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexRowReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexBasisFlexRowReverseTest { + PAGE_TAG: string = 'CustomComponentFlexBasisFlexRowReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 3; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexBasisFlexRowReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c37f52378a835fd12c0f8c76453cd0a5c9bfb0a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexBasisFlexRowTest { + PAGE_TAG: string = 'CustomComponentFlexBasisFlexRowTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexBasisFlexRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..16e4aaf2d1ef47bb214bb9980034c6f48980fc5f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexBasisRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexBasisRowTest { + PAGE_TAG: string = 'CustomComponentFlexBasisRowTest'; + PARENT_CONTAINER: number = 1; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexBasisRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6ed98bdeab5c1769c11a300b56c249511f2a49ce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexGrowColumnTest { + PAGE_TAG: string = 'CustomComponentFlexGrowColumnTest'; + PARENT_CONTAINER: number = 2; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexGrowColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexColumnReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexColumnReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..50ad4363afcb3a8e7f9b8db46f66b5fcaff83a81 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexColumnReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexGrowFlexColumnReverseTest { + PAGE_TAG: string = 'CustomComponentFlexGrowFlexColumnReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 4; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexGrowFlexColumnReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..734d9bc22e8ef0a1c2d48d6307db18508335b2b5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexGrowFlexColumnTest { + PAGE_TAG: string = 'CustomComponentFlexGrowFlexColumnTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 2; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexGrowFlexColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexRowReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexRowReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..167c2762d37dc639021127ae001a76add69aece8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexRowReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexGrowFlexRowReverseTest { + PAGE_TAG: string = 'CustomComponentFlexGrowFlexRowReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 3; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexGrowFlexRowReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d0cb037773140c7a66d1f885bc8630d97e9fce3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexGrowFlexRowTest { + PAGE_TAG: string = 'CustomComponentFlexGrowFlexRowTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexGrowFlexRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..954d639a9484d91e07fdc08563174f4cd6d695d8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexGrowRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexGrowRowTest { + PAGE_TAG: string = 'CustomComponentFlexGrowRowTest'; + PARENT_CONTAINER: number = 1; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexGrowRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1faa91c32e54b0e2f76df0c05c861161ae05fc34 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexShrinkColumnTest { + PAGE_TAG: string = 'CustomComponentFlexShrinkColumnTest'; + PARENT_CONTAINER: number = 2; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexShrinkColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexColumnReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexColumnReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2dfaf651df1e7c34fb7596595218041d98465fc4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexColumnReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexShrinkFlexColumnReverseTest { + PAGE_TAG: string = 'CustomComponentFlexShrinkFlexColumnReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 4; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexShrinkFlexColumnReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexColumnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexColumnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1e9b0315aff5945f1ca3cd8b5462b7341cecd227 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexColumnTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexShrinkFlexColumnTest { + PAGE_TAG: string = 'CustomComponentFlexShrinkFlexColumnTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 2; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexShrinkFlexColumnTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexRowReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexRowReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bfbcfa6ad5c149def847d0e562487541f85701e4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexRowReverseTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexShrinkFlexRowReverseTest { + PAGE_TAG: string = 'CustomComponentFlexShrinkFlexRowReverseTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 3; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexShrinkFlexRowReverseTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d6d23bceb0a5d96c245b46d47c6c8dadadc9d3e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexShrinkFlexRowTest { + PAGE_TAG: string = 'CustomComponentFlexShrinkFlexRowTest'; + PARENT_CONTAINER: number = 3; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexShrinkFlexRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkRowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkRowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..375250396b5851f1e9b4b86073af1651eccfac54 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFlexShrinkRowTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFlexShrinkRowTest { + PAGE_TAG: string = 'CustomComponentFlexShrinkRowTest'; + PARENT_CONTAINER: number = 1; + DIRECTION: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFlexShrinkRowTest(this.PAGE_TAG, this.PARENT_CONTAINER, this.DIRECTION); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFocusableTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFocusableTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..abf04b469c13d23441bcf97cee4c1dea07769603 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentFocusableTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentFocusableTest { + PAGE_TAG: string = 'CustomComponentFocusableTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentFocusableTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentForegroundBlurStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentForegroundBlurStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d01937faf8df0210b69d9a872feb61d49f5ce83 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentForegroundBlurStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentForegroundBlurStyleTest { + PAGE_TAG: string = 'CustomComponentForegroundBlurStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentForegroundBlurStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentGrayscaleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentGrayscaleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e98c68206e8bcc326e4499a3af134f0c0d5db571 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentGrayscaleTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentGrayscaleTest { + PAGE_TAG: string = 'CustomComponentGrayscaleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentGrayscaleTest(this.PAGE_TAG); + }) + } + } +} + diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5405f651275c4d13b5de1da9946f287d5f57f40e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentHeightTest { + PAGE_TAG: string = 'CustomComponentHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentHitTestBehaviorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentHitTestBehaviorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dbd95de0503829a6fbcfc53c6c5e9c5fa7c12790 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentHitTestBehaviorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentHitTestBehaviorTest { + PAGE_TAG: string = 'CustomComponentHitTestBehaviorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentHitTestBehaviorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentIdTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentIdTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..65de922b27563e2826acf4388adfa8939476039a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentIdTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentIdTest { + PAGE_TAG: string = 'CustomComponentIdTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentIdTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentInvertTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentInvertTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..35450d0dfadf315fb7fdee8d23cf94ef2bc35f9b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentInvertTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentInvertTest { + PAGE_TAG: string = 'CustomComponentInvertTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentInvertTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6ea3e3fa92418d212bb32143d3e71c380ab78ab6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientBottomTest { + PAGE_TAG: string = 'CustomComponentLinearGradientBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientCustomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientCustomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1bb1daec060be4a6d6d5a0f285ec1bb44bd180c2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientCustomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientCustomTest { + PAGE_TAG: string = 'CustomComponentLinearGradientCustomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientCustomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientIllegalColorAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientIllegalColorAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..82c076a869885829964d42b68da42de7ede0142b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientIllegalColorAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientIllegalColorAbnormalTest { + PAGE_TAG: string = 'CustomComponentLinearGradientIllegalColorAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientIllegalColorAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c3c58185cf1af9123148416b72c55627bac6c28 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientLeftBottomTest { + PAGE_TAG: string = 'CustomComponentLinearGradientLeftBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientLeftBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..717df3d421344ba08b8a84cedb6c3a073e2dd892 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientLeftTest { + PAGE_TAG: string = 'CustomComponentLinearGradientLeftTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientLeftTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ca5df52a5b2c58f27e82e4e1acc92e065a199b4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientLeftTopTest { + PAGE_TAG: string = 'CustomComponentLinearGradientLeftTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientLeftTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a989432b8f6606b5a4c1b0544cf4047223812aa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientLowerBoundAbnormalTest { + PAGE_TAG: string = 'CustomComponentLinearGradientLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecb143047a91f24610ea71eb83dd5ad116ab2066 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientNoneTest { + PAGE_TAG: string = 'CustomComponentLinearGradientNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientRightBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientRightBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4e305f932f1cc6cfea453b2eb43c43c6b6e50434 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientRightBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientRightBottomTest { + PAGE_TAG: string = 'CustomComponentLinearGradientRightBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientRightBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientRightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientRightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b3e2518d850ba29b07facba9c2e4acdbf7f0ff6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientRightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientRightTest { + PAGE_TAG: string = 'CustomComponentLinearGradientRightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientRightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientRightTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientRightTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..518f92a7e45a35795986dea45c7a02ed5d78c0e4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientRightTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientRightTopTest { + PAGE_TAG: string = 'CustomComponentLinearGradientRightTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientRightTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2b3348dc465c1e50a381ec72c159088cbf0f50a1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentLinearGradientTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentLinearGradientTopTest { + PAGE_TAG: string = 'CustomComponentLinearGradientTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentLinearGradientTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginRespectivelyNegativeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginRespectivelyNegativeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..145e5f52f0a57770652058f18e3d3f5bd8509998 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginRespectivelyNegativeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentMarginRespectivelyNegativeTest { + PAGE_TAG: string = 'CustomComponentMarginRespectivelyNegativeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentMarginRespectivelyNegativeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginRespectivelyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginRespectivelyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..73a962d4451581d0c15caa91216d1e18f050417f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginRespectivelyTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentMarginRespectivelyTest { + PAGE_TAG: string = 'CustomComponentMarginRespectivelyTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentMarginRespectivelyTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginUnifiedNegativeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginUnifiedNegativeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..32901ff98a6bf2941ed4cdf722b8d14a25ab16c3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginUnifiedNegativeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentMarginUnifiedNegativeTest { + PAGE_TAG: string = 'CustomComponentMarginUnifiedNegativeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentMarginUnifiedNegativeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginUnifiedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginUnifiedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4315fc41393d4466b407f40935df2b7c92438f6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMarginUnifiedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentMarginUnifiedTest { + PAGE_TAG: string = 'CustomComponentMarginUnifiedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentMarginUnifiedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMaskAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMaskAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e15a816a59404c3a70a5199df4b8e083ffd28a3b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMaskAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentMaskAbnormalTest { + PAGE_TAG: string = 'CustomComponentMaskAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentMaskAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMaskTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMaskTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dfe34f47be31d310ef0f17c885c47daecff0a66f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentMaskTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentMaskTest { + PAGE_TAG: string = 'CustomComponentMaskTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentMaskTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnAppearTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnAppearTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..548fb02bb2438f09a1c2f4cf30460bac09010c2f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnAppearTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentOnAppearTest { + PAGE_TAG: string = 'CustomComponentOnAppearTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentOnAppearTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnAreaChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnAreaChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7e2811bbc108cb1c2b7d9633991894d349a46ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnAreaChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentOnAreaChangeTest { + PAGE_TAG: string = 'CustomComponentOnAreaChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentOnAreaChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnBlurTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnBlurTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..277f708669ee4c440eb1b5a466052fbb5852afe3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnBlurTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentOnBlurTest { + PAGE_TAG: string = 'CustomComponentOnBlurTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentOnBlurTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnClickTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnClickTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5a26b5f9f96ebbe232c5f582fe4153ada4c1384 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnClickTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentOnClickTest { + PAGE_TAG: string = 'CustomComponentOnClickTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentOnClickTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnDrawTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnDrawTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9701c7b88c7ce1669affca855c1b8e71b3322415 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnDrawTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentOnDrawTest { + PAGE_TAG: string = 'CustomComponentOnDrawTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentOnDrawTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnFocusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnFocusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a1f57d3074600f9f2a96edc9871b4e987410011 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnFocusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentOnFocusTest { + PAGE_TAG: string = 'CustomComponentOnFocusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentOnFocusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnLayoutTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnLayoutTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e90bb82cd249c8a2de30e86ca484fe19cccc1889 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnLayoutTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentOnLayoutTest { + PAGE_TAG: string = 'CustomComponentOnLayoutTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentOnLayoutTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnMeasureTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnMeasureTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cde22426afa47833fb72ac5f118eb35637d3e37d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnMeasureTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentOnMeasureTest { + PAGE_TAG: string = 'CustomComponentOnMeasureTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentOnMeasureTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnTouchTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnTouchTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6fa495ebb6ff796e5a6763097078dec77a9a2b48 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOnTouchTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentOnTouchTest { + PAGE_TAG: string = 'CustomComponentOnTouchTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentOnTouchTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOpacityTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOpacityTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d7180ae28540d6061e8ab343c7abd732217a7bf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentOpacityTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentOpacityTest { + PAGE_TAG: string = 'CustomComponentOpacityTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentOpacityTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentPositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentPositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..473df369b930ec3def2edc57defe3ddfe24cfd3e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentPositionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentPositionTest { + PAGE_TAG: string = 'CustomComponentPositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentPositionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentRadialGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentRadialGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b0c2a8f0d383789b2a1d52d3710048942b651918 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentRadialGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentRadialGradientTest { + PAGE_TAG: string = 'CustomComponentRadialGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentRadialGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e7172f40c6cdab65ce2c6f50998890f2ada1e882 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentScaleAbnormalTest { + PAGE_TAG: string = 'CustomComponentScaleAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentScaleAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleEnlargeXTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleEnlargeXTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd53549caae7421c900286a536adcb9041940476 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleEnlargeXTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentScaleEnlargeXTest { + PAGE_TAG: string = 'CustomComponentScaleEnlargeXTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentScaleEnlargeXTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleEnlargeXYTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleEnlargeXYTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..867c81a1fa2de1a4910e498f95a9307f062a2715 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleEnlargeXYTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentScaleEnlargeXYTest { + PAGE_TAG: string = 'CustomComponentScaleEnlargeXYTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentScaleEnlargeXYTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleReduceXTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleReduceXTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bdd4b046ef6d670a80f2c0ac0b3809f95b3ba516 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleReduceXTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentScaleReduceXTest { + PAGE_TAG: string = 'CustomComponentScaleReduceXTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentScaleReduceXTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleReduceXYTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleReduceXYTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..188d4da538944060d388f651ea1eca527e096736 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentScaleReduceXYTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentScaleReduceXYTest { + PAGE_TAG: string = 'CustomComponentScaleReduceXYTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentScaleReduceXYTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentSepiaTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentSepiaTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d5cd12c5443da3c0c21336bb13c41cd619df295 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentSepiaTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentInvertTest { + PAGE_TAG: string = 'CustomComponentSepiaTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentSepiaTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowFloatingShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowFloatingShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..23d1e879f8695a396655cf2272b46d39b3303dbc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowFloatingShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentShadowFloatingShadowTest { + PAGE_TAG: string = 'CustomComponentShadowFloatingShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentShadowFloatingShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowFloatingSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowFloatingSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0f1916e322d7c8d2f76b8a311997f12460f3cc7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowFloatingSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentShadowFloatingSmallShadowTest { + PAGE_TAG: string = 'CustomComponentShadowFloatingSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentShadowFloatingSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowLargeShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowLargeShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d394ce5618260d3143f37e02c885da7136b10aec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowLargeShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentShadowLargeShadowTest { + PAGE_TAG: string = 'CustomComponentShadowLargeShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentShadowLargeShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..256211390ed6d83ad1a2fdfa756aa7bb19c55fab --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentShadowLowerBoundAbnormalTest { + PAGE_TAG: string = 'CustomComponentShadowLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentShadowLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowMiddleShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowMiddleShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c1af9ab03ab612c658e8a995d539573ab77d1c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowMiddleShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentShadowMiddleShadowTest { + PAGE_TAG: string = 'CustomComponentShadowMiddleShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentShadowMiddleShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cf5cf628ae4b47b7c7607269357e649576ff9ec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentShadowSmallShadowTest { + PAGE_TAG: string = 'CustomComponentShadowSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentShadowSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowUltraSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowUltraSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..48230ce88a90f87dfa68022768c583161a562174 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowUltraSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentShadowUltraSmallShadowTest { + PAGE_TAG: string = 'CustomComponentShadowUltraSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentShadowUltraSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..866d6c159d21edb0706837d7c80654283c64b690 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentShadowUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentShadowUpperBoundAbnormalTest { + PAGE_TAG: string = 'CustomComponentShadowUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentShadowUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentSweepGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentSweepGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a8190c1adee793a646e29c4b1b0938d9575db653 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentSweepGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentSweepGradientTest { + PAGE_TAG: string = 'CustomComponentSweepGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentSweepGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentTransformAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentTransformAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c90d5e5aa24723587219d3d28da20b79f513a29 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentTransformAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentTransformAbnormalTest { + PAGE_TAG: string = 'CustomComponentTransformAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentTransformAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentTransformTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentTransformTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b9c4461c16336bffdbc5e4f069be4ec16153b30 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentTransformTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentTransformTest { + PAGE_TAG: string = 'CustomComponentTransformTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentTransformTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..20378224962fbfeb1a18afb307e66979eda965c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customcomponent/CustomComponentWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomComponentWidthTest { + PAGE_TAG: string = 'CustomComponentWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customComponentWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1cbd6dd548100db35bfb2d15a223a08bce3da777 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogAlignmentAbnormalTest { + PAGE_TAG: string = 'CustomDialogAlignmentAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogAlignmentAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentBottomEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentBottomEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..39839e1751524e14f056a33e0dc0d622dff9ca6c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentBottomEndTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogAlignmentBottomEndTest { + PAGE_TAG: string = 'CustomDialogAlignmentBottomEndTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogAlignmentBottomEndTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentBottomStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentBottomStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e7c6e89401087da728a666119a4d93240374950 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentBottomStartTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogAlignmentBottomStartTest { + PAGE_TAG: string = 'CustomDialogAlignmentBottomStartTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogAlignmentBottomStartTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..810443e7989a18065468233eba329d037815651c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogAlignmentBottomTest { + PAGE_TAG: string = 'CustomDialogAlignmentBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogAlignmentBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentCenterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentCenterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..36593d1a8232f8727db9d98c29558d5c7ec446cb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentCenterTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogAlignmentCenterTest { + PAGE_TAG: string = 'CustomDialogAlignmentCenterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogAlignmentCenterTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..47076c8da825a87bfa80bd99615ecb469ef89a5c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentEndTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogAlignmentEndTest { + PAGE_TAG: string = 'CustomDialogAlignmentEndTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogAlignmentEndTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9654b31341740f44bd2528677c8825855aca124b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentStartTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogAlignmentStartTest { + PAGE_TAG: string = 'CustomDialogAlignmentStartTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogAlignmentStartTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentTopEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentTopEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7f3677be425b4e945bd58430d3fea9fff40e20dd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentTopEndTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogAlignmentTopEndTest { + PAGE_TAG: string = 'CustomDialogAlignmentTopEndTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogAlignmentTopEndTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentTopStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentTopStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e676c93804444e296763a49c409ed28c0b7ecbc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentTopStartTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogAlignmentTopStartTest { + PAGE_TAG: string = 'CustomDialogAlignmentTopStartTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogAlignmentTopStartTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d31863542cedd5babf748357c7bbddc557076c5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogAlignmentTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogAlignmentTopTest { + PAGE_TAG: string = 'CustomDialogAlignmentTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogAlignmentTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogCloseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogCloseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..20fbb7d8f9629bb3476b9b903b8c4ccb1f82d125 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogCloseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogCloseTest { + PAGE_TAG: string = 'CustomDialogCloseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogCloseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogCustomStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogCustomStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8b6685e0991be8508f1d1f26b557024c3ba9793 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogCustomStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogCustomStyleTest { + PAGE_TAG: string = 'CustomDialogCustomStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogCustomStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogMaskColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogMaskColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea0c874d4d97db13eed07f6cfc658a361ecb5410 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogMaskColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogMaskColorTest { + PAGE_TAG: string = 'CustomDialogMaskColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogMaskColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogOpenTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogOpenTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..81c8330d8a50e8b4303a072d9314524c6c331c57 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/customdialog/CustomDialogOpenTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct CustomDialogOpenTest { + PAGE_TAG: string = 'CustomDialogOpenTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.customDialogOpenTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerDisappearTextStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerDisappearTextStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b403fc279e08a2f49b12c8ee89b66582ff2beb0b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerDisappearTextStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerDisappearTextStyleTest { + PAGE_TAG: string = 'DatePickerDisappearTextStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerDisappearTextStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..75ef482f0a084d3d24a54ef0a4f8c8c55d4ea691 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerEnabledTest { + PAGE_TAG: string = 'DatePickerEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerEndAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerEndAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..edd332c3c35401cefc69659ded55a9d3ab0cc0a8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerEndAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerEndAbnormalTest { + PAGE_TAG: string = 'DatePickerEndAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerEndAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddbe57b96fc3264246ae1f1d4ea04674c4cfa0c6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerEndTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerEndTest { + PAGE_TAG: string = 'DatePickerEndTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerEndTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerLunarTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerLunarTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3901ba9948e0846cac37fa14262fdc6ee9a86c2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerLunarTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerLunarTest { + PAGE_TAG: string = 'DatePickerLunarTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerLunarTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerOnDateChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerOnDateChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..107e68d44ccab13a90a3cbb309b57523f167f466 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerOnDateChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerOnDateChangeTest { + PAGE_TAG: string = 'DatePickerOnDateChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerOnDateChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerSelectedAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerSelectedAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a33f899711de944eddc589ba85d6df5f24319fd5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerSelectedAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerSelectedAbnormalTest { + PAGE_TAG: string = 'DatePickerSelectedAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerSelectedAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerSelectedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerSelectedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..723b86cab5cff42b0dcf17c2cd0c59fea667a9fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerSelectedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerSelectedTest { + PAGE_TAG: string = 'DatePickerSelectedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerSelectedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerSelectedTextStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerSelectedTextStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..195f719a3814a4716ac9ace91f1cda08e99de5ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerSelectedTextStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerSelectedTextStyleTest { + PAGE_TAG: string = 'DatePickerSelectedTextStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerSelectedTextStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerStartAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerStartAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4384999029c482f3b872d210bfc6479d139b516 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerStartAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerStartAbnormalTest { + PAGE_TAG: string = 'DatePickerStartAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerStartAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f9932dfc1645f95c8bfe474f1b13aa1feb2b765f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerStartTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerStartTest { + PAGE_TAG: string = 'DatePickerStartTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerStartTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerTextStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerTextStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6633dad604538849671adf5c99878f8a112b7b8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerTextStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerTextStyleTest { + PAGE_TAG: string = 'DatePickerTextStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerTextStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..946182667a707d2c7605698d881676696c6876c7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerWidthLargeTest { + PAGE_TAG: string = 'DatePickerWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..85493e9f929e11255f6a1fe8f8d7f20e700010fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/datepicker/DatePickerWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct DatePickerWidthTest { + PAGE_TAG: string = 'DatePickerWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.datePickerWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cc95624ace3652406287c0ff17ea424da0613b3e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct FlexHeightLargeTest { + PAGE_TAG: string = 'FlexHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.flexHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0196ee380c4f7af873f17f7d9f1c206207db7cae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct FlexHeightTest { + PAGE_TAG: string = 'FlexHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.flexHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..13e9c521f7203f6ca9c9cc3e17b8a46d5b265a56 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct FlexWidthLargeTest { + PAGE_TAG: string = 'FlexWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.flexWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..02b084bb2a7961c0fa0b1cca3af575ca69fdcc84 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/flex/FlexWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct FlexWidthTest { + PAGE_TAG: string = 'FlexWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.flexWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageAltTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageAltTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5ca4511be59efaffc48693670aff858799baa06 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageAltTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageAltTest { + PAGE_TAG: string = 'ImageAltTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageAltTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageAutoResizeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageAutoResizeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..899921f7a8c0ed4ae7ab37c126009a0b96cee7ee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageAutoResizeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageAutoResizeTest { + PAGE_TAG: string = 'ImageAutoResizeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageAutoResizeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..174aa03aca4272ae7c96ce13e9cc741d6b847b5c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageBackgroundColorTest { + PAGE_TAG: string = 'ImageBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBlurTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBlurTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d4d7b8a836d938733829ec60afc9643bc9cbc011 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBlurTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageBlurTest { + PAGE_TAG: string = 'ImageBlurTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageBlurTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..59fa012cbb19927d2d22ce63b7fa4f6e859b0f93 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageBorderColorTest { + PAGE_TAG: string = 'ImageBorderColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageBorderColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderRadiusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderRadiusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6dc97075da0645a2a0d89a512803bae8d567f365 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderRadiusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageBorderRadiusTest { + PAGE_TAG: string = 'ImageBorderRadiusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageBorderRadiusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f07cfa6211da0451b75e502f83c83c587e2a569 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageBorderStyleTest { + PAGE_TAG: string = 'ImageBorderStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageBorderStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..461883485dc84c180c22a81d53e6ab5cbb922121 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBorderWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageBorderWidthTest { + PAGE_TAG: string = 'ImageBorderWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageBorderWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBrightnessTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBrightnessTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a1c75007580bd9eac0f57fe0d2937a62aa41acfe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageBrightnessTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageBrightnessTest { + PAGE_TAG: string = 'ImageBrightnessTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageBrightnessTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageClipTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageClipTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e2a5b9cf9933df34d31c7dc15e773c8fe8c4dfb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageClipTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageClipTest { + PAGE_TAG: string = 'ImageClipTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageClipTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageColorFilterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageColorFilterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..695219a0bdaf30f19e1d8aafe7df97a9f1887ced --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageColorFilterTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageColorFilterTest { + PAGE_TAG: string = 'ImageColorFilterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageColorFilterTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa7e85beafca99cf0e02ce62db49efd3897cf02b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageHeightLargeTest { + PAGE_TAG: string = 'ImageHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bbdf13ee55cf260c2b26cc15101f8409a5f4b22c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageHeightTest { + PAGE_TAG: string = 'ImageHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageHitTestBehaviorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageHitTestBehaviorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..668dd2c14d5895dba528b4ea841212edd4a2b0da --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageHitTestBehaviorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageHitTestBehaviorTest { + PAGE_TAG: string = 'ImageHitTestBehaviorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageHitTestBehaviorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageIdTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageIdTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b6510af4afc226285ad2be3b8b609761dc446ff5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageIdTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageIdTest { + PAGE_TAG: string = 'ImageIdTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageIdTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageInterpolationTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageInterpolationTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..433a765c5664ebf21c68f6f19d2125f538b3eda8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageInterpolationTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageInterpolationTest { + PAGE_TAG: string = 'ImageInterpolationTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageInterpolationTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageLinearGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageLinearGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..74ceccb2117bb922080f564aba3cded39573d639 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageLinearGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageLinearGradientTest { + PAGE_TAG: string = 'ImageLinearGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageLinearGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageObjectFitTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageObjectFitTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8d893b64fbe7b0c6aadb2d082cb684cf0bc60d4d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageObjectFitTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageObjectFitTest { + PAGE_TAG: string = 'ImageObjectFitTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageObjectFitTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageObjectRepeatTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageObjectRepeatTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..391398f4e9287988eeccf9e11051132dbcfb0714 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageObjectRepeatTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageObjectRepeatTest { + PAGE_TAG: string = 'ImageObjectRepeatTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageObjectRepeatTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageOnCompleteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageOnCompleteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..685546d0eee2e7f4d6d786f4bd9b900d7ed359ce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageOnCompleteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageOnCompleteTest { + PAGE_TAG: string = 'ImageOnCompleteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageOnCompleteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageOnErrorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageOnErrorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eda4c2b95f3c5bf411901667fba068fd0dcec151 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageOnErrorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageOnErrorTest { + PAGE_TAG: string = 'ImageOnErrorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageOnErrorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageOpacityTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageOpacityTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5bc08bd32fb4d101d337f3cb79cb36b316239a1a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageOpacityTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageOpacityTest { + PAGE_TAG: string = 'ImageOpacityTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageOpacityTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImagePositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImagePositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f24f764288645672c1fe4deb65ac2a3fa3bdf5fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImagePositionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImagePositionTest { + PAGE_TAG: string = 'ImagePositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imagePositionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageRadialGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageRadialGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..23a9fe79763ff23242e133153ea01365754be38b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageRadialGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageRadialGradientTest { + PAGE_TAG: string = 'ImageRadialGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageRadialGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageRotateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageRotateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e3f6ab4cec121857f8e1442d713b40f0ca569322 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageRotateTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageRotateTest { + PAGE_TAG: string = 'ImageRotateTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageRotateTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageSaturateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageSaturateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b85654850e8d0d641954bd410f2f283d4bd12e6b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageSaturateTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageSaturateTest { + PAGE_TAG: string = 'ImageSaturateTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageSaturateTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageScaleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageScaleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d89b046b59fa539d227f30499c72fcf4de708abf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageScaleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageScaleTest { + PAGE_TAG: string = 'ImageScaleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageScaleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e3c521582d4338ce7000c0bb257300a05e22239 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageShadowTest { + PAGE_TAG: string = 'ImageShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageSrcTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageSrcTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a08d51241cb7c9019270f1fab692f1b6be076908 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageSrcTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageSrcTest { + PAGE_TAG: string = 'ImageSrcTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageSrcTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageSweepGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageSweepGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c329c7b0a5336997c292994e43211c7226c2c0b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageSweepGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageSweepGradientTest { + PAGE_TAG: string = 'ImageSweepGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageSweepGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageTransformTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageTransformTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c47df28723e079bb527c063f71f001adb99f0763 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageTransformTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageTransformTest { + PAGE_TAG: string = 'ImageTransformTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageTransformTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageTranslateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageTranslateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..aaa191e76b7ea61dce265118e0f5c1e929ced3af --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageTranslateTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageTranslateTest { + PAGE_TAG: string = 'ImageTranslateTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageTranslateTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5604bbefc8dffbc9037bb77fabe9857a40a821fc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageWidthLargeTest { + PAGE_TAG: string = 'ImageWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b089043002e25553cdd292ab254c79f4cb72d4e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/image/ImageWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageWidthTest { + PAGE_TAG: string = 'ImageWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2e4abbd0edfe30c5e3b8fd9f5cb60a665646cec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageSpanHeightLargeTest { + PAGE_TAG: string = 'ImageSpanHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageSpanHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..52986072594ed157f6e3decec0334de743275e6b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageSpanHeightTest { + PAGE_TAG: string = 'ImageSpanHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageSpanHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanObjectFitTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanObjectFitTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0176f61e834120cf3c8306f846e8484614cbffe3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanObjectFitTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageSpanObjectFitTest { + PAGE_TAG: string = 'ImageSpanObjectFitTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageSpanObjectFitTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanPaddingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanPaddingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..50c89c37a975651f104ce2d4a44790271d008072 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanPaddingTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageSpanPaddingTest { + PAGE_TAG: string = 'ImageSpanPaddingTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageSpanPaddingTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanVerticalAlignTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanVerticalAlignTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cd9ce44121b4ad3fe57a3e1f2e9221118ddd75a7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanVerticalAlignTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageSpanVerticalAlignTest { + PAGE_TAG: string = 'ImageSpanVerticalAlignTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageSpanVerticalAlignTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..96390984afd53ac2c28f5ce5e99e184b0265c2c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageSpanWidthLargeTest { + PAGE_TAG: string = 'ImageSpanWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageSpanWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0924eee7a67ffae58c8b4a8a08814fd4020eeb1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/imagespan/ImageSpanWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ImageSpanWidthTest { + PAGE_TAG: string = 'ImageSpanWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.imageSpanWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBackgroundColorNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBackgroundColorNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e05a29bce458edacc19c16ebf8148a409020e22 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBackgroundColorNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBackgroundColorNullTest { + PAGE_TAG: string = 'ListBackgroundColorNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBackgroundColorNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba8ad7e740b7d9e37de74b9acabef2329e4ad6e9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBackgroundColorTest { + PAGE_TAG: string = 'ListBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBackgroundColorUndefinedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBackgroundColorUndefinedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0017e6d4a05d7e53aae42b3c70cd437a4890eeb8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBackgroundColorUndefinedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBackgroundColorUndefinedTest { + PAGE_TAG: string = 'ListBackgroundColorUndefinedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBackgroundColorUndefinedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBlurAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBlurAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0013df1df83a32396c77810c463e9f308715e740 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBlurAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBlurAbnormalTest { + PAGE_TAG: string = 'ListBlurAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBlurAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBlurDefaultValueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBlurDefaultValueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a70e934f671bcf836289921e93483537ec4815f6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBlurDefaultValueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBlurDefaultValueTest { + PAGE_TAG: string = 'ListBlurDefaultValueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBlurDefaultValueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBlurTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBlurTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..31466807f39ec5399059e68871a59bd8d9f70f0e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBlurTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBlurTest { + PAGE_TAG: string = 'ListBlurTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBlurTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..14f2abbb2f73ef5e492379909d1201447e3d64ff --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderColorNullTest { + PAGE_TAG: string = 'ListBorderColorNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderColorNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorRespectivelySettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorRespectivelySettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e5eecbeff0acc5113b0d1709a1ee45863101bef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorRespectivelySettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderColorRespectivelySettingsTest { + PAGE_TAG: string = 'ListBorderColorRespectivelySettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderColorRespectivelySettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorUndefinedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorUndefinedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c9c87428802ea07f4222ec3e8ca05789b1066ea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorUndefinedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderColorUndefinedTest { + PAGE_TAG: string = 'ListBorderColorUndefinedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderColorUndefinedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorUnifiedSettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorUnifiedSettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6572401778e2e61dfcaf25987dcf4c45cc6162f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderColorUnifiedSettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderColorUnifiedSettingsTest { + PAGE_TAG: string = 'ListBorderColorUnifiedSettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderColorUnifiedSettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusRespectivelySettingsLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusRespectivelySettingsLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c739afefc452071c52f65232f86e7c260012f5bd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusRespectivelySettingsLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderRadiusRespectivelySettingsLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListBorderRadiusRespectivelySettingsLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderRadiusRespectivelySettingsLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusRespectivelySettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusRespectivelySettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..854b212f4278373ced4fc1899fa40c88a12256d6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusRespectivelySettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderRadiusRespectivelySettingsTest { + PAGE_TAG: string = 'ListBorderRadiusRespectivelySettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderRadiusRespectivelySettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusUnifiedSettingsLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusUnifiedSettingsLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e51412eebcb239620ea1549a497d012d208c93ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusUnifiedSettingsLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderRadiusUnifiedSettingsLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListBorderRadiusUnifiedSettingsLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderRadiusUnifiedSettingsLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusUnifiedSettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusUnifiedSettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..06a076a069cc2286f30530fbb000a37fb2364ac4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderRadiusUnifiedSettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderRadiusUnifiedSettingsTest { + PAGE_TAG: string = 'ListBorderRadiusUnifiedSettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderRadiusUnifiedSettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthRespectivelySettingsLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthRespectivelySettingsLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..94b5f3c158844d09b84bec7c49d8ccf6ae7a4756 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthRespectivelySettingsLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderWidthRespectivelySettingsLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListBorderWidthRespectivelySettingsLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderWidthRespectivelySettingsLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthRespectivelySettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthRespectivelySettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e808af1ba6c412ab529c70d6359fc6e219355791 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthRespectivelySettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderWidthRespectivelySettingsTest { + PAGE_TAG: string = 'ListBorderWidthRespectivelySettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderWidthRespectivelySettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthUnifiedSettingsLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthUnifiedSettingsLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f06ba38c0ef8b927b9335ce3ebe49bafb9a072b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthUnifiedSettingsLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderWidthUnifiedSettingsLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListBorderWidthUnifiedSettingsLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderWidthUnifiedSettingsLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthUnifiedSettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthUnifiedSettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d58f6e96a34844d756f0c0565972bfee98054e88 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBorderWidthUnifiedSettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBorderWidthUnifiedSettingsTest { + PAGE_TAG: string = 'ListBorderWidthUnifiedSettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBorderWidthUnifiedSettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d68678b9e172c650861a735fe91134bf8ab39f4d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBrightnessLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListBrightnessLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBrightnessLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..efe32674c5c8bae6d41c0ff6c2196e011e2e8f23 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBrightnessMaxTest { + PAGE_TAG: string = 'ListBrightnessMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBrightnessMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..66f408c3df8e9d5ad0799d924c508448f1e479fb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBrightnessMinTest { + PAGE_TAG: string = 'ListBrightnessMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBrightnessMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d4b0fb3580e13cbf73220a561a4f995bf418831c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListBrightnessUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListBrightnessUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListBrightnessUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listBrightnessUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListCachedCountAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListCachedCountAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..961c0bbd40954c2d8c2d7024046733483545c282 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListCachedCountAbnormalTest.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListCachedCountAbnormalTest { + PAGE_TAG: string = 'ListCachedCountAbnormalTest'; + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listCachedCountAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListCachedCountTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListCachedCountTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..67144000fed0a3b4a5d2587b60a8ddc885a0f5f1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListCachedCountTest.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListCachedCountTest { + PAGE_TAG: string = 'ListCachedCountTest'; + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listCachedCountTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipCircleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipCircleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..376d0ef02592147b662aa39bd7a75f50546c029c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipCircleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListClipCircleTest { + PAGE_TAG: string = 'ListClipCircleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listClipCircleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipCutTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipCutTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..030ec650180267bf40a0acb6094180212f1d03cc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipCutTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListClipCutTest { + PAGE_TAG: string = 'ListClipCutTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listClipCutTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipEllipseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipEllipseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a50b3401e399d0d21c7902a68dd9466cabcc209 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipEllipseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListClipEllipseTest { + PAGE_TAG: string = 'ListClipEllipseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listClipEllipseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipPathTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipPathTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..76acd718a9ce2f1aa0dcf66237e8da9befa2bd23 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipPathTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListClipPathTest { + PAGE_TAG: string = 'ListClipPathTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listClipPathTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipRectangleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipRectangleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d6cf3d0efb18148988b77bdddec9df28bd70179 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipRectangleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListClipRectangleTest { + PAGE_TAG: string = 'ListClipRectangleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listClipRectangleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipUncutTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipUncutTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..26106c3a95e52ea556f9dead51b6f6a4046a9faf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListClipUncutTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListClipUncutTest { + PAGE_TAG: string = 'ListClipUncutTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listClipUncutTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectFadeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectFadeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..93fc4ce5cdd1f6b981000e3f9e01b38cc31a4b4f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectFadeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListEdgeEffectFadeTest { + PAGE_TAG: string = 'ListEdgeEffectFadeTest'; + LIST_ID: string = 'EdgeEffect' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listEdgeEffectFadeTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..725b1a0b70c7b3314384c880f3995a62b972a059 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListEdgeEffectLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListEdgeEffectLowerBoundAbnormalTest'; + LIST_ID: string = 'EdgeEffect' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listEdgeEffectLowerBoundAbnormalTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..502605aa76b4b1e5a6f1f3ea371b65969d8e44e9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListEdgeEffectNoneTest { + PAGE_TAG: string = 'ListEdgeEffectNoneTest'; + LIST_ID: string = 'EdgeEffect' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listEdgeEffectNoneTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectSpringTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectSpringTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..698ac0456dc115e249262a4983875369430177bf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectSpringTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListEdgeEffectSpringTest { + PAGE_TAG: string = 'ListEdgeEffectSpringTest'; + LIST_ID: string = 'EdgeEffect' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listEdgeEffectSpringTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f6b65fae3758f12daad6fd7cfc763d0c7c8223a9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEdgeEffectUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListEdgeEffectUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListEdgeEffectUpperBoundAbnormalTest'; + LIST_ID: string = 'EdgeEffect' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listEdgeEffectUpperBoundAbnormalTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5543a06075586b7525944200d5d9587d71630b86 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListEnableScrollInteractionLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListEnableScrollInteractionLowerBoundAbnormalTest'; + LIST_ID: string = 'EnableScrollInteraction' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listEnableScrollInteractionLowerBoundAbnormalTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionNotSupportedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionNotSupportedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6149d961d9a66ec231b9ab96591bfa74d8664869 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionNotSupportedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListEnableScrollInteractionNotSupportedTest { + PAGE_TAG: string = 'ListEnableScrollInteractionNotSupportedTest'; + LIST_ID: string = 'EnableScrollInteraction' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listEnableScrollInteractionNotSupportedTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionSupportedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionSupportedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..949ffc8f700a72727dced17eef907be3dbcb68e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionSupportedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListEnableScrollInteractionSupportedTest { + PAGE_TAG: string = 'ListEnableScrollInteractionSupportedTest'; + LIST_ID: string = 'EnableScrollInteraction' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listEnableScrollInteractionSupportedTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2814c19363f72f14e20cd356119c0748afe3ad82 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListEnableScrollInteractionUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListEnableScrollInteractionUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListEnableScrollInteractionUpperBoundAbnormalTest'; + LIST_ID: string = 'EnableScrollInteraction' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listEnableScrollInteractionUpperBoundAbnormalTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListFrictionAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListFrictionAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f717e7d60f92ff63e199ee13b4284c5fcc4d0607 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListFrictionAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListFrictionAbnormalTest { + PAGE_TAG: string = 'ListFrictionAbnormalTest'; + LIST_ID: string = 'Friction' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listFrictionAbnormalTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListFrictionDefaultTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListFrictionDefaultTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ecc9c16b6894ab3177cb639b21c5b869d92ed2d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListFrictionDefaultTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListFrictionDefaultTest { + PAGE_TAG: string = 'ListFrictionDefaultTest'; + LIST_ID: string = 'Friction' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listFrictionDefaultTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListFrictionNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListFrictionNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7be54d4ce99809387b02e9beb9983788ec178a5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListFrictionNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListFrictionNormalTest { + PAGE_TAG: string = 'ListFrictionNormalTest'; + LIST_ID: string = 'Friction' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listFrictionNormalTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightBeyondParentComponentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightBeyondParentComponentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e25b217b8e1864bef24ac7e69c10d3fc50f0cc23 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightBeyondParentComponentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListHeightBeyondParentComponentTest { + PAGE_TAG: string = 'ListHeightBeyondParentComponentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listHeightBeyondParentComponentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightLowerBoundAbnormalContainsSubComponentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightLowerBoundAbnormalContainsSubComponentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c5b8b3c94ac9b9484f83bb454060382447cb24ca --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightLowerBoundAbnormalContainsSubComponentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListHeightLowerBoundAbnormalContainsSubComponentTest { + PAGE_TAG: string = 'ListHeightLowerBoundAbnormalContainsSubComponentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listHeightLowerBoundAbnormalContainsSubComponentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f22831896a5595abc28bd7ee71984ad5915dbb79 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListHeightLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListHeightLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listHeightLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2d134ba50c3c8a1191882df99e540b8effb6214 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListHeightTest { + PAGE_TAG: string = 'ListHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorBlockTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorBlockTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f9487e6f4ead3426529e325cb124b3127eb6c6ad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorBlockTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListHitTestBehaviorBlockTest { + PAGE_TAG: string = 'ListHitTestBehaviorBlockTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listHitTestBehaviorBlockTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorDefaultTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorDefaultTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..95fd15c0676a1ad54de3a5c2ddc97948be65a7c0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorDefaultTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListHitTestBehaviorDefaultTest { + PAGE_TAG: string = 'ListHitTestBehaviorDefaultTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listHitTestBehaviorDefaultTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..123a97158c5672482398cfb8713c5dfa30bdb8b6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListHitTestBehaviorNoneTest { + PAGE_TAG: string = 'ListHitTestBehaviorNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listHitTestBehaviorNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorTransparentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorTransparentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..97b0ecdf50e68aecc15c47ad1509394608be4166 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListHitTestBehaviorTransparentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListHitTestBehaviorTransparentTest { + PAGE_TAG: string = 'ListHitTestBehaviorTransparentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listHitTestBehaviorTransparentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d686cdca4b91a45de98526c84904684be0abb81 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientBottomTest { + PAGE_TAG: string = 'ListLinearGradientBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientCustomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientCustomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..db5585306a330f1f61872968305eee2ecbb788ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientCustomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientCustomTest { + PAGE_TAG: string = 'ListLinearGradientCustomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientCustomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientIllegalColorAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientIllegalColorAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1203b110055fbac8ef8ccd6bbf58526cb48c0545 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientIllegalColorAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientIllegalColorAbnormalTest { + PAGE_TAG: string = 'ListLinearGradientIllegalColorAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientIllegalColorAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLeftBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLeftBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca984c2b185092bae8d011ca929f170e585aa27e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLeftBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientLeftBottomTest { + PAGE_TAG: string = 'ListLinearGradientLeftBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientLeftBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLeftTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLeftTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ece3c944db153a58765660c59f2800d45e038bfd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLeftTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientLeftTest { + PAGE_TAG: string = 'ListLinearGradientLeftTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientLeftTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLeftTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLeftTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6003f876dfc9aaf410e64711889c7856a87b7922 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLeftTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientLeftTopTest { + PAGE_TAG: string = 'ListLinearGradientLeftTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientLeftTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a798db08d6836a1e7482331f603c31127779ece1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListLinearGradientLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..06f6ee9d54e516645c248f714379b86356711a3a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientNoneTest { + PAGE_TAG: string = 'ListLinearGradientNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientRightBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientRightBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..747077ad864772e3e977dc329de1ad7e55a70f7a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientRightBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientRightBottomTest { + PAGE_TAG: string = 'ListLinearGradientRightBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientRightBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientRightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientRightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9664976d3832e91f7a90364983d891ceaed20f05 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientRightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientRightTest { + PAGE_TAG: string = 'ListLinearGradientRightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientRightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientRightTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientRightTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4da525a0cfd11b216f9e96318faceb0955d2771a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientRightTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientRightTopTest { + PAGE_TAG: string = 'ListLinearGradientRightTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientRightTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8043a4749fce7329a2103a6949351177990f600f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListLinearGradientTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListLinearGradientTopTest { + PAGE_TAG: string = 'ListLinearGradientTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listLinearGradientTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionHorizontalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionHorizontalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b18370024187e85966765feb6605813ab4bf70b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionHorizontalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListListDirectionHorizontalTest { + PAGE_TAG: string = 'ListListDirectionHorizontalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listListDirectionHorizontalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c7654955093193226ae9d7743d6486b45e00d714 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListListDirectionLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListListDirectionLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listListDirectionLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a30ec504ea9095801e6c37f38d4ccb5e8b4ba0a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListListDirectionUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListListDirectionUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listListDirectionUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionVerticalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionVerticalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..546dd59fb7f8608c01a9c1aeded6ecf5d67522df --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListListDirectionVerticalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListListDirectionVerticalTest { + PAGE_TAG: string = 'ListListDirectionVerticalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listListDirectionVerticalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1fd435e7baddefad968883fe56bfb23db0104d40 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListOpacityLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListOpacityLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listOpacityLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd1ffa9ae26c2669aa16bfd943cc220b84917486 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListOpacityMaxTest { + PAGE_TAG: string = 'ListOpacityMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listOpacityMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityMiddleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityMiddleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5bc3a991c3af64cc8c675127be8476a3bb68e3c2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityMiddleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListOpacityMiddleTest { + PAGE_TAG: string = 'ListOpacityMiddleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listOpacityMiddleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..213ab2926e0c9cc01ae11c3868f10b706da3b5a5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListOpacityMinTest { + PAGE_TAG: string = 'ListOpacityMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listOpacityMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d67d133b824cca2e021a834061b2bc9e6b8aab2a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListOpacityUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListOpacityUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListOpacityUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listOpacityUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateDefaultValueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateDefaultValueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d024a9a634d95016e4534353b8574a3ebd0b5d7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateDefaultValueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListRotateDefaultValueTest { + PAGE_TAG: string = 'ListRotateDefaultValueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listRotateDefaultValueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetNegativeNumbersTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetNegativeNumbersTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..466a4086c98b54222f57e4899e9ea619db10e382 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetNegativeNumbersTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListRotateSetNegativeNumbersTest { + PAGE_TAG: string = 'ListRotateSetNegativeNumbersTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listRotateSetNegativeNumbersTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetRotationAngleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetRotationAngleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7cf60a1c42e0553e3f137016e7fe832691cbefa2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetRotationAngleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListRotateSetRotationAngleTest { + PAGE_TAG: string = 'ListRotateSetRotationAngleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listRotateSetRotationAngleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetSightDistanceTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetSightDistanceTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a91b3d7c6fed1814131a6c9ea882cfdf424a14b5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetSightDistanceTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListRotateSetSightDistanceTest { + PAGE_TAG: string = 'ListRotateSetSightDistanceTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listRotateSetSightDistanceTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetXYZTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetXYZTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..72bdffedaa34ccb5854bb0f070840b1b7677d383 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateSetXYZTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListRotateSetXYZTest { + PAGE_TAG: string = 'ListRotateSetXYZTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listRotateSetXYZTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5cb3d0fb1fee96a02c574de3c508b13292060a9d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListRotateTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListRotateTest { + PAGE_TAG: string = 'ListRotateTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listRotateTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..60602f48c82626b5c1b4421c3d104ca88d549441 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListSaturateLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListSaturateLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listSaturateLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca45e28a3a2e0d16ba1dcc99feb67354381291c5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListSaturateMaxTest { + PAGE_TAG: string = 'ListSaturateMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listSaturateMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6868874e27659066042b1c0e4566b94fcd4d5250 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListSaturateMinTest { + PAGE_TAG: string = 'ListSaturateMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listSaturateMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..15993cb1999ae79166d3548b75f631de71252bf3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListSaturateUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListSaturateUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListSaturateUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listSaturateUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..63095adc177d9504ae032073f50ffd8e8198ff35 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListScaleAbnormalTest { + PAGE_TAG: string = 'ListScaleAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listScaleAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleEnlargeXTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleEnlargeXTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ddb3b04a3e8df10a13c7a8ea15f4fd85b510ded --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleEnlargeXTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListScaleEnlargeXTest { + PAGE_TAG: string = 'ListScaleEnlargeXTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listScaleEnlargeXTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleEnlargeXYTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleEnlargeXYTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..351ad9a34b09936b6325f59442a1d18a2b7b6ede --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleEnlargeXYTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListScaleEnlargeXYTest { + PAGE_TAG: string = 'ListScaleEnlargeXYTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listScaleEnlargeXYTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleReduceXTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleReduceXTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a14b50ab0ab62dd21d9ccddbecd049711c26692 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleReduceXTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListScaleReduceXTest { + PAGE_TAG: string = 'ListScaleReduceXTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listScaleReduceXTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleReduceXYTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleReduceXYTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ebba16c5ef949f259f2de17cb1302ffdc86c5d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScaleReduceXYTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListScaleReduceXYTest { + PAGE_TAG: string = 'ListScaleReduceXYTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listScaleReduceXYTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9667189721b2760fdc13d0bad27535539485e69 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarAutoTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListScrollBarAutoTest { + PAGE_TAG: string = 'ListScrollBarAutoTest'; + LIST_ID: string = 'ScrollBarAuto' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listScrollBarAutoTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2da8ef4f2d55edce61ff02aa6a9e82f246424fc8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListScrollBarLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListScrollBarLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listScrollBarLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarOffTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarOffTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b6b585f5f324b37fe6d3a6b422ae7670b054a0e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarOffTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListScrollBarOffTest { + PAGE_TAG: string = 'ListScrollBarOffTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listScrollBarOffTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarOnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarOnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c245c3ced6e7d1629088fcfb829bacd189e8af67 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarOnTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListScrollBarOnTest { + PAGE_TAG: string = 'ListScrollBarOnTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listScrollBarOnTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..10b2377087ef8f82fa6dfda6ffdc8e9e3b70398d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListScrollBarUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListScrollBarUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListScrollBarUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listScrollBarUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowFloatingShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowFloatingShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ba9d1d1dbf34f975922252734980535c3df4d32 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowFloatingShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListShadowFloatingShadowTest { + PAGE_TAG: string = 'ListShadowFloatingShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listShadowFloatingShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowFloatingSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowFloatingSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd3ea94f6fc13a134e00da92a3558d72ec460c72 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowFloatingSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListShadowFloatingSmallShadowTest { + PAGE_TAG: string = 'ListShadowFloatingSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listShadowFloatingSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowLargeShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowLargeShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..72b536c6fcc875477c4f92b46460e51b36c65f5e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowLargeShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListShadowLargeShadowTest { + PAGE_TAG: string = 'ListShadowLargeShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listShadowLargeShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..86b82b3fe47d586d04451073c348836c3c3e24ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListShadowLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListShadowLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listShadowLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowMiddleShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowMiddleShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..30567977b9c6d60f6fd63a1a07b45a28d001f56b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowMiddleShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListShadowMiddleShadowTest { + PAGE_TAG: string = 'ListShadowMiddleShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listShadowMiddleShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..504993290650691fc08df287969d615eb08cff16 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListShadowSmallShadowTest { + PAGE_TAG: string = 'ListShadowSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listShadowSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowUltraSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowUltraSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8b8326cd884a34b0db3550e661674b7eb0fe4e4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowUltraSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListShadowUltraSmallShadowTest { + PAGE_TAG: string = 'ListShadowUltraSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listShadowUltraSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2a18297f1473a6cf479f193ebeb799e55f6a7860 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListShadowUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListShadowUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListShadowUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listShadowUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyBothTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyBothTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f53798d1058f9103c886268cbf550e3b41823690 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyBothTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListStickyBothTest { + PAGE_TAG: string = 'ListStickyBothTest'; + LIST_ID: string = 'Sticky' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listStickyBothTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyFooterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyFooterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cc0413c712e2de5787631db1b96c7e734eaa6c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyFooterTest.ets @@ -0,0 +1,33 @@ + /* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListStickyFooterTest { + PAGE_TAG: string = 'ListStickyFooterTest'; + LIST_ID: string = 'Sticky' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listStickyFooterTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyHeaderTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyHeaderTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c06c0e772e1e9a8d1885a7292f2150a1ba3cf617 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyHeaderTest.ets @@ -0,0 +1,33 @@ + /* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListStickyHeaderTest { + PAGE_TAG: string = 'ListStickyHeaderTest'; + LIST_ID: string = 'Sticky' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listStickyHeaderTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9661c60881b86c15a36ec9665215bde99cf7b9a8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListStickyLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListStickyLowerBoundAbnormalTest'; + LIST_ID: string = 'Sticky' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listStickyLowerBoundAbnormalTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f6284c9396fffa422aa78b70d7b8c7a2848da00 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListStickyNoneTest { + PAGE_TAG: string = 'ListStickyNoneTest'; + LIST_ID: string = 'Sticky' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listStickyNoneTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..43c8f65abb41a1bf91b6917ec757b79391fbf34c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListStickyUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListStickyUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListStickyUpperBoundAbnormalTest'; + LIST_ID: string = 'Sticky' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listStickyUpperBoundAbnormalTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXMinusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXMinusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ead9d5a5a55982eaf901636e8bc0da2573fa3bf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXMinusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListTranslateSetXMinusTest { + PAGE_TAG: string = 'ListTranslateSetXMinusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listTranslateSetXMinusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..50f075f7b1f20cf4428a346a4a501fb8a9c3b319 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListTranslateSetXTest { + PAGE_TAG: string = 'ListTranslateSetXTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listTranslateSetXTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXYZMinusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXYZMinusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..91291c8d62c502c8aa86d2c378a145887d859b21 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXYZMinusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListTranslateSetXYZMinusTest { + PAGE_TAG: string = 'ListTranslateSetXYZMinusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listTranslateSetXYZMinusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXYZTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXYZTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cac6004cb2212f39ed18c444317b23c453e10e97 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateSetXYZTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListTranslateSetXYZTest { + PAGE_TAG: string = 'ListTranslateSetXYZTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listTranslateSetXYZTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateUnifiedAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateUnifiedAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d75f3b463d70117b2c061549a4e4e420e6d63943 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateUnifiedAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListTranslateUnifiedAbnormalTest { + PAGE_TAG: string = 'ListTranslateUnifiedAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listTranslateUnifiedAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateUnifiedMinusAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateUnifiedMinusAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8832cfe26a46a67b37c9900bb807a681c95ca39 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListTranslateUnifiedMinusAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListTranslateUnifiedMinusAbnormalTest { + PAGE_TAG: string = 'ListTranslateUnifiedMinusAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listTranslateUnifiedMinusAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthBeyondParentComponentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthBeyondParentComponentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..825c922fa0428f58579ee421226ad13ee50b2b23 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthBeyondParentComponentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListWidthBeyondParentComponentTest { + PAGE_TAG: string = 'ListWidthBeyondParentComponentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listWidthBeyondParentComponentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthLowerBoundAbnormalContainsSubComponentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthLowerBoundAbnormalContainsSubComponentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..30df1562fdd290f989940e4bc9e409b36eecb809 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthLowerBoundAbnormalContainsSubComponentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListWidthLowerBoundAbnormalContainsSubComponentTest { + PAGE_TAG: string = 'ListWidthLowerBoundAbnormalContainsSubComponentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listWidthLowerBoundAbnormalContainsSubComponentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca72996adb4f05270c5d9b21c2195be0bacbfa34 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListWidthLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListWidthLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listWidthLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d55b44a9561f0c71e1d872259f517223667c28be --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/list/ListWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListWidthTest { + PAGE_TAG: string = 'ListWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBackgroundColorNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBackgroundColorNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..24dd5623de0791591c2fdea23667b4554d2ef041 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBackgroundColorNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBackgroundColorNullTest { + PAGE_TAG: string = 'ListItemBackgroundColorNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBackgroundColorNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bab6c5c7bd9bf2bb229e59275997b88de6ab0c0e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBackgroundColorTest { + PAGE_TAG: string = 'ListItemBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBackgroundColorUndefinedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBackgroundColorUndefinedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b45c80cd1000fcf84ee41f34ef8adb827fc0f5d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBackgroundColorUndefinedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBackgroundColorUndefinedTest { + PAGE_TAG: string = 'ListItemBackgroundColorUndefinedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBackgroundColorUndefinedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBlurAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBlurAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7b0bc1e308ce22005558e8cb4909d59be6e44c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBlurAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBlurAbnormalTest { + PAGE_TAG: string = 'ListItemBlurAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBlurAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBlurDefaultValueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBlurDefaultValueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c54d567a35318d797123c8e8249409d7bed191de --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBlurDefaultValueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBlurDefaultValueTest { + PAGE_TAG: string = 'ListItemBlurDefaultValueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBlurDefaultValueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBlurTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBlurTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..732e57a6f2168c48beffa871dd117b03ec2dc3ec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBlurTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBlurTest { + PAGE_TAG: string = 'ListItemBlurTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBlurTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..477de05ff64c53a534312e3af15684ae7d87f5d1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderColorNullTest { + PAGE_TAG: string = 'ListItemBorderColorNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderColorNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorRespectivelySettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorRespectivelySettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c3f313a68cb8ff58e411fd13c6cfe6435126ed4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorRespectivelySettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderColorRespectivelySettingsTest { + PAGE_TAG: string = 'ListItemBorderColorRespectivelySettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderColorRespectivelySettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorUndefinedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorUndefinedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9bbc24a03c4302a8761dd6f576f48a5a78af6642 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorUndefinedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderColorUndefinedTest { + PAGE_TAG: string = 'ListItemBorderColorUndefinedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderColorUndefinedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorUnifiedSettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorUnifiedSettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..434dc0ef2d7ec43f140db860cf8b433587ae8fa6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderColorUnifiedSettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderColorUnifiedSettingsTest { + PAGE_TAG: string = 'ListItemBorderColorUnifiedSettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderColorUnifiedSettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusRespectivelySettingsLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusRespectivelySettingsLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4e52c5570d9daedba84efc1ad9001f33259e700 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusRespectivelySettingsLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderRadiusRespectivelySettingsLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemBorderRadiusRespectivelySettingsLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderRadiusRespectivelySettingsLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusRespectivelySettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusRespectivelySettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1e14c8a01217ce7388193b22f16bb0e7ed5a0ba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusRespectivelySettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderRadiusRespectivelySettingsTest { + PAGE_TAG: string = 'ListItemBorderRadiusRespectivelySettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderRadiusRespectivelySettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusUnifiedSettingsLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusUnifiedSettingsLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9fcf5a5e447e00b839116c34ee5d64a53a363dc6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusUnifiedSettingsLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderRadiusUnifiedSettingsLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemBorderRadiusUnifiedSettingsLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderRadiusUnifiedSettingsLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusUnifiedSettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusUnifiedSettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d5b0e24d25fe75d0364f891245ee0b650dde74f3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderRadiusUnifiedSettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderRadiusUnifiedSettingsTest { + PAGE_TAG: string = 'ListItemBorderRadiusUnifiedSettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderRadiusUnifiedSettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthRespectivelySettingsLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthRespectivelySettingsLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..be73ba642bab3c5ec8ec886e84f25a54a15c013e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthRespectivelySettingsLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderWidthRespectivelySettingsLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemBorderWidthRespectivelySettingsLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderWidthRespectivelySettingsLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthRespectivelySettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthRespectivelySettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..58bba736b08dde22e8a8df1424c386f9b30ab00d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthRespectivelySettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderWidthRespectivelySettingsTest { + PAGE_TAG: string = 'ListItemBorderWidthRespectivelySettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderWidthRespectivelySettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthUnifiedSettingsLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthUnifiedSettingsLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1dc1a363081a327a6a07d249ba55b0c4de7afbbe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthUnifiedSettingsLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderWidthUnifiedSettingsLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemBorderWidthUnifiedSettingsLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderWidthUnifiedSettingsLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthUnifiedSettingsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthUnifiedSettingsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cabdffecedf610be24e1b542cf1052c29adecef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBorderWidthUnifiedSettingsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBorderWidthUnifiedSettingsTest { + PAGE_TAG: string = 'ListItemBorderWidthUnifiedSettingsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBorderWidthUnifiedSettingsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..06f50576e44f9d9aec145763f4cb66c97be49e7a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBrightnessLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemBrightnessLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBrightnessLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..452eb15bf4b219d1c9b8166fb6b01c1dc9f66833 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBrightnessMaxTest { + PAGE_TAG: string = 'ListItemBrightnessMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBrightnessMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb786ddf1b20eab69b56234225d6001095bd158b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBrightnessMinTest { + PAGE_TAG: string = 'ListItemBrightnessMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBrightnessMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..74949fdac66cb35a5cb1a550451a891583574ecf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemBrightnessUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemBrightnessUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListItemBrightnessUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemBrightnessUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemCachedCountAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemCachedCountAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a559b85f023568b6fff46fe11e8ed55af87757ce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemCachedCountAbnormalTest.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemCachedCountAbnormalTest { + PAGE_TAG: string = 'ListItemCachedCountAbnormalTest'; + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemCachedCountAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipCircleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipCircleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba77705ae6a8c4885fbaf99dd19f67ab8ace73b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipCircleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemClipCircleTest { + PAGE_TAG: string = 'ListItemClipCircleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemClipCircleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipCutTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipCutTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b6a78b724f837a01fab6356adf9c497e7a03e212 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipCutTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemClipCutTest { + PAGE_TAG: string = 'ListItemClipCutTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemClipCutTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipEllipseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipEllipseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd068fb21b149a5b83217e790ad36e4c3a92c741 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipEllipseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemClipEllipseTest { + PAGE_TAG: string = 'ListItemClipEllipseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemClipEllipseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipPathTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipPathTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9323c6db08ff32e8eb14d06ff4b992f6f8d92164 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipPathTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemClipPathTest { + PAGE_TAG: string = 'ListItemClipPathTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemClipPathTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipRectangleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipRectangleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..af6d716593db49ecaa7055766eec00b3d1c8d337 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipRectangleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemClipRectangleTest { + PAGE_TAG: string = 'ListItemClipRectangleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemClipRectangleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipUncutTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipUncutTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e773d9ab8bd9bc215813b5fac1144b0c429e8b41 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemClipUncutTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemClipUncutTest { + PAGE_TAG: string = 'ListItemClipUncutTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemClipUncutTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectFadeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectFadeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..25c1e464bf50b36a4985f9bb8a5b8c30b6edc9f1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectFadeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemEdgeEffectFadeTest { + PAGE_TAG: string = 'ListItemEdgeEffectFadeTest'; + LIST_ID: string = 'EdgeEffect' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemEdgeEffectFadeTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ef797b331c6ae29eafcab354986c50132893910 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemEdgeEffectLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemEdgeEffectLowerBoundAbnormalTest'; + LIST_ID: string = 'EdgeEffect' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemEdgeEffectLowerBoundAbnormalTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9f6084a071d59111444461cc2b149dcca0ca6de8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemEdgeEffectNoneTest { + PAGE_TAG: string = 'ListItemEdgeEffectNoneTest'; + LIST_ID: string = 'EdgeEffect' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemEdgeEffectNoneTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectSpringTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectSpringTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..065a6eb3d564b1cf1646dc590a2b1090d42c78ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectSpringTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemEdgeEffectSpringTest { + PAGE_TAG: string = 'ListItemEdgeEffectSpringTest'; + LIST_ID: string = 'EdgeEffect' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemEdgeEffectSpringTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb9e8f7c662428888e49444fee7c5bcc3fac9d3f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemEdgeEffectUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemEdgeEffectUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListItemEdgeEffectUpperBoundAbnormalTest'; + LIST_ID: string = 'EdgeEffect' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemEdgeEffectUpperBoundAbnormalTest(this.PAGE_TAG, this.LIST_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightBeyondParentComponentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightBeyondParentComponentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b84576daec16840da5d4db6d03bc4b4a3f6be68 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightBeyondParentComponentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemHeightBeyondParentComponentTest { + PAGE_TAG: string = 'ListItemHeightBeyondParentComponentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemHeightBeyondParentComponentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightLowerBoundAbnormalContainsSubComponentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightLowerBoundAbnormalContainsSubComponentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4bb8b90fb15401cde0dc1cb66ead2398c924641 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightLowerBoundAbnormalContainsSubComponentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemHeightLowerBoundAbnormalContainsSubComponentTest { + PAGE_TAG: string = 'ListItemHeightLowerBoundAbnormalContainsSubComponentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemHeightLowerBoundAbnormalContainsSubComponentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1e2c61135d67c7ee67cf2889150ee970625060b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemHeightLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemHeightLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemHeightLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..020b8253b07ee1767f6fa2ad9e8af8497e01eaa4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemHeightTest { + PAGE_TAG: string = 'ListItemHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorBlockTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorBlockTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..753339ee289dc404c1887829f8893b62e9521cc0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorBlockTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemHitTestBehaviorBlockTest { + PAGE_TAG: string = 'ListItemHitTestBehaviorBlockTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemHitTestBehaviorBlockTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorDefaultTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorDefaultTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..60f9005a1b29e8690604961f459fbb23d55e3eba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorDefaultTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemHitTestBehaviorDefaultTest { + PAGE_TAG: string = 'ListItemHitTestBehaviorDefaultTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemHitTestBehaviorDefaultTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0606e197bacf114c8b01d5c3ac030ad31d04bd0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemHitTestBehaviorNoneTest { + PAGE_TAG: string = 'ListItemHitTestBehaviorNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemHitTestBehaviorNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorTransparentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorTransparentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..69feee27e6ac4373fa0117fd635dca4355f85c6f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemHitTestBehaviorTransparentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemHitTestBehaviorTransparentTest { + PAGE_TAG: string = 'ListItemHitTestBehaviorTransparentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemHitTestBehaviorTransparentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd1b0940c40731fbeb30b22b0d571395067f2c7b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientBottomTest { + PAGE_TAG: string = 'ListItemLinearGradientBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientCustomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientCustomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ab0b53b4c9dafce52b112e44bba7c159cf8fdfa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientCustomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientCustomTest { + PAGE_TAG: string = 'ListItemLinearGradientCustomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientCustomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientIllegalColorAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientIllegalColorAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed4ae2faf1215f8f8510215c4c9b5f06712eec18 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientIllegalColorAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientIllegalColorAbnormalTest { + PAGE_TAG: string = 'ListItemLinearGradientIllegalColorAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientIllegalColorAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLeftBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLeftBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f2dbb3a55125f7ac911c9facc35fdd156396f5b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLeftBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientLeftBottomTest { + PAGE_TAG: string = 'ListItemLinearGradientLeftBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientLeftBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLeftTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLeftTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ceceb66ba47c47b7780d12311cb33cd36f555227 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLeftTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientLeftTest { + PAGE_TAG: string = 'ListItemLinearGradientLeftTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientLeftTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLeftTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLeftTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..70bfc0cc4fdefb8934f29475ccee20443378ea04 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLeftTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientLeftTopTest { + PAGE_TAG: string = 'ListItemLinearGradientLeftTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientLeftTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f5d087b0c3caaf93ed9d58ffe34a4fa309ab19b4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemLinearGradientLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dad418c580baadd46d32c1efcfa00ec43d023a0b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientNoneTest { + PAGE_TAG: string = 'ListItemLinearGradientNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientRightBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientRightBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d07d34860349af357e14d038b48ced5db94b4bea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientRightBottomTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientRightBottomTest { + PAGE_TAG: string = 'ListItemLinearGradientRightBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientRightBottomTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientRightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientRightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9df9d0950b0691060f700037586a93f80f2c780a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientRightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientRightTest { + PAGE_TAG: string = 'ListItemLinearGradientRightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientRightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientRightTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientRightTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..319c1770c31a0f98c579910346ec28ba17e3ee07 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientRightTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientRightTopTest { + PAGE_TAG: string = 'ListItemLinearGradientRightTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientRightTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ad60be009ac764cb2c0cb1d44d85e3bffbd97f8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemLinearGradientTopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemLinearGradientTopTest { + PAGE_TAG: string = 'ListItemLinearGradientTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemLinearGradientTopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba7fae493d7b92acebb06fe2236594e5d4171b91 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemOpacityLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemOpacityLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemOpacityLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2cedce7821609f779403c3f8e0d6433625d4a502 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemOpacityMaxTest { + PAGE_TAG: string = 'ListItemOpacityMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemOpacityMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityMiddleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityMiddleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5fab685e77355d94c3e3ad77d6609ae4ff676f55 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityMiddleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemOpacityMiddleTest { + PAGE_TAG: string = 'ListItemOpacityMiddleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemOpacityMiddleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..82161891b8b888be1e7b7db3a90f7e284972cfbc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemOpacityMinTest { + PAGE_TAG: string = 'ListItemOpacityMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemOpacityMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a8d5300477ab1172d48f6898e065fbcb766495b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemOpacityUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemOpacityUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListItemOpacityUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemOpacityUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateDefaultValueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateDefaultValueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..77a5e2e0f112c279e251cb0facea65931bcc681a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateDefaultValueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemRotateDefaultValueTest { + PAGE_TAG: string = 'ListItemRotateDefaultValueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemRotateDefaultValueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetNegativeNumbersTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetNegativeNumbersTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3998ae5a592470e3f4ef167be953f235c41b32ec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetNegativeNumbersTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemRotateSetNegativeNumbersTest { + PAGE_TAG: string = 'ListItemRotateSetNegativeNumbersTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemRotateSetNegativeNumbersTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetRotationAngleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetRotationAngleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..18e25c63ed1f88b2b574bbe41261b62435ea5a93 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetRotationAngleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemRotateSetRotationAngleTest { + PAGE_TAG: string = 'ListItemRotateSetRotationAngleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemRotateSetRotationAngleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetSightDistanceTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetSightDistanceTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b69b71595979b2137ce4afbe61d205ff07df6d7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetSightDistanceTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemRotateSetSightDistanceTest { + PAGE_TAG: string = 'ListItemRotateSetSightDistanceTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemRotateSetSightDistanceTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetXYZTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetXYZTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..99971aa7b1ea4c9a14c08bc2f4a665ff4d2c2fee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateSetXYZTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemRotateSetXYZTest { + PAGE_TAG: string = 'ListItemRotateSetXYZTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemRotateSetXYZTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6449c77c8ef3176ecde5f70b3e35c15da8d4a386 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemRotateTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemRotateTest { + PAGE_TAG: string = 'ListItemRotateTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemRotateTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c165ccc4b8c10e6e146f0ca107e124557be08735 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemSaturateLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemSaturateLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemSaturateLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..74c4b0b3fdd4670c55604209cdc406859c7b3a9c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemSaturateMaxTest { + PAGE_TAG: string = 'ListItemSaturateMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemSaturateMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed6a234a9c1d993e4c1c437348c0a22fb449a102 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemSaturateMinTest { + PAGE_TAG: string = 'ListItemSaturateMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemSaturateMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b73561d882cab6af115e81f967aee6d525d16262 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemSaturateUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemSaturateUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListItemSaturateUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemSaturateUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0df58f3c565eade45fc0d0863db009851610e46a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemScaleAbnormalTest { + PAGE_TAG: string = 'ListItemScaleAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemScaleAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleEnlargeXTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleEnlargeXTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e984c3c17793273d6cc590495eb79ab37c475b05 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleEnlargeXTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemScaleEnlargeXTest { + PAGE_TAG: string = 'ListItemScaleEnlargeXTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemScaleEnlargeXTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleEnlargeXYTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleEnlargeXYTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3f4e9a302c6900ae1112d01a5dcd59793873541 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleEnlargeXYTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemScaleEnlargeXYTest { + PAGE_TAG: string = 'ListItemScaleEnlargeXYTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemScaleEnlargeXYTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleReduceXTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleReduceXTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..40df87259cb141f64f25794da6cb852906631705 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleReduceXTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemScaleReduceXTest { + PAGE_TAG: string = 'ListItemScaleReduceXTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemScaleReduceXTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleReduceXYTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleReduceXYTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..119d8bd33d9e9635b0c4fb75e30c9f680f880249 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemScaleReduceXYTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemScaleReduceXYTest { + PAGE_TAG: string = 'ListItemScaleReduceXYTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemScaleReduceXYTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowFloatingShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowFloatingShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a45c3ebf810448596b1e6affa7e1030def237acc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowFloatingShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemShadowFloatingShadowTest { + PAGE_TAG: string = 'ListItemShadowFloatingShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemShadowFloatingShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowFloatingSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowFloatingSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..749947e09f6a3e1cd7bf0d353ee09d3c8b8532fc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowFloatingSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemShadowFloatingSmallShadowTest { + PAGE_TAG: string = 'ListItemShadowFloatingSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemShadowFloatingSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowLargeShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowLargeShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e267f621cb2c2cbd173986e98cffecc86016a22d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowLargeShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemShadowLargeShadowTest { + PAGE_TAG: string = 'ListItemShadowLargeShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemShadowLargeShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..21c4e0d071b01e0da63065f873ed1930ab29941b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemShadowLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemShadowLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemShadowLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowMiddleShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowMiddleShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ae462e31163462048c3ad971dbea0b9dd4d905d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowMiddleShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemShadowMiddleShadowTest { + PAGE_TAG: string = 'ListItemShadowMiddleShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemShadowMiddleShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a16433ecf2636817483003df381a7b57239b9126 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemShadowSmallShadowTest { + PAGE_TAG: string = 'ListItemShadowSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemShadowSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowUltraSmallShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowUltraSmallShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e26550000142f98a4145fee99347f51c48003f5b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowUltraSmallShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemShadowUltraSmallShadowTest { + PAGE_TAG: string = 'ListItemShadowUltraSmallShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemShadowUltraSmallShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowUpperBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowUpperBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb4d65ad1d40d795ec43dc601200b4a0a8bc769d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemShadowUpperBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemShadowUpperBoundAbnormalTest { + PAGE_TAG: string = 'ListItemShadowUpperBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemShadowUpperBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXMinusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXMinusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c62c238bada117ef5c13902bbf4f4e96ba828e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXMinusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemTranslateSetXMinusTest { + PAGE_TAG: string = 'ListItemTranslateSetXMinusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemTranslateSetXMinusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1c5baed35de22c73557417b5ad9e116e6e55a6c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemTranslateSetXTest { + PAGE_TAG: string = 'ListItemTranslateSetXTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemTranslateSetXTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXYZMinusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXYZMinusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7f9e189c1cc4563d2394cf1862434bd10dde9514 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXYZMinusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemTranslateSetXYZMinusTest { + PAGE_TAG: string = 'ListItemTranslateSetXYZMinusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemTranslateSetXYZMinusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXYZTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXYZTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2b76c6fdcc39e9fd5eeb25ea2c34d5eca77de72b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateSetXYZTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemTranslateSetXYZTest { + PAGE_TAG: string = 'ListItemTranslateSetXYZTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemTranslateSetXYZTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateUnifiedAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateUnifiedAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2583d19e167ed324b04056a5e810c0edaa57c3ee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateUnifiedAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemTranslateUnifiedAbnormalTest { + PAGE_TAG: string = 'ListItemTranslateUnifiedAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemTranslateUnifiedAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateUnifiedMinusAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateUnifiedMinusAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ba1fe7f22db923f578a12ab630877ab5a51b3f7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemTranslateUnifiedMinusAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemTranslateUnifiedMinusAbnormalTest { + PAGE_TAG: string = 'ListItemTranslateUnifiedMinusAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemTranslateUnifiedMinusAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthBeyondParentComponentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthBeyondParentComponentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..23cf5bbe6d43b8a11cb09cfa8fc4615b2abc27e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthBeyondParentComponentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemWidthBeyondParentComponentTest { + PAGE_TAG: string = 'ListItemWidthBeyondParentComponentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemWidthBeyondParentComponentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthLowerBoundAbnormalContainsSubComponentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthLowerBoundAbnormalContainsSubComponentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6d64a532b7cc6316d1c96a53d748b443b28ec705 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthLowerBoundAbnormalContainsSubComponentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemWidthLowerBoundAbnormalContainsSubComponentTest { + PAGE_TAG: string = 'ListItemWidthLowerBoundAbnormalContainsSubComponentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemWidthLowerBoundAbnormalContainsSubComponentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthLowerBoundAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthLowerBoundAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..02caaf39e9997812ead6294e1cc153f9484a3253 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthLowerBoundAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemWidthLowerBoundAbnormalTest { + PAGE_TAG: string = 'ListItemWidthLowerBoundAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemWidthLowerBoundAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0098656c3f8dd3d9a0d4f190d0bc14aefd8c823 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/listitem/ListItemWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ListItemWidthTest { + PAGE_TAG: string = 'ListItemWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.listItemWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressColorBlackTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressColorBlackTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..221785c4587c89b727626aa10398f0f9779d5bc2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressColorBlackTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct LoadingProgressColorBlackTest { + PAGE_TAG: string = 'LoadingProgressColorBlackTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.loadingProgressColorBlackTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5da8e42e77e8ba3051f5a71d042465ede4a5a39 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct LoadingProgressColorTest { + PAGE_TAG: string = 'LoadingProgressColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.loadingProgressColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressColorWhiteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressColorWhiteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..38a470d224385fad435759f1400cb6d36f358bf3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressColorWhiteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct LoadingProgressColorWhiteTest { + PAGE_TAG: string = 'LoadingProgressColorWhiteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.loadingProgressColorWhiteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressEnableLoadingFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressEnableLoadingFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1cb2a20695b502b29afc0ddb354bba110037e30b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressEnableLoadingFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct LoadingProgressEnableLoadingFalseTest { + PAGE_TAG: string = 'LoadingProgressEnableLoadingFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.loadingProgressEnableLoadingFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressEnableLoadingTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressEnableLoadingTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d0294a6d6b0405d982247d4c7a1a052d61bcd63 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/loadingprogress/LoadingProgressEnableLoadingTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct LoadingProgressEnableLoadingTrueTest { + PAGE_TAG: string = 'LoadingProgressEnableLoadingTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.loadingProgressEnableLoadingTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressBackgroundColorBlackTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressBackgroundColorBlackTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d07d8215be7c660c40e1ec2043152a5894add487 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressBackgroundColorBlackTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressBackgroundColorBlackTest { + PAGE_TAG: string = 'ProgressBackgroundColorBlackTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressBackgroundColorBlackTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0de660fe2b49e997b0e033e301221ac38b95b2f3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressBackgroundColorTest { + PAGE_TAG: string = 'ProgressBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressBackgroundColorWhiteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressBackgroundColorWhiteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9c0b3e669e8cc820e292b36e623254e98272ab6b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressBackgroundColorWhiteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressBackgroundColorWhiteTest { + PAGE_TAG: string = 'ProgressBackgroundColorWhiteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressBackgroundColorWhiteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressColorBlackTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressColorBlackTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f66f7096db5baee6ab526307524c98437c02095 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressColorBlackTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressColorBlackTest { + PAGE_TAG: string = 'ProgressColorBlackTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressColorBlackTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ae2175b2bac02734c7c37e3cc8e4f38cec1cea2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressColorTest { + PAGE_TAG: string = 'ProgressColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressColorWhiteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressColorWhiteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ee77a9ffcc05e36926f23732935325957b93303 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressColorWhiteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressColorWhiteTest { + PAGE_TAG: string = 'ProgressColorWhiteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressColorWhiteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleCapsuleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleCapsuleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fdbcdd1f7fab7c085447dd919a6394f644a100e9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleCapsuleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressStyleCapsuleTest { + PAGE_TAG: string = 'ProgressStyleCapsuleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressStyleCapsuleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleEclipseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleEclipseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6d07003e21fa9a8cc7e65b98a15f91e3dc6275c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleEclipseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressStyleEclipseTest { + PAGE_TAG: string = 'ProgressStyleEclipseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressStyleEclipseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleLinearTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleLinearTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7abb225bd4ad29f37afb4c9119eb7682eae5e6d6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleLinearTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressStyleLinearTest { + PAGE_TAG: string = 'ProgressStyleLinearTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressStyleLinearTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleRingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleRingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..67d424efe5108193529354261441db2e66c15b55 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleRingTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressStyleRingTest { + PAGE_TAG: string = 'ProgressStyleRingTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressStyleRingTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleScaleRingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleScaleRingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9c9ab8259abc8ec96612da8906c5c8849d8481b9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/progress/ProgressStyleScaleRingTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ProgressStyleScaleRingTest { + PAGE_TAG: string = 'ProgressStyleScaleRingTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.progressStyleScaleRingTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/refresh/RefreshOnRefreshingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/refresh/RefreshOnRefreshingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..89c60bc6ba3a3747c63802bdd91b6afa59ec5ba5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/refresh/RefreshOnRefreshingTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshOnRefreshingTest { + PAGE_TAG: string = 'RefreshOnRefreshingTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshOnRefreshingTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/refresh/RefreshOnStateChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/refresh/RefreshOnStateChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..586bb4e5f7dd7e3ff3f3539a5f231ebd02b46e99 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/refresh/RefreshOnStateChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RefreshOnStateChangeTest { + PAGE_TAG: string = 'RefreshOnStateChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.refreshOnStateChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/row/RowHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/row/RowHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..547d418e715039240a49f44bdf64fc42d4a511e7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/row/RowHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RowHeightLargeTest { + PAGE_TAG: string = 'RowHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.rowHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/row/RowHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/row/RowHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e5b890b883360c1c7cb9011b0bfe4a7be7ce3b6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/row/RowHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct RowHeightTest { + PAGE_TAG: string = 'RowHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.rowHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f643c521a7b7f6a4926632528c795166b296887f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBackgroundColorAbnormalTest { + PAGE_TAG: string = 'ScrollBackgroundColorAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBackgroundColorAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorBlackTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorBlackTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e3ecc678cd099d0caa9d179d5fb27b7bb1c8c138 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorBlackTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBackgroundColorBlackTest { + PAGE_TAG: string = 'ScrollBackgroundColorBlackTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBackgroundColorBlackTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..318391c53a931182120b318ee5a9942d5a03bf7f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBackgroundColorTest { + PAGE_TAG: string = 'ScrollBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorWhiteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorWhiteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..84758c8b5503e9c1f628f5f388eec23a8f37a226 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBackgroundColorWhiteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBackgroundColorWhiteTest { + PAGE_TAG: string = 'ScrollBackgroundColorWhiteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBackgroundColorWhiteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBlurDefaultTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBlurDefaultTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..65fbb8fa4213c6bffcdd29abac3a5beaa29a916b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBlurDefaultTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBlurDefaultTest { + PAGE_TAG: string = 'ScrollBlurDefaultTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBlurDefaultTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBlurTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBlurTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8ee73fbffd6fd110f250543722f1404ee93f2816 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBlurTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBlurTest { + PAGE_TAG: string = 'ScrollBlurTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBlurTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a311d1f2cc55ffb8861fe08c974613cbeee77282 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBorderColorAbnormalTest { + PAGE_TAG: string = 'ScrollBorderColorAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBorderColorAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e83830318f0dbe6d85be69eceb50d231f5cd4eea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBorderColorNullTest { + PAGE_TAG: string = 'ScrollBorderColorNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBorderColorNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..02527672948cec3c3edf9736cabd26c0e7a16278 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBorderColorTest { + PAGE_TAG: string = 'ScrollBorderColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBorderColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorUndefinedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorUndefinedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..85e074bba422cccd22a26e8211de5ef5056b8ef4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderColorUndefinedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBorderColorUndefinedTest { + PAGE_TAG: string = 'ScrollBorderColorUndefinedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBorderColorUndefinedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderRadiusAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderRadiusAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..42c117a4851e9295d37203b2c430730a3e980bce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderRadiusAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBorderRadiusAbnormalTest { + PAGE_TAG: string = 'ScrollBorderRadiusAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBorderRadiusAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderRadiusAllParamTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderRadiusAllParamTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ccd2a06b0d4d8e4392af39c3d54c2cf1b7acc550 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderRadiusAllParamTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBorderRadiusAllParamTest { + PAGE_TAG: string = 'ScrollBorderRadiusAllParamTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBorderRadiusAllParamTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderRadiusSingleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderRadiusSingleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..778bc14e48f294e8aed399aa7606197e14bdf0ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderRadiusSingleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBorderRadiusSingleTest { + PAGE_TAG: string = 'ScrollBorderRadiusSingleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBorderRadiusSingleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderWidthAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderWidthAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2d0880ef29e8fa949dc91161673fdff30cca90c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderWidthAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBorderWidthAbnormalTest { + PAGE_TAG: string = 'ScrollBorderWidthAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBorderWidthAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderWidthAllParamTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderWidthAllParamTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a2d7d1eb95a041bb9f0c78fc2eb11a2c593bd30 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderWidthAllParamTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBorderWidthAllParamTest { + PAGE_TAG: string = 'ScrollBorderWidthAllParamTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBorderWidthAllParamTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderWidthSingleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderWidthSingleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a8754517f13da2a883f86594410c9bf1d8e8f17d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBorderWidthSingleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBorderWidthSingleTest { + PAGE_TAG: string = 'ScrollBorderWidthSingleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBorderWidthSingleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6908f1834650d230a95e1c3132d1f71d52187b6e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBrightnessAbnormalTest { + PAGE_TAG: string = 'ScrollBrightnessAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBrightnessAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3010776fb226a59c77055a50be264bd0c1e749fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBrightnessMaxTest { + PAGE_TAG: string = 'ScrollBrightnessMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBrightnessMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eeba4bc2136497b452b0b5677450b09b824541a1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBrightnessMinTest { + PAGE_TAG: string = 'ScrollBrightnessMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBrightnessMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3fc42c8ea156e549c23e9bb28a4ddc4fe2750164 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollBrightnessTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollBrightnessTest { + PAGE_TAG: string = 'ScrollBrightnessTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollBrightnessTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollClipAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollClipAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..13c158cab1bbc2207aff843effee35d399154199 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollClipAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollClipAbnormalTest { + PAGE_TAG: string = 'ScrollClipAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollClipAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollClipFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollClipFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..92430e5ce241e887398906dbc1b64c8d78deb1f5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollClipFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollClipFalseTest { + PAGE_TAG: string = 'ScrollClipFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollClipFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollClipTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollClipTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b988fa33d99c63d2d367367ca35896e795bc906 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollClipTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollClipTrueTest { + PAGE_TAG: string = 'ScrollClipTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollClipTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseInOutTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseInOutTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed1ea3057a6133b840fd5785c4f7493187f9db3f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseInOutTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetEaseInOutTest { + PAGE_TAG: string = 'ScrollCurrentOffsetEaseInOutTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetEaseInOutTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseInTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseInTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d606c7b968b6044a9ac69da6c05b18f399f8876 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseInTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetEaseInTest { + PAGE_TAG: string = 'ScrollCurrentOffsetEaseInTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetEaseInTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseOutTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseOutTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d0f401a5e9af5fcdb860591ec4be4631b3ee0ca --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseOutTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetEaseOutTest { + PAGE_TAG: string = 'ScrollCurrentOffsetEaseOutTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetEaseOutTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f07e00ba7454f578526d7d478030ce707c61be5f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetEaseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetEaseTest { + PAGE_TAG: string = 'ScrollCurrentOffsetEaseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetEaseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetExtremeDecelerationTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetExtremeDecelerationTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..384e748447abcd8bf112bb56355e69ddf1b2200c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetExtremeDecelerationTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetExtremeDecelerationTest { + PAGE_TAG: string = 'ScrollCurrentOffsetExtremeDecelerationTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetExtremeDecelerationTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetFastOutLinearInTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetFastOutLinearInTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8746905575862049ce9fe4b0ee5c913f121bc889 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetFastOutLinearInTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetFastOutLinearInTest { + PAGE_TAG: string = 'ScrollCurrentOffsetFastOutLinearInTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetFastOutLinearInTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetFastOutSlowInTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetFastOutSlowInTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9a21e644c9c1869164d5006c931f78290a437e0c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetFastOutSlowInTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetFastOutSlowInTest { + PAGE_TAG: string = 'ScrollCurrentOffsetFastOutSlowInTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetFastOutSlowInTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetFrictionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetFrictionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8715837a9db9b4a067388c5963d1a65b4b625392 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetFrictionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetFrictionTest { + PAGE_TAG: string = 'ScrollCurrentOffsetFrictionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetFrictionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetLinearOutSlowInTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetLinearOutSlowInTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3081173c8d4741ada61aeba00fbcc911bbbf95df --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetLinearOutSlowInTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetLinearOutSlowInTest { + PAGE_TAG: string = 'ScrollCurrentOffsetLinearOutSlowInTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetLinearOutSlowInTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetLinearTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetLinearTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9fa2416b16dea85ee0557d3b483e4b4e7bd472b1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetLinearTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetLinearTest { + PAGE_TAG: string = 'ScrollCurrentOffsetLinearTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetLinearTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetRhythmTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetRhythmTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..16e2c5866d0cd44ac44fd1f50bb3b7ee82211a6d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetRhythmTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetRhythmTest { + PAGE_TAG: string = 'ScrollCurrentOffsetRhythmTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetRhythmTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetSharpTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetSharpTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..468d01cf7c3c117ea115f16f46f34ec825dcef3e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetSharpTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetSharpTest { + PAGE_TAG: string = 'ScrollCurrentOffsetSharpTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetSharpTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetSmoothTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetSmoothTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f3e238e84c9cf3097bbde9f8d8814c6a866ac20 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetSmoothTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetSmoothTest { + PAGE_TAG: string = 'ScrollCurrentOffsetSmoothTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetSmoothTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a3bac6ad186a6b51e7fda573a9b18602d0cb04b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollCurrentOffsetTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollCurrentOffsetTest { + PAGE_TAG: string = 'ScrollCurrentOffsetTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollCurrentOffsetTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEdgeEffectFadeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEdgeEffectFadeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cdfe6e7943d1ae7ff90bf2d1a9fbe2c529a5c8de --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEdgeEffectFadeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollEdgeEffectFadeTest { + PAGE_TAG: string = 'ScrollEdgeEffectFadeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollEdgeEffectFadeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEdgeEffectNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEdgeEffectNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0949e0eb86394e778a8c8f39533241e283fb63dd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEdgeEffectNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollEdgeEffectNoneTest { + PAGE_TAG: string = 'ScrollEdgeEffectNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollEdgeEffectNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEdgeEffectSpringTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEdgeEffectSpringTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..896dd6b9d76025e22d5a903c5f67ac3489e6ab62 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEdgeEffectSpringTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollEdgeEffectSpringTest { + PAGE_TAG: string = 'ScrollEdgeEffectSpringTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollEdgeEffectSpringTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEnableScrollInteractionAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEnableScrollInteractionAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bdc4eb097354b2d1cc69b525ca746b100842df9e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEnableScrollInteractionAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollEnableScrollInteractionAbnormalTest { + PAGE_TAG: string = 'ScrollEnableScrollInteractionAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollEnableScrollInteractionAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEnableScrollInteractionFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEnableScrollInteractionFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f5249cd158c257a1edca3d993fa21067b7a87705 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEnableScrollInteractionFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollEnableScrollInteractionFalseTest { + PAGE_TAG: string = 'ScrollEnableScrollInteractionFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollEnableScrollInteractionFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEnableScrollInteractionTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEnableScrollInteractionTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..19aa651360ac5efd9e19dc14b9072d7638510ce6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollEnableScrollInteractionTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollEnableScrollInteractionTrueTest { + PAGE_TAG: string = 'ScrollEnableScrollInteractionTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollEnableScrollInteractionTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollFrictionAbNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollFrictionAbNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee22c8ef4ffb79286f4f9673efbee17fab874150 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollFrictionAbNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollFrictionAbNormalTest { + PAGE_TAG: string = 'ScrollFrictionAbNormalTest'; + SCROLL_ID: string = 'Friction' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollFrictionAbNormalTest(this.PAGE_TAG,this.SCROLL_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollFrictionDefaultTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollFrictionDefaultTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9ea068992fa9b64167d80d26eef003ab49c189f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollFrictionDefaultTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollFrictionDefaultTest { + PAGE_TAG: string = 'ScrollFrictionDefaultTest'; + SCROLL_ID: string = 'Friction' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollFrictionDefaultTest(this.PAGE_TAG,this.SCROLL_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollFrictionNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollFrictionNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3bdb10c57ce8025781e3d05163ce6804f0e381b1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollFrictionNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollFrictionNormalTest { + PAGE_TAG: string = 'ScrollFrictionNormalTest'; + SCROLL_ID: string = 'Friction' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollFrictionNormalTest(this.PAGE_TAG,this.SCROLL_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fcee20df421b5bdccb1684d8db29426af332f190 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollHeightLargeTest { + PAGE_TAG: string = 'ScrollHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2fd2f5e69007328ad5ad9900dba431b372403d60 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollHeightTest { + PAGE_TAG: string = 'ScrollHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollHitTestBehaviorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollHitTestBehaviorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..09d36336e1883c8a2fae17f67367857bf2d2d18e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollHitTestBehaviorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollHitTestBehaviorTest { + PAGE_TAG: string = 'ScrollHitTestBehaviorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollHitTestBehaviorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b4fdbd52cba5a681209c44478f7e58ff57e61bac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientBottomTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollLinearGradientBottomTest { + PAGE_TAG: string = 'ScrollLinearGradientBottomTest'; + VALUE: string = 'ScrollLinearGradientBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollLinearGradientTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientLeftBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientLeftBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a017cfdad1715d03111284db48209cd9ab79e0b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientLeftBottomTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollLinearGradientLeftBottomTest { + PAGE_TAG: string = 'ScrollLinearGradientLeftBottomTest'; + VALUE: string = 'ScrollLinearGradientLeftBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollLinearGradientTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientLeftTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientLeftTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..22d513755d46d593ab7ae924b9809493cdd7a54a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientLeftTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollLinearGradientLeftTest { + PAGE_TAG: string = 'ScrollLinearGradientLeftTest'; + VALUE: string = 'ScrollLinearGradientLeftTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollLinearGradientTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientLeftTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientLeftTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f838006bb09c78ecafbddf32656a052a9eafbf05 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientLeftTopTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollLinearGradientLeftTopTest { + PAGE_TAG: string = 'ScrollLinearGradientLeftTopTest'; + VALUE: string = 'ScrollLinearGradientLeftTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollLinearGradientTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7af3a586098a7a259051fcaf4797ba0ed25830e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientNoneTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollLinearGradientNoneTest { + PAGE_TAG: string = 'ScrollLinearGradientNoneTest'; + VALUE: string = 'ScrollLinearGradientNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollLinearGradientTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientRightBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientRightBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..68ef5b77c094c5281fef9e80ac481f5a3a842a51 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientRightBottomTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollLinearGradientRightBottomTest { + PAGE_TAG: string = 'ScrollLinearGradientRightBottomTest'; + VALUE: string = 'ScrollLinearGradientRightBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollLinearGradientTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientRightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientRightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..595b151000b6e94fb156919d40a6c6b91ef55139 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientRightTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollLinearGradientRightTest { + PAGE_TAG: string = 'ScrollLinearGradientRightTest'; + VALUE: string = 'ScrollLinearGradientRightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollLinearGradientTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientRightTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientRightTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..422547e93b46cfef3b9e182d402c99f11b1aeef5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientRightTopTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollLinearGradientRightTopTest { + PAGE_TAG: string = 'ScrollLinearGradientRightTopTest'; + VALUE: string = 'ScrollLinearGradientRightTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollLinearGradientTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1074f46f65b9738aaf569f3aa45e8d5f7967b79c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollLinearGradientTopTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollLinearGradientTopTest { + PAGE_TAG: string = 'ScrollLinearGradientTopTest'; + VALUE: string = 'ScrollLinearGradientTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollLinearGradientTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollNestedScrollTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollNestedScrollTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4f355aee9019dc299637275f5c97eeabf986ed2b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollNestedScrollTest.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct ScrollNestedScrollTest { + PAGE_TAG: string = 'ScrollNestedScrollTest'; + @State testType: number = 0; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6600, (data: number) => { + render.scrollNestedScrollChangeTestType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6600) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollNestedScrollTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnAppearTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnAppearTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8156456eef06d7949ecb38f5132452ab8104220d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnAppearTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOnAppearTest { + PAGE_TAG: string = 'ScrollOnAppearTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOnAppearTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollEdgeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollEdgeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d4f157ff0bbe47b01bf58d31fa981d6da27b4ac3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollEdgeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOnScrollEdgeTest { + PAGE_TAG: string = 'ScrollOnScrollEdgeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOnScrollEdgeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollFrameBeginTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollFrameBeginTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b4f36e78620c61036c9dfcb45e01f354dbe3c0c6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollFrameBeginTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOnScrollFrameBeginTest { + PAGE_TAG: string = 'ScrollOnScrollFrameBeginTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOnScrollFrameBeginTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a758e6192f740ab462c8ae6753c124463bc01281 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollStartTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOnScrollStartTest { + PAGE_TAG: string = 'ScrollOnScrollStartTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOnScrollStartTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollStopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollStopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..553d0b6bcfb8cc6ff47d9d2a96b1075b61b0dff9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollStopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOnScrollStopTest { + PAGE_TAG: string = 'ScrollOnScrollStopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOnScrollStopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca602ec7847fa45245f3381b6c829f2f6cf6cc3b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOnScrollTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOnScrollTest { + PAGE_TAG: string = 'ScrollOnScrollTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOnScrollTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..84b56edef54814ab62c0b9c308d3f5e63f85566c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOpacityAbnormalTest { + PAGE_TAG: string = 'ScrollOpacityAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOpacityAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dde3ac3c572f90398c7af56a0ce29444a71440db --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOpacityMaxTest { + PAGE_TAG: string = 'ScrollOpacityMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOpacityMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityMiddleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityMiddleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fda892642de56cfd1f735f49b4fdb9260f059553 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityMiddleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOpacityMiddleTest { + PAGE_TAG: string = 'ScrollOpacityMiddleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOpacityMiddleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e7bcddcbff4b6ba468646ce64ec41a9172d88785 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOpacityMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOpacityMinTest { + PAGE_TAG: string = 'ScrollOpacityMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOpacityMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayBottomEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayBottomEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f441523a9ca8acd7c8198a07cc93ba6573fdb331 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayBottomEndTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOverlayBottomEndTest { + PAGE_TAG: string = 'ScrollOverlayBottomEndTest'; + VALUE: string = 'ScrollOverlayBottomEndTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOverlayTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayBottomStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayBottomStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..942e0ccb53ac950a5f7c31ea7e450c48f4132844 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayBottomStartTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOverlayBottomStartTest { + PAGE_TAG: string = 'ScrollOverlayBottomStartTest'; + VALUE: string = 'ScrollOverlayBottomStartTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOverlayTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..09e5a55b340328f0cd6ce2318d18c2aab17464b0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayBottomTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOverlayBottomTest { + PAGE_TAG: string = 'ScrollOverlayBottomTest'; + VALUE: string = 'ScrollOverlayBottomTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOverlayTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayCenterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayCenterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9967ea766840e669653f416a2e933e06c1bf06d8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayCenterTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOverlayCenterTest { + PAGE_TAG: string = 'ScrollOverlayCenterTest'; + VALUE: string = 'ScrollOverlayCenterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOverlayTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3d500fc582313beaa4a9a00a189b6839b082826 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayEndTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOverlayEndTest { + PAGE_TAG: string = 'ScrollOverlayEndTest'; + VALUE: string = 'ScrollOverlayEndTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOverlayTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5240c7520100504677fc718ca24eaf7e22df1e31 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayStartTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOverlayStartTest { + PAGE_TAG: string = 'ScrollOverlayStartTest'; + VALUE: string = 'ScrollOverlayStartTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOverlayTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayTopEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayTopEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c8581e96be2d0e871c811a7ae4f321c5e17acb1b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayTopEndTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOverlayTopEndTest { + PAGE_TAG: string = 'ScrollOverlayTopEndTest'; + VALUE: string = 'ScrollOverlayTopEndTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOverlayTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayTopStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayTopStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5aa4c4259dcb7412a5854b265ea5b024505221c1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayTopStartTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOverlayTopStartTest { + PAGE_TAG: string = 'ScrollOverlayTopStartTest'; + VALUE: string = 'ScrollOverlayTopStartTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOverlayTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayTopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayTopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..19018c508a39d4544e0f8746fdb854550424af6c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollOverlayTopTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollOverlayTopTest { + PAGE_TAG: string = 'ScrollOverlayTopTest'; + VALUE: string = 'ScrollOverlayTopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollOverlayTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollPageEnableFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollPageEnableFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1eedad8e9084e55c3afa7240632915d0e0ab4b00 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollPageEnableFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollPageEnableFalseTest { + PAGE_TAG: string = 'ScrollPageEnableFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollPageEnableFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollPageEnableTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollPageEnableTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fc6e1726582aaa26ecfc6bb8a83334aadfeac315 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollPageEnableTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollPageEnableTrueTest { + PAGE_TAG: string = 'ScrollPageEnableTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollPageEnableTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollPositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollPositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..36f8c6f7fe47aedb0d7e238c2f4586dce9fa69c7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollPositionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollPositionTest { + PAGE_TAG: string = 'ScrollPositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollPositionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollRotateAbNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollRotateAbNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..048d9810140fb63d6693a7fa452df236ea6c854f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollRotateAbNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollRotateAbNormalTest { + PAGE_TAG: string = 'ScrollRotateAbNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollRotateAbNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollRotateNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollRotateNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5037589a3d894bc898453a8dd1f87fa6f59f90be --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollRotateNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollRotateNormalTest { + PAGE_TAG: string = 'ScrollRotateNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollRotateNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollRotateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollRotateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1fd2a5716ddf163199ab6ab1bed04cf8ac31aea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollRotateTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollRotateTest { + PAGE_TAG: string = 'ScrollRotateTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollRotateTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateDefaultTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateDefaultTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7dcdc92c889c755889ac8e037be94cb297ed65b9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateDefaultTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollSaturateDefaultTest { + PAGE_TAG: string = 'ScrollSaturateDefaultTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollSaturateDefaultTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed09084fb279135d9a35a708f83887d6dca9f0eb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollSaturateMaxTest { + PAGE_TAG: string = 'ScrollSaturateMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollSaturateMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2b06edc5d9b5d5394f8578367260e4a538e43833 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollSaturateMinTest { + PAGE_TAG: string = 'ScrollSaturateMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollSaturateMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c498483755e2d282edcf38d1ddd791a216c0f6fb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollSaturateNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollSaturateNormalTest { + PAGE_TAG: string = 'ScrollSaturateNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollSaturateNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScaleAbNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScaleAbNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e4be448277fe5512d30279f8f1d253fa25f9e9fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScaleAbNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScaleAbNormalTest { + PAGE_TAG: string = 'ScrollScaleAbNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScaleAbNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScaleNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScaleNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1cc116063579949d92bbd0373fc3b319fc0ef60b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScaleNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScaleNormalTest { + PAGE_TAG: string = 'ScrollScaleNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScaleNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScaleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScaleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8779a23b850067c21d3996175df0ff7ed6b729f7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScaleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScaleTest { + PAGE_TAG: string = 'ScrollScaleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScaleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8af69eb89b9fb51a238b965162776293bb037fcb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollAbleAbnormalTest { + PAGE_TAG: string = 'ScrollScrollAbleAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollAbleAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleHorizontalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleHorizontalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca5980d4c125d2ff43ea842a2a3200acba558040 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleHorizontalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollAbleHorizontalTest { + PAGE_TAG: string = 'ScrollScrollAbleHorizontalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollAbleHorizontalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d1e9a40d739bd29fb316a9d18892133c58bab69 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollAbleNoneTest { + PAGE_TAG: string = 'ScrollScrollAbleNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollAbleNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ea38bc3c82fe92180c0738e48311374ba81c96a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollAbleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollAbleTest { + PAGE_TAG: string = 'ScrollScrollAbleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollAbleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c630f03943d81db03565f7ef041e3a1df970dc9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollBarAbnormalTest { + PAGE_TAG: string = 'ScrollScrollBarAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollBarAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarAutoTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarAutoTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c784bd5540b13a24029ef7590d3d11bf95b6d1f1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarAutoTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollBarAutoTest { + PAGE_TAG: string = 'ScrollScrollBarAutoTest'; + SCROLL_ID: string = 'ScrollBarAuto' + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollBarAutoTest(this.PAGE_TAG, this.SCROLL_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c4fda612a77a25c29f20c5699cd5a50e20f3e05 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollBarColorAbnormalTest { + PAGE_TAG: string = 'ScrollScrollBarColorAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollBarColorAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorBlackTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorBlackTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..64c30093978f7478f24e9b36b43d07cb92e6a2ae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorBlackTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollBarColorBlackTest { + PAGE_TAG: string = 'ScrollScrollBarColorBlackTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollBarColorBlackTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorNullTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorNullTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0297f5aa73f3b15a131b402e11fa91f57b8f8ca5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorNullTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollBarColorNullTest { + PAGE_TAG: string = 'ScrollScrollBarColorNullTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollBarColorNullTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a20ec1048bda10431f3a46e8b84864e158b2e2a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollBarColorTest { + PAGE_TAG: string = 'ScrollScrollBarColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollBarColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorUndefinedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorUndefinedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..af69de1726d31aa1ef90474b071514748fc5a049 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorUndefinedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollBarColorUndefinedTest { + PAGE_TAG: string = 'ScrollScrollBarColorUndefinedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollBarColorUndefinedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorWhiteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorWhiteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1be6334d5d40a6f078e3d127a05f4f778171b98f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarColorWhiteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollBarColorWhiteTest { + PAGE_TAG: string = 'ScrollScrollBarColorWhiteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollBarColorWhiteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarOffTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarOffTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d99456ea36a0bf6819280d58b5fd2c6d4b3ab95 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarOffTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollBarOffTest { + PAGE_TAG: string = 'ScrollScrollBarOffTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollBarOffTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarOnTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarOnTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8a7ab5b9cc672d6201b667c06fbbcfc2709b3a4f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollBarOnTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollBarOnTest { + PAGE_TAG: string = 'ScrollScrollBarOnTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollBarOnTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeBottomTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeBottomTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..217b53316ace1935827f13f46046dbdf51c68584 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeBottomTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollEdgeBottomTest { + PAGE_TAG: string = 'ScrollScrollEdgeBottomTest'; + EDGE_VALUE: number = 1; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollEdgeTest(this.PAGE_TAG, this.EDGE_VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..119adc3652cae3968833fb83d25c6e69b3c4ba96 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeEndTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollEdgeEndTest { + PAGE_TAG: string = 'ScrollScrollEdgeEndTest'; + EDGE_VALUE: number = 3; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollEdgeTest(this.PAGE_TAG, this.EDGE_VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d2dea8ab8848b471b2939a84354ad67c27f68734 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeStartTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollEdgeStartTest { + PAGE_TAG: string = 'ScrollScrollEdgeStartTest'; + EDGE_VALUE: number = 2; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollEdgeTest(this.PAGE_TAG, this.EDGE_VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..87154a01bb7bd787449570d9b172e6bf4326e450 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollEdgeTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollEdgeTest { + PAGE_TAG: string = 'ScrollScrollEdgeTest'; + EDGE_VALUE: number = 0; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollEdgeTest(this.PAGE_TAG, this.EDGE_VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapCenterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapCenterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb19ea2ce08c4318793aa3ffa1ab8440d02f9a00 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapCenterTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollSnapCenterTest { + PAGE_TAG: string = 'ScrollScrollSnapCenterTest'; + SCROLL_ID: string = 'ScrollSnap' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollSnapCenterTest(this.PAGE_TAG, this.SCROLL_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..35249abcaf2d4556c34a64214772eb9fc7b87387 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapEndTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollSnapEndTest { + PAGE_TAG: string = 'ScrollScrollSnapEndTest'; + SCROLL_ID: string = 'ScrollSnap' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollSnapEndTest(this.PAGE_TAG, this.SCROLL_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapLowerAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapLowerAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..771ae7d0cf0df5ad6425b568d1e38e38a75551d7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapLowerAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollSnapLowerAbnormalTest { + PAGE_TAG: string = 'ScrollScrollSnapLowerAbnormalTest'; + SCROLL_ID: string = 'ScrollSnap' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollSnapLowerAbnormalTest(this.PAGE_TAG, this.SCROLL_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..53bbf9a75012603ec33ce72c65c2faebfacc1b57 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollSnapNoneTest { + PAGE_TAG: string = 'ScrollScrollSnapNoneTest'; + SCROLL_ID: string = 'ScrollSnap' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollSnapNoneTest(this.PAGE_TAG, this.SCROLL_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ecc66f9a07920f2d90cbbe0b17a156479eea3a9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapStartTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollSnapStartTest { + PAGE_TAG: string = 'ScrollScrollSnapStartTest'; + SCROLL_ID: string = 'ScrollSnap' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollSnapStartTest(this.PAGE_TAG, this.SCROLL_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapUpperAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapUpperAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..05b02b462804fe2a72b283fbd40297c7d7ef03cb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollSnapUpperAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollSnapUpperAbnormalTest { + PAGE_TAG: string = 'ScrollScrollSnapUpperAbnormalTest'; + SCROLL_ID: string = 'ScrollSnap' + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollSnapUpperAbnormalTest(this.PAGE_TAG, this.SCROLL_ID); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseInOutTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseInOutTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5203c15d2c18660ab70e6c417eb8509ff44ae24 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseInOutTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToEaseInOutTest { + PAGE_TAG: string = 'ScrollScrollToEaseInOutTest'; + VALUE: string = 'ScrollScrollToEaseInOutTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseInTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseInTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d931177332a3dbda0dbd1dc8c1f7f48a43e6b57c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseInTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToEaseInTest { + PAGE_TAG: string = 'ScrollScrollToEaseInTest'; + VALUE: string = 'ScrollScrollToEaseInTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseOutTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseOutTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d6a03c80c29c272687a0cb3d146b2afecefda0ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseOutTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToEaseOutTest { + PAGE_TAG: string = 'ScrollScrollToEaseOutTest'; + VALUE: string = 'ScrollScrollToEaseOutTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e11c460602fa911ba50a4f2cf69d8c268761d0a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToEaseTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToEaseTest { + PAGE_TAG: string = 'ScrollScrollToEaseTest'; + VALUE: string = 'ScrollScrollToEaseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToExtremeDecelerationTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToExtremeDecelerationTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a359f729d99eab4ffd2d2788a36b81925e8e61fe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToExtremeDecelerationTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToExtremeDecelerationTest { + PAGE_TAG: string = 'ScrollScrollToExtremeDecelerationTest'; + VALUE: string = 'ScrollScrollToExtremeDecelerationTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToFastOutLinearInTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToFastOutLinearInTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..992a14b4430e9df771b0b0561e520ae011186125 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToFastOutLinearInTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToFastOutLinearInTest { + PAGE_TAG: string = 'ScrollScrollToFastOutLinearInTest'; + VALUE: string = 'ScrollScrollToFastOutLinearInTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToFastOutSlowInTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToFastOutSlowInTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b5ba19d60a0464d72d7e3a0e5a6d289b64569159 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToFastOutSlowInTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToFastOutSlowInTest { + PAGE_TAG: string = 'ScrollScrollToFastOutSlowInTest'; + VALUE: string = 'ScrollScrollToFastOutSlowInTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToFrictionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToFrictionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..69d03b79445d739674bceefdff373c42ce194c4c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToFrictionTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToFrictionTest { + PAGE_TAG: string = 'ScrollScrollToFrictionTest'; + VALUE: string = 'ScrollScrollToFrictionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToLinearOutSlowInTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToLinearOutSlowInTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dc9196283a1c6500c6b8f8f58918fbc4cb1135e0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToLinearOutSlowInTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToLinearOutSlowInTest { + PAGE_TAG: string = 'ScrollScrollToLinearOutSlowInTest'; + VALUE: string = 'ScrollScrollToLinearOutSlowInTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToLinearTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToLinearTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6d1719e2a3072ce1dd8ecdf5d9116086122e6621 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToLinearTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToLinearTest { + PAGE_TAG: string = 'ScrollScrollToLinearTest'; + VALUE: string = 'ScrollScrollToLinearTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToRhythmTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToRhythmTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e31242641beeaae445ae6e37941a93fc8b0bc073 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToRhythmTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToRhythmTest { + PAGE_TAG: string = 'ScrollScrollToRhythmTest'; + VALUE: string = 'ScrollScrollToRhythmTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToSharpTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToSharpTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2f5364850dd91ced1c3094e1fefd87462b20c75c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToSharpTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToSharpTest { + PAGE_TAG: string = 'ScrollScrollToSharpTest'; + VALUE: string = 'ScrollScrollToSharpTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToSmoothTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToSmoothTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b17b96071f65a8678ee0d7a928abf68fa7b4beb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollScrollToSmoothTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollScrollToSmoothTest { + PAGE_TAG: string = 'ScrollScrollToSmoothTest'; + VALUE: string = 'ScrollScrollToSmoothTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollScrollToTest(this.PAGE_TAG, this.VALUE); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowBigTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowBigTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2353980de2fa9a16d0d9b856cb344904f528ea56 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowBigTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollShadowBigTest { + PAGE_TAG: string = 'ScrollShadowBigTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollShadowBigTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowFloatLittleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowFloatLittleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f0c08caea88ac1ccf8f0eca21531991607c8b3b7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowFloatLittleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollShadowFloatLittleTest { + PAGE_TAG: string = 'ScrollShadowFloatLittleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollShadowFloatLittleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowFloatMiddleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowFloatMiddleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..500c7933d81ebd1365a5dc57cad872338706cbe0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowFloatMiddleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollShadowFloatMiddleTest { + PAGE_TAG: string = 'ScrollShadowFloatMiddleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollShadowFloatMiddleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowLittleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowLittleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f474d79a3099c4443d8ced722e5b6c5696ef47e0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowLittleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollShadowLittleTest { + PAGE_TAG: string = 'ScrollShadowLittleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollShadowLittleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowMiddleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowMiddleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce0f7aa0d0b6486990b7ddc417ea9bff63cab216 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowMiddleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollShadowMiddleTest { + PAGE_TAG: string = 'ScrollShadowMiddleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollShadowMiddleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0ba1baf1b86fc8f3eb6a25d6ae41f6630d0d0391 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollShadowMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollShadowMinTest { + PAGE_TAG: string = 'ScrollShadowMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollShadowMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollTranslateDefaultTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollTranslateDefaultTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cc1772cbb12191dde7721b7ca200156f39bdd8a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollTranslateDefaultTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollTranslateDefaultTest { + PAGE_TAG: string = 'ScrollTranslateDefaultTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollTranslateDefaultTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollTranslateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollTranslateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6460e816d1123e6251c8571d9d8ab36e48848321 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollTranslateTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollTranslateTest { + PAGE_TAG: string = 'ScrollTranslateTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollTranslateTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e3822f32820cde60ae2b476201ed297304435929 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollWidthLargeTest { + PAGE_TAG: string = 'ScrollWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e428ffa9743f0957748ec07f3f3dd019cab388ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/scroll/ScrollWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ScrollWidthTest { + PAGE_TAG: string = 'ScrollWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.scrollWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderBlockColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderBlockColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8fff933799f6a2887855215d8823d48cbce4ac39 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderBlockColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderBlockColorTest { + PAGE_TAG: string = 'SliderBlockColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderBlockColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderBlockStyleAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderBlockStyleAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f73e86a4df2c8a723dc1573ba294b693115bb71 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderBlockStyleAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderBlockStyleAbnormalTest { + PAGE_TAG: string = 'SliderBlockStyleAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderBlockStyleAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderBlockStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderBlockStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d60e539b62bdd983c2cba61fc9bce503101e0ae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderBlockStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderBlockStyleTest { + PAGE_TAG: string = 'SliderBlockStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderBlockStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderDirectionAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderDirectionAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..457acb1be16bfad42ab0fb4e78713b9d5560ff34 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderDirectionAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderDirectionAbnormalTest { + PAGE_TAG: string = 'SliderDirectionAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderDirectionAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderDirectionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderDirectionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddadb5cb9aeccd8e123cd04327a40a43e9589a98 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderDirectionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderDirectionTest { + PAGE_TAG: string = 'SliderDirectionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderDirectionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3ae25da8a56e506f56815262bc161984ee0c3f9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderEnabledTest { + PAGE_TAG: string = 'SliderEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6410f2f9fcfcfc06e056448b3f41eea4d3db43b1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderHeightLargeTest { + PAGE_TAG: string = 'SliderHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7681c59895145dc79f3d729ed14a8c6123efdac1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderHeightTest { + PAGE_TAG: string = 'SliderHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..70cf439e64713d5542698c57c5ef20c47c6fcec5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderMaxAbnormalTest { + PAGE_TAG: string = 'SliderMaxAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderMaxAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxEqualMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxEqualMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bfb84f98ca4d42dae4bcb88a138bf8cf23aad13c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxEqualMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderMaxEqualMinTest { + PAGE_TAG: string = 'SliderMaxEqualMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderMaxEqualMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..46fd812867d9c2efdff54885f40766102bcaf23e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderMaxLargeTest { + PAGE_TAG: string = 'SliderMaxLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderMaxLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..26f17e67a087044b385d1650584437239966a00d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMaxTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderMaxTest { + PAGE_TAG: string = 'SliderMaxTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderMaxTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMinAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMinAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..948a28ec704bba5f17d97b13b324e8f1c23f2e3b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMinAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderMinAbnormalTest { + PAGE_TAG: string = 'SliderMinAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderMinAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMinLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMinLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..541ca3d274b10dfb91f29ba9063f4d82f58c3cb0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMinLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderMinLargeTest { + PAGE_TAG: string = 'SliderMinLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderMinLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMinTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMinTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a378053d4c72fec99435c9bff832aca5f2a19ba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderMinTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderMinTest { + PAGE_TAG: string = 'SliderMinTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderMinTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderOnChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderOnChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..71fafa7991967757963fdb144210d030d5357d4b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderOnChangeTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderOnChangeTest { + PAGE_TAG: string = 'SliderOnChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderOnChangeTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderReverseAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderReverseAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a42fc8ec061e3f066a177d4414517d851717bdd9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderReverseAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderReverseAbnormalTest { + PAGE_TAG: string = 'SliderReverseAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderReverseAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderReverseLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderReverseLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2253cc1686ecf0d739899b70de1bfc71168a8f8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderReverseLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderReverseLargeTest { + PAGE_TAG: string = 'SliderReverseLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderReverseLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderReverseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderReverseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..618aa837e307665c29c6e67bfe1a03fc34df4ab4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderReverseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderReverseTest { + PAGE_TAG: string = 'SliderReverseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderReverseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderSelectedColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderSelectedColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..984752e7212472053bf4ab3a1a0855175162cef8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderSelectedColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderSelectedColorTest { + PAGE_TAG: string = 'SliderSelectedColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderSelectedColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderShowStepsAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderShowStepsAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0cebbed67e002292ec15edbc5582e2709007bea7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderShowStepsAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderShowStepsAbnormalTest { + PAGE_TAG: string = 'SliderShowStepsAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderShowStepsAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderShowStepsTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderShowStepsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c505b6d1f32232ac0861f6d0b46664f95a8621c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderShowStepsTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderShowStepsTest { + PAGE_TAG: string = 'SliderShowStepsTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderShowStepsTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f60f77f5ae4e748de1143ce6d48f198620f1072d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderStepAbnormalTest { + PAGE_TAG: string = 'SliderStepAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderStepAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c5f348b6444ea0b2441b6879cfe48765e5589635 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderStepLargeTest { + PAGE_TAG: string = 'SliderStepLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderStepLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cef1419e58e10af939571f3c13c4cbc233ea8a79 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderStepTest { + PAGE_TAG: string = 'SliderStepTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderStepTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepUnevenTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepUnevenTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cc72450f7c521d783389b5e5c157fdd81a85e533 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStepUnevenTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderStepUnevenTest { + PAGE_TAG: string = 'SliderStepUnevenTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderStepUnevenTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStyleAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStyleAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..34317deea30a43a9d88c023a60095f9cadfd9f66 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStyleAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderStyleAbnormalTest { + PAGE_TAG: string = 'SliderStyleAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderStyleAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStyleLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStyleLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..029d0891f8c7933c21a71080bee57296a2b05d2a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStyleLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderStyleLargeTest { + PAGE_TAG: string = 'SliderStyleLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderStyleLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab30a36e43c32446f2eb4f005285946a9bc79fd5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderStyleTest { + PAGE_TAG: string = 'SliderStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderTrackColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderTrackColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..599ae69d81ab8c58ff117d7229619d7560a14d98 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderTrackColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderTrackColorTest { + PAGE_TAG: string = 'SliderTrackColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderTrackColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderValueAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderValueAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..36261d73752a689479c821c0cf29138566636ba5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderValueAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderValueAbnormalTest { + PAGE_TAG: string = 'SliderValueAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderValueAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderValueLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderValueLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..70948ebb2812c01cb7f710957381784c14f55f25 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderValueLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderValueLargeTest { + PAGE_TAG: string = 'SliderValueLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderValueLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderValueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderValueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..81823d9c0fd024e30862b4f5f3429d594223394b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderValueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderValueTest { + PAGE_TAG: string = 'SliderValueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderValueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..56ce7ad17d11afcfba2167210b7d6a7e7a92d726 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderWidthLargeTest { + PAGE_TAG: string = 'SliderWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a8e1e330a017bfa589eccd974ae2ca5623902b7d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/slider/SliderWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SliderWidthTest { + PAGE_TAG: string = 'SliderWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.sliderWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanDecorationTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanDecorationTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..79e2f66fba765e55ea3ac959e1820a3d9ef62061 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanDecorationTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SpanDecorationTest { + PAGE_TAG: string = 'SpanDecorationTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.spanDecorationTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..38a6ab8347a9c4a396458182d09d0b1428dea220 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SpanFontColorTest { + PAGE_TAG: string = 'SpanFontColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.spanFontColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontSizeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontSizeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..65abd2d73c42491aa792057e45ca5b910b4ea80e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontSizeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SpanFontSizeTest { + PAGE_TAG: string = 'SpanFontSizeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.spanFontSizeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5bffcffe9a7781e6ec0dd4fd80f574584ec4336 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SpanFontStyleTest { + PAGE_TAG: string = 'SpanFontStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.spanFontStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontWeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontWeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae4a5ec774aaaf7721f747e54493c21ee8fe9cc2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanFontWeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SpanFontWeightTest { + PAGE_TAG: string = 'SpanFontWeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.spanFontWeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanLetterSpacingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanLetterSpacingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7782dd18d60fab89cb8c32240c57ff63e68ef747 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanLetterSpacingTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SpanLetterSpacingTest { + PAGE_TAG: string = 'SpanLetterSpacingTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.spanLetterSpacingTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanLineHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanLineHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..70511272efe7d5702434e1825342dabdd018e481 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanLineHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SpanLineHeightTest { + PAGE_TAG: string = 'SpanLineHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.spanLineHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanTextCaseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanTextCaseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..775ba917392fafadf7acbef207e419ba2fdab0b8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/span/SpanTextCaseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SpanTextCaseTest { + PAGE_TAG: string = 'SpanTextCaseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.spanTextCaseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackAlignTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackAlignTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3bb857394a738d2000189f832713a145e0adbf6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackAlignTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackAlignTest { + PAGE_TAG: string = 'StackAlignTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackAlignTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundBlurStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundBlurStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8d946f3cb463e91fb455ee7b160de715d37903c0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundBlurStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackBackgroundBlurStyleTest { + PAGE_TAG: string = 'StackBackgroundBlurStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackBackgroundBlurStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d83a1fdd2f9756b77431f6c9ce073e5eff978bbc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackBackgroundColorTest { + PAGE_TAG: string = 'StackBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundImagePositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundImagePositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb44f3a5edc7214a068d69e6482fddb5a3cdebd7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundImagePositionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackBackgroundImagePositionTest { + PAGE_TAG: string = 'StackBackgroundImagePositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackBackgroundImagePositionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundImageSizeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundImageSizeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6823fb682648912a16d322569a282218ec480b68 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundImageSizeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackBackgroundImageSizeTest { + PAGE_TAG: string = 'StackBackgroundImageSizeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackBackgroundImageSizeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundImageTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundImageTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..36485b2dac2b9de032e56ae2fe7203b0bc12d3b1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBackgroundImageTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackBackgroundImageTest { + PAGE_TAG: string = 'StackBackgroundImageTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackBackgroundImageTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..25f95f9283bcbf2b8370a5855a376fe4f4089149 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackBorderColorTest { + PAGE_TAG: string = 'StackBorderColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackBorderColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderRadiusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderRadiusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0dcb7c95b22560a7ccf7e2794bcccdb43531e322 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderRadiusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackBorderRadiusTest { + PAGE_TAG: string = 'StackBorderRadiusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackBorderRadiusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..09aa8a2b3df1c52385113d09cb129c15ad450754 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackBorderStyleTest { + PAGE_TAG: string = 'StackBorderStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackBorderStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..612d65e47d9f690988cf2b8a3a8618e6a8fa2f82 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBorderWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackBorderWidthTest { + PAGE_TAG: string = 'StackBorderWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackBorderWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBrightnessTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBrightnessTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6dc494c7d580debb5e4bc7acfbe479ae40ec751 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackBrightnessTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackBrightnessTest { + PAGE_TAG: string = 'StackBrightnessTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackBrightnessTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackClipTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackClipTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..42ba7ff2afe4e9946021dc0d63d896aeb360cdf0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackClipTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackClipTest { + PAGE_TAG: string = 'StackClipTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackClipTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b4e94241903d06cb10293200be802cb268bfca8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackHeightLargeTest { + PAGE_TAG: string = 'StackHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfe0662d6ade9960dfe5d7cb83498ac1419ee728 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackHeightTest { + PAGE_TAG: string = 'StackHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackHitTestBehaviorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackHitTestBehaviorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..841e48a5ae69b1c84453ad3d5c6eeeb8122bea75 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackHitTestBehaviorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackHitTestBehaviorTest { + PAGE_TAG: string = 'StackHitTestBehaviorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackHitTestBehaviorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackIdTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackIdTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2fb25678b39f558aa73780a843f9f1d6d736fa96 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackIdTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackIdTest { + PAGE_TAG: string = 'StackIdTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackIdTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackLinearGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackLinearGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..769127b73021cd7e45a0816518d4a4ebbb08386c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackLinearGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackLinearGradientTest { + PAGE_TAG: string = 'StackLinearGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackLinearGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackMarginTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackMarginTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e74c084c3b1a72243681cc6403466ec1088424b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackMarginTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackMarginTest { + PAGE_TAG: string = 'StackMarginTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackMarginTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackOnAreaChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackOnAreaChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c4f29db986282246ba2aaa0661c91f1d2ce380d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackOnAreaChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackOnAreaChangeTest { + PAGE_TAG: string = 'StackOnAreaChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackOnAreaChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackOnTouchTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackOnTouchTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8ed540be015147e6f29089233fc5d9cbf9c1f764 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackOnTouchTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackOnTouchTest { + PAGE_TAG: string = 'StackOnTouchTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackOnTouchTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackOpacityTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackOpacityTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a196d0462864251cddd41d9504ed852f91fba054 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackOpacityTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackOpacityTest { + PAGE_TAG: string = 'StackOpacityTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackOpacityTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackPositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackPositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fa133da44587ac48f7dd35aef34345b33fbf7c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackPositionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackPositionTest { + PAGE_TAG: string = 'StackPositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackPositionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackRotateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackRotateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..578248a4def0088c1591b999245857b9ddaef80d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackRotateTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackRotateTest { + PAGE_TAG: string = 'StackRotateTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackRotateTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackSaturateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackSaturateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cc89eacfd477c197a63b874fb675b05a922949be --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackSaturateTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackSaturateTest { + PAGE_TAG: string = 'StackSaturateTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackSaturateTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackScaleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackScaleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6d9c6c9480b46514c5a139cf009fac9db326b61 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackScaleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackScaleTest { + PAGE_TAG: string = 'StackScaleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackScaleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff0d76ef604da6ad4f0db54b09f78fce0027cc5c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackShadowTest { + PAGE_TAG: string = 'StackShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackTransformTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackTransformTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..551c544e3281586c7c5ec6b074ead42178d833fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackTransformTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackTransformTest { + PAGE_TAG: string = 'StackTransformTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackTransformTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackTransitionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackTransitionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..741c006a4c648f52fe9225b94b9e96b1d734ae4b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackTransitionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackTransitionTest { + PAGE_TAG: string = 'StackTransitionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackTransitionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackTranslateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackTranslateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e54381e10f8700853aef78c31f493b15b78c368d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackTranslateTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackTranslateTest { + PAGE_TAG: string = 'StackTranslateTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackTranslateTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c863473feec1a83ab4b4fa2ee3c5ebe94077ae7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackWidthLargeTest { + PAGE_TAG: string = 'StackWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5176069d8acee2ac52905d5ec958aa3503718a67 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/stack/StackWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct StackWidthTest { + PAGE_TAG: string = 'StackWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.stackWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperAutoPlayTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperAutoPlayTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ccbd049594034bfd5421fac109eed86fda77a15 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperAutoPlayTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAutoPlayTest { + PAGE_TAG: string = 'SwiperAutoPlayTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAutoPlayTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperAutoPlayToEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperAutoPlayToEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e189f42063eab405d17db99d2e32aa1a6e159b0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperAutoPlayToEndTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperAutoPlayToEndTest { + PAGE_TAG: string = 'SwiperAutoPlayToEndTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperAutoPlayToEndTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..95c196dae07c660101266fa5018e654e584da516 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperBackgroundColorTest { + PAGE_TAG: string = 'SwiperBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperBackgroundImageTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperBackgroundImageTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..59ee1aa2777d2771270963fbddd48ab182b32b87 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperBackgroundImageTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperBackgroundImageTest { + PAGE_TAG: string = 'SwiperBackgroundImageTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperBackgroundImageTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperCachedCountTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperCachedCountTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a19be857a3fa9fa2e50f5bdb474c880fec4d810 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperCachedCountTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperCachedCountTest { + PAGE_TAG: string = 'SwiperCachedCountTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperCachedCountTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperClipTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperClipTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..23b4b2afe42d3f0d8454d0dce70f8a5672d33250 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperClipTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperClipTest { + PAGE_TAG: string = 'SwiperClipTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperClipTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperCurveTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperCurveTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0141542742c737a6505e910a814a6acd3e8b3d8a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperCurveTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperCurveTest { + PAGE_TAG: string = 'SwiperCurveTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperCurveTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDisableSwipeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDisableSwipeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c814cd14d038badd00e6bd3629a4bcd90b5cc8b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDisableSwipeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperDisableSwipeTest { + PAGE_TAG: string = 'SwiperDisableSwipeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperDisableSwipeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDisplayArrowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDisplayArrowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6425d023e153ae8e09b230f1dc847c41892bec33 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDisplayArrowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperDisplayArrowTest { + PAGE_TAG: string = 'SwiperDisplayArrowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperDisplayArrowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDisplayCountTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDisplayCountTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..066c99e2f7760f0c18c88b4459a56d895bacc997 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDisplayCountTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperDisplayCountTest { + PAGE_TAG: string = 'SwiperDisplayCountTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperDisplayCountTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDurationTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDurationTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d5fdd47c6c49ddf16b64e8d868f199e83d990ae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperDurationTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperDurationTest { + PAGE_TAG: string = 'SwiperDurationTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperDurationTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..445871bd7f1c66f9d6b03e102859fb3cf495dbc1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperHeightLargeTest { + PAGE_TAG: string = 'SwiperHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f6c195577fe65f6d4380523b05379a3d0be9b451 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperHeightTest { + PAGE_TAG: string = 'SwiperHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperIndexTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperIndexTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..49dbb48dbd7faa70687a62ac0cbb91f126cdf0f1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperIndexTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperIndexTest { + PAGE_TAG: string = 'SwiperIndexTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperIndexTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperIndicatorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperIndicatorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0927b062400cadbf8ecae882749146b10ef6e453 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperIndicatorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperIndicatorTest { + PAGE_TAG: string = 'SwiperIndicatorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperIndicatorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperIntervalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperIntervalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5bb9762847aea6ac1ea6e47ef1b900e636818b0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperIntervalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperIntervalTest { + PAGE_TAG: string = 'SwiperIntervalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperIntervalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperItemSpaceTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperItemSpaceTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3b3c2acfc301505ab9d20d8bf952ae3d64723a3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperItemSpaceTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperItemSpaceTest { + PAGE_TAG: string = 'SwiperItemSpaceTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperItemSpaceTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperLoopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperLoopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b0dcfe0546023328b4ba3e6b67130f22f5335998 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperLoopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperLoopTest { + PAGE_TAG: string = 'SwiperLoopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperLoopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperPositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperPositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a746440feffa952a45af8123a4ea3d4b7ce48b17 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperPositionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperPositionTest { + PAGE_TAG: string = 'SwiperPositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperPositionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperVerticalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperVerticalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7862fdabfc090adf38d979064ce6ac03d3ffed2f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperVerticalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperVerticalTest { + PAGE_TAG: string = 'SwiperVerticalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperVerticalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..128382ad8ab3822b28855a8ed5ed60a7658b41f1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperWidthLargeTest { + PAGE_TAG: string = 'SwiperWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0db9241a42ce88d43a16e09f8c851180f8034223 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/swiper/SwiperWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct SwiperWidthTest { + PAGE_TAG: string = 'SwiperWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.swiperWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextAlignRulesTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextAlignRulesTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8a2c818476299747549128d5f33c920b037e92e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextAlignRulesTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAlignRulesTest { + PAGE_TAG: string = 'TextAlignRulesTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAlignRulesTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextAlignTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextAlignTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec89e77fbfe595657543fba811b0e1b2a2897f3c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextAlignTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAlignTest { + PAGE_TAG: string = 'TextAlignTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAlignTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..73e0f77dd2b416645529c7dc93bdbd98e07c0a7d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextBackgroundColorTest { + PAGE_TAG: string = 'TextBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBackgroundImageTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBackgroundImageTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..85e1d33d40bec6739ecaa8171e637c6aed6f4b37 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBackgroundImageTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextBackgroundImageTest { + PAGE_TAG: string = 'TextBackgroundImageTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textBackgroundImageTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBaselineOffsetTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBaselineOffsetTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a869317b1d7b2b5817b813ca4ae39bfbecbd6cd3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBaselineOffsetTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextBaselineOffsetTest { + PAGE_TAG: string = 'TextBaselineOffsetTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textBaselineOffsetTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBorderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBorderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0039adf95de01fa9d98c5054265c4395a6626908 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBorderColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextBorderColorTest { + PAGE_TAG: string = 'TextBorderColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textBorderColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBorderRadiusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBorderRadiusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..21b4e13047ab8ce3f3a8e0c29b50ac197526ee4b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBorderRadiusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextBorderRadiusTest { + PAGE_TAG: string = 'TextBorderRadiusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textBorderRadiusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBorderWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBorderWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a2a88647900df721081157610075c6949d9963bd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextBorderWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextBorderWidthTest { + PAGE_TAG: string = 'TextBorderWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textBorderWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextClipTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextClipTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dea9be0466d45d821912111a3bfabd1d04f231b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextClipTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextClipTest { + PAGE_TAG: string = 'TextClipTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textClipTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextCopyOptionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextCopyOptionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ecedc0084096378e01994dafd6fccc2a8718b3b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextCopyOptionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextCopyOptionTest { + PAGE_TAG: string = 'TextCopyOptionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textCopyOptionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextDecorationTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextDecorationTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..99f3a1c9ee129773dc5ae02fc7c39f988f443867 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextDecorationTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextDecorationTest { + PAGE_TAG: string = 'TextDecorationTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textDecorationTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f1e8f898ce1a7cc4a4f673a553ba14f9718c33d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextEnabledTest { + PAGE_TAG: string = 'TextEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..de43ac8691c04620dc8e122cd3864d6ae41bf1b3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextFontColorTest { + PAGE_TAG: string = 'TextFontColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textFontColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontFamilyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontFamilyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..13eeb5e24e7b93d293cf7d67c7f77f3b7697d141 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontFamilyTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextFontFamilyTest { + PAGE_TAG: string = 'TextFontFamilyTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textFontFamilyTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontSizeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontSizeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d183b003b178e6d31b61822b697c12be7799db84 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontSizeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextFontSizeTest { + PAGE_TAG: string = 'TextFontSizeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textFontSizeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b8aef18d561093489cd78bdaf56a7cc6dd5e636 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextFontStyleTest { + PAGE_TAG: string = 'TextFontStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textFontStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e25296f462e8689b2439df22e4b32a7a65301ac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextFontTest { + PAGE_TAG: string = 'TextFontTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textFontTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontWeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontWeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d02d2d216dcebafe7986778b73833c6bcf1185da --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextFontWeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextFontWeightTest { + PAGE_TAG: string = 'TextFontWeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textFontWeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextHeightAdaptivePolicyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextHeightAdaptivePolicyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d4e0347de48eb38e27c87d57039276947cdc1907 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextHeightAdaptivePolicyTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextHeightAdaptivePolicyTest { + PAGE_TAG: string = 'TextHeightAdaptivePolicyTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textHeightAdaptivePolicyTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfdaf40cd28a57073270f59b52779feef81a5993 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextHeightLargeTest { + PAGE_TAG: string = 'TextHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0a54fbdd9cc0920a22a59bd37a9562bc5bef85c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextHeightTest { + PAGE_TAG: string = 'TextHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLetterSpacingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLetterSpacingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..84b657ac8ecd0a40da2d4453417cb83451befd57 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLetterSpacingTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextLetterSpacingTest { + PAGE_TAG: string = 'TextLetterSpacingTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textLetterSpacingTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLineBreakStrategyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLineBreakStrategyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d27fdfb4f5c6ee7d29f68b3aeb9de21b29de99e2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLineBreakStrategyTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextLineBreakStrategyTest { + PAGE_TAG: string = 'TextLineBreakStrategyTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textLineBreakStrategyTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLineHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLineHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..256d7f6bc0a0c45814fae2e26f5a54326c9ea7e2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLineHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextLineHeightTest { + PAGE_TAG: string = 'TextLineHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textLineHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLinearGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLinearGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..313d6b177b0a577a0919593fd7925f0dc88a0193 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextLinearGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextLinearGradientTest { + PAGE_TAG: string = 'TextLinearGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textLinearGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMaskTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMaskTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..60e8ff233a868e483902ffc1da385581e4f74076 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMaskTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextMaskTest { + PAGE_TAG: string = 'TextMaskTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textMaskTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMaxFontSizeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMaxFontSizeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec55b813f84404c2e7f4c53c6004f153825c43cc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMaxFontSizeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextMaxFontSizeTest { + PAGE_TAG: string = 'TextMaxFontSizeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textMaxFontSizeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMaxLinesTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMaxLinesTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a92866891462b12fcb0f6bc2afc2f448c5cb523e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMaxLinesTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextMaxLinesTest { + PAGE_TAG: string = 'TextMaxLinesTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textMaxLinesTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMinFontSizeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMinFontSizeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e109a6ccaa662ca1485ebb6ec46f78f2ae9d27ac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextMinFontSizeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextMinFontSizeTest { + PAGE_TAG: string = 'TextMinFontSizeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textMinFontSizeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextOffsetTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextOffsetTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..88980a77f7421f126f09511c0dbc02e9a5941271 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextOffsetTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextOffsetTest { + PAGE_TAG: string = 'TextOffsetTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textOffsetTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextOpacityTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextOpacityTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..75aff0539cc15241b010da56970f7f8590c140ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextOpacityTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextOpacityTest { + PAGE_TAG: string = 'TextOpacityTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textOpacityTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextOverlayTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextOverlayTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fe53584393667fd5d3e402f9fa3becc2a537ca5e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextOverlayTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextOverlayTest { + PAGE_TAG: string = 'TextOverlayTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textOverlayTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextPaddingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextPaddingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..48fefc5be497a2dd364605c139fb714070f1e451 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextPaddingTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPaddingTest { + PAGE_TAG: string = 'TextPaddingTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPaddingTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextPositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextPositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba294fde1388e8f05cfd9208c7a32d6d8747a0a3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextPositionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPositionTest { + PAGE_TAG: string = 'TextPositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPositionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextRadialGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextRadialGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d50bf6b5ecf753f14d9390244d239ce60d90f6da --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextRadialGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextRadialGradientTest { + PAGE_TAG: string = 'TextRadialGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textRadialGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextScaleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextScaleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cedf1b48963001ceedd9a25061ab47f72299abf9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextScaleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextScaleTest { + PAGE_TAG: string = 'TextScaleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textScaleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cbe61385f6523e2f64e0d4f6b146d6bfcdd6d131 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextShadowTest { + PAGE_TAG: string = 'TextShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextSweepGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextSweepGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ac065afe645f0994914d637b5d5f6cc2bda9a61 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextSweepGradientTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextSweepGradientTest { + PAGE_TAG: string = 'TextSweepGradientTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textSweepGradientTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextAlignTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextAlignTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8b1ecdc27e8c9541ea02bcd1b06cc8d5ae524ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextAlignTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextTextAlignTest { + PAGE_TAG: string = 'TextTextAlignTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textTextAlignTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextCaseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextCaseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9d2167ec29332b498a957a2dd03d3311a74ab78 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextCaseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextTextCaseTest { + PAGE_TAG: string = 'TextTextCaseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textTextCaseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextIndentTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextIndentTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..015093e86a0fb3aecfc1756a480df77407b1c395 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextIndentTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextTextIndentTest { + PAGE_TAG: string = 'TextTextIndentTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textTextIndentTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextOverflowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextOverflowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..069598acd27389c8dad7cd0a04446fe96463a42d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextOverflowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextTextOverflowTest { + PAGE_TAG: string = 'TextTextOverflowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textTextOverflowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextShadowTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextShadowTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa72717b95935ee41d1a8cf4e9ae923b679b2d64 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTextShadowTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextTextShadowTest { + PAGE_TAG: string = 'TextTextShadowTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textTextShadowTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTransformTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTransformTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..18dbb90f255d5233b04297a2889004a17eacf809 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextTransformTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextTransformTest { + PAGE_TAG: string = 'TextTransformTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textTransformTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextVisibilityTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextVisibilityTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d379ca16d17907487604c8d30f76f5aef5209226 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextVisibilityTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextVisibilityTest { + PAGE_TAG: string = 'TextVisibilityTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textVisibilityTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4cb972ec791f4eed242d53b2b9ac915f9f7d2c66 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextWidthLargeTest { + PAGE_TAG: string = 'TextWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cdf150f4875dd74ae743c5b36d376ebe04239eff --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/text/TextWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextWidthTest { + PAGE_TAG: string = 'TextWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBackgroundColorBlackTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBackgroundColorBlackTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fddbfd5c0a39f2e461c85ca59db507bceb403d47 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBackgroundColorBlackTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaBackgroundColorBlackTest { + PAGE_TAG: string = 'TextAreaBackgroundColorBlackTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaBackgroundColorBlackTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9dc910c3b2d917b102363558d9fa4c3814dcd603 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaBackgroundColorTest { + PAGE_TAG: string = 'TextAreaBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBackgroundColorWhiteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBackgroundColorWhiteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..534774baec24cd92b30e80a2c1d690c5c7e8cd53 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBackgroundColorWhiteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaBackgroundColorWhiteTest { + PAGE_TAG: string = 'TextAreaBackgroundColorWhiteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaBackgroundColorWhiteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBorderRadiusAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBorderRadiusAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7264ece9226c6b74340ff0f157684d6298e512e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBorderRadiusAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaBorderRadiusAbnormalTest { + PAGE_TAG: string = 'TextAreaBorderRadiusAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaBorderRadiusAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBorderRadiusAllParamTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBorderRadiusAllParamTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..db83d4c9cca39d2b7866c882253bfb4b90b085de --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBorderRadiusAllParamTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaBorderRadiusAllParamTest { + PAGE_TAG: string = 'TextAreaBorderRadiusAllParamTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaBorderRadiusAllParamTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBorderRadiusSingleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBorderRadiusSingleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f271b804ee6b8d6affbe67c65301d1b33b3c565 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaBorderRadiusSingleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaBorderRadiusSingleTest { + PAGE_TAG: string = 'TextAreaBorderRadiusSingleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaBorderRadiusSingleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaCaretColorBlackTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaCaretColorBlackTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cd7a930aba3ab27b4d601695f223499b2355ebbe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaCaretColorBlackTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaCaretColorBlackTest { + PAGE_TAG: string = 'TextAreaCaretColorBlackTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaCaretColorBlackTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaCaretColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaCaretColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..54112f53c3eae9247e7a5c13ad432bf1157bf680 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaCaretColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaCaretColorTest { + PAGE_TAG: string = 'TextAreaCaretColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaCaretColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaCaretColorWhiteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaCaretColorWhiteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a00397cabe9ab652b30371771b8193004af378f5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaCaretColorWhiteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaCaretColorWhiteTest { + PAGE_TAG: string = 'TextAreaCaretColorWhiteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaCaretColorWhiteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..61d5290f056b98c20a5b957e1f9ceff30c442130 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaDefaultFocusAbnormalTest { + PAGE_TAG: string = 'TextAreaDefaultFocusAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaDefaultFocusAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1e9a09c5711a3cc5c1a4e1bcb955710674ba8fb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaDefaultFocusFalseTest { + PAGE_TAG: string = 'TextAreaDefaultFocusFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaDefaultFocusFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusMultiTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusMultiTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5e3f58ad614e2ee4bf4008068ed63619f4ecf69 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusMultiTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaDefaultFocusMultiTest { + PAGE_TAG: string = 'TextAreaDefaultFocusMultiTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaDefaultFocusMultiTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e7702621e7f83a2977d50e240074d0278d074f8e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaDefaultFocusNoneTest { + PAGE_TAG: string = 'TextAreaDefaultFocusNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaDefaultFocusNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusSingleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusSingleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..217c92a4e9987f710098eefeedea39f2a38beb72 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusSingleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaDefaultFocusSingleTest { + PAGE_TAG: string = 'TextAreaDefaultFocusSingleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaDefaultFocusSingleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2023a35d1cd8c4a832b8b15e83ba276d61fda337 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaDefaultFocusTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaDefaultFocusTrueTest { + PAGE_TAG: string = 'TextAreaDefaultFocusTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaDefaultFocusTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..25c6cb5886616585b9f2611e13ecdbcf353cbe33 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaEnabledTest { + PAGE_TAG: string = 'TextAreaEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontColorBlackTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontColorBlackTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..41fc78fdf236426e6e2cdd3b62a8ec9ebc2ba373 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontColorBlackTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaFontColorBlackTest { + PAGE_TAG: string = 'TextAreaFontColorBlackTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontColorBlackTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c9bc9d286dba9fdd47d278189e1ca5770ffefe8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaFontColorTest { + PAGE_TAG: string = 'TextAreaFontColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontColorWhiteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontColorWhiteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2b9fe33551f17d20fbc30a7eb23710b4d5aa0686 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontColorWhiteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaFontColorWhiteTest { + PAGE_TAG: string = 'TextAreaFontColorWhiteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontColorWhiteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontFamilyNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontFamilyNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d09c1894e871f1dcc07310b534f25f890eacd1ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontFamilyNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaFontFamilyNoneTest { + PAGE_TAG: string = 'TextAreaFontFamilyNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontFamilyNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontFamilyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontFamilyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..994550185f545aa859493cfed4aabf18ab3b607b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontFamilyTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaFontFamilyTest { + PAGE_TAG: string = 'TextAreaFontFamilyTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontFamilyTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontSizeAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontSizeAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..25539345b12b8b817a5714757e610d730c721336 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontSizeAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaFontSizeAbnormalTest { + PAGE_TAG: string = 'TextAreaFontSizeAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontSizeAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontSizeNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontSizeNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d853af6648d931a7fe888bb2cca6e56ef40c1c7b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontSizeNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaFontSizeNoneTest { + PAGE_TAG: string = 'TextAreaFontSizeNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontSizeNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontSizeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontSizeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..78be499024223a237c34165459a38efde50cd5bb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontSizeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaFontSizeTest { + PAGE_TAG: string = 'TextAreaFontSizeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontSizeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontStyleItalicTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontStyleItalicTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..543ee6870e8eea165fa04a3f9b3ce4379c478340 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontStyleItalicTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaFontStyleItalicTest { + PAGE_TAG: string = 'TextAreaFontStyleItalicTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontStyleItalicTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontStyleNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontStyleNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4543ed812131793061cd3eeae671186ae55a2b36 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontStyleNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaFontStyleNormalTest { + PAGE_TAG: string = 'TextAreaFontStyleNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontStyleNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontWeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontWeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..13eab898972b8997519f3cb76712c484d7d2781a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaFontWeightTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaFontWeightTest { + PAGE_TAG: string = 'TextAreaFontWeightTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 1111, (data: number) => { + render.textAreaFontWeightChangeTypeTest(data); + }) + } + + aboutToDisappear() { + events_emitter.off(1111) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaFontWeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..22c3022afe86fe8362855325e88e302d24cfc239 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaHeightLargeTest { + PAGE_TAG: string = 'TextAreaHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..93e8fec1a2a1dfaf091b4e7aa482dd972ff129d0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaHeightTest { + PAGE_TAG: string = 'TextAreaHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaKeyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaKeyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..40003da66bce3680d1da164d77d388bb6afcc858 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaKeyTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaKeyTest { + PAGE_TAG: string = 'TextAreaKeyTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaKeyTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaLineHeightNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaLineHeightNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..375b0b25fc370f55a0d47edac0b9738224733e6f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaLineHeightNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaLineHeightNoneTest { + PAGE_TAG: string = 'TextAreaLineHeightNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaLineHeightNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaLineHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaLineHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bc870148397a9a6b35cabd42f68360df921d6a1c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaLineHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaLineHeightTest { + PAGE_TAG: string = 'TextAreaLineHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaLineHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaMaxLengthAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaMaxLengthAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad506bd620edb87c769cae4beea85ec8c0eb800d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaMaxLengthAbnormalTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaMaxLengthAbnormalTest { + PAGE_TAG: string = 'TextAreaMaxLengthAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaMaxLengthAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaMaxLengthNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaMaxLengthNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c358befb371d5cc53d421297ce8b97f91e56d89 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaMaxLengthNoneTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaMaxLengthNoneTest { + PAGE_TAG: string = 'TextAreaMaxLengthNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaMaxLengthNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaMaxLengthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaMaxLengthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad5b3ab518708bc017c65ecd2951b0a38e3f475d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaMaxLengthTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaMaxLengthTest { + PAGE_TAG: string = 'TextAreaMaxLengthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaMaxLengthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaOnBlurTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaOnBlurTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..928b00286eb1b5e2f5a88a691e7d96f27cc7d694 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaOnBlurTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaOnBlurTest { + PAGE_TAG: string = 'TextAreaOnBlurTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaOnBlurTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaOnChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaOnChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c7d7b35180431f05b489405ca7445d41016f039 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaOnChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaOnChangeTest { + PAGE_TAG: string = 'TextAreaOnChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaOnChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaOnFocusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaOnFocusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..497716f5d205af473ea42a71e91d3592cfc2fee0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaOnFocusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaOnFocusTest { + PAGE_TAG: string = 'TextAreaOnFocusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaOnFocusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPaddingAllTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPaddingAllTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd036248368052f5b8e6dd03572abbfff7435f6d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPaddingAllTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaPaddingAllTest { + PAGE_TAG: string = 'TextAreaPaddingAllTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaPaddingAllTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPaddingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPaddingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..54d2f73107c90e60a21d4dc01ec5961046223587 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPaddingTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaPaddingTest { + PAGE_TAG: string = 'TextAreaPaddingTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaPaddingTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceHolderColorBlackTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceHolderColorBlackTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..745b70e5cf620e487d2d57cc94aa297cc919afe6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceHolderColorBlackTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaPlaceHolderColorBlackTest { + PAGE_TAG: string = 'TextAreaPlaceHolderColorBlackTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaPlaceHolderColorBlackTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceHolderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceHolderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..63c777c8db39514f60d68ea1746e058814416a7c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceHolderColorTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaPlaceHolderColorTest { + PAGE_TAG: string = 'TextAreaPlaceHolderColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaPlaceHolderColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceHolderColorWhiteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceHolderColorWhiteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..834ea8b84e63850b141449ad58e4bb94b1c57366 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceHolderColorWhiteTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaPlaceHolderColorWhiteTest { + PAGE_TAG: string = 'TextAreaPlaceHolderColorWhiteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaPlaceHolderColorWhiteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceholderFontTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceholderFontTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..088e7df15c07d91c50e12b728235ddf8e7684e57 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPlaceholderFontTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaPlaceholderFontTest { + PAGE_TAG: string = 'TextAreaPlaceholderFontTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 7777, (data: number) => { + render.textAreaPlaceholderFontChangeTypeTest(data); + }) + } + + aboutToDisappear() { + events_emitter.off(7777) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaPlaceholderFontTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e9d73b5b7de4b6a0194296c8c1f815146d0cee4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaPositionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaPositionTest { + PAGE_TAG: string = 'TextAreaPositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaPositionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaResponseRegionDoubleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaResponseRegionDoubleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..75839c3cd9acde67188e76f027830185b7eb4d2a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaResponseRegionDoubleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaResponseRegionDoubleTest { + PAGE_TAG: string = 'TextAreaResponseRegionDoubleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaResponseRegionDoubleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaResponseRegionSingleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaResponseRegionSingleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..98e3a6857b66f102dfdb18e0c08b365c71b95b3a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaResponseRegionSingleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaResponseRegionSingleTest { + PAGE_TAG: string = 'TextAreaResponseRegionSingleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaResponseRegionSingleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e22dbd14ae7b585ba079ebb08814cbf7e4e4da5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingAbnormalTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaStopEditingAbnormalTest { + PAGE_TAG: string = 'TextAreaStopEditingAbnormalTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textAreaStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaStopEditingAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..89502780ad816937c29bfff60fb03bf1166e1c45 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingFalseTest.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct TextAreaStopEditingFalseTest { + PAGE_TAG: string = 'TextAreaStopEditingFalseTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textAreaStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaStopEditingFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingNoneAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingNoneAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6d76806a66cdce6ee899e5453eb7843ae51bf61 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingNoneAbnormalTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaStopEditingNoneAbnormalTest { + PAGE_TAG: string = 'TextAreaStopEditingNoneAbnormalTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textAreaStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaStopEditingNoneAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingNoneFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingNoneFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a66597a7b9385999271d8262033de9ea05af09b9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingNoneFalseTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaStopEditingNoneFalseTest { + PAGE_TAG: string = 'TextAreaStopEditingNoneFalseTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textAreaStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaStopEditingNoneFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingNoneTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingNoneTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..31c68dd72943b031be78490ea1065330dcfdc287 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingNoneTrueTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaStopEditingNoneTrueTest { + PAGE_TAG: string = 'TextAreaStopEditingNoneTrueTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textAreaStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaStopEditingNoneTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d1583bbb7ee59f9a79495fb6db471360abeaf01 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaStopEditingTrueTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaStopEditingTrueTest { + PAGE_TAG: string = 'TextAreaStopEditingTrueTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textAreaStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaStopEditingTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8cc3740bc9ae2c6298aa1853a4c840303dabf167 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignAbnormalTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaTextAlignAbnormalTest { + PAGE_TAG: string = 'TextAreaTextAlignAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaTextAlignAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignCenterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignCenterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..05ad7addc53337e029df041040dc03d21d79c3ad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignCenterTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaTextAlignCenterTest { + PAGE_TAG: string = 'TextAreaTextAlignCenterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaTextAlignCenterTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignEndTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignEndTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a054bdb53cf9998364f59064717989df20de74f5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignEndTest.ets @@ -0,0 +1,36 @@ + +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaTextAlignEndTest { + PAGE_TAG: string = 'TextAreaTextAlignEndTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaTextAlignEndTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignJustifyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignJustifyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5856406ed5ca4039af488a3f912df931eb53f4a1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignJustifyTest.ets @@ -0,0 +1,36 @@ + +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaTextAlignJustifyTest { + PAGE_TAG: string = 'TextAreaTextAlignJustifyTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaTextAlignJustifyTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignStartTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignStartTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3bb569d523d29ac6bd950514b4e5218c61ce196 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaTextAlignStartTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import Utils from '../../../test/common/Utils'; +import { CommonView } from '../../componet/CommonView'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextAreaTextAlignStartTest { + PAGE_TAG: string = 'TextAreaTextAlignStartTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaTextAlignStartTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..35c1baecb8fbecac4f3b23afa844cac4f357daa9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaWidthLargeTest { + PAGE_TAG: string = 'TextAreaWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2e8e91d058d4b2de23854d052594e101d8a00c6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textarea/TextAreaWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextAreaWidthTest { + PAGE_TAG: string = 'TextAreaWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textAreaWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c20961432bdfce99b7fd8b0a0e11f86bd24337e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputBackgroundColorTest { + PAGE_TAG: string = 'TextInputBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputBackgroundImageTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputBackgroundImageTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..19ddd3baeb27628e325f6954e14082a104c20a3d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputBackgroundImageTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputBackgroundImageTest { + PAGE_TAG: string = 'TextInputBackgroundImageTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputBackgroundImageTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec5d3802df3088df959f0071e07727df6aa778fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputCaretColorTest { + PAGE_TAG: string = 'TextInputCaretColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputCaretColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..77cff3baa91cc629242c3061e3e86ffb61bd7fb8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputCaretStyleAbnormalTest { + PAGE_TAG: string = 'TextInputCaretStyleAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputCaretStyleAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleDecimalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleDecimalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..177b000c379c33a156768e34a7533372208e8f81 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleDecimalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputCaretStyleDecimalTest { + PAGE_TAG: string = 'TextInputCaretStyleDecimalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputCaretStyleDecimalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd973be018d12ad876ed6c03f8f3cd74e7dd8d04 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputCaretStyleLargeTest { + PAGE_TAG: string = 'TextInputCaretStyleLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputCaretStyleLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8fbc5c12b76186c670e40358b5594f663272a11 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputCaretStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputCaretStyleTest { + PAGE_TAG: string = 'TextInputCaretStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputCaretStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..82a68c4bd27108a5728b3d966640ffa3c707778d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputClearButtonModeAbnormalTest { + PAGE_TAG: string = 'TextInputClearButtonModeAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputClearButtonModeAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeConstantTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeConstantTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..44799b19c54611d17e6effb4bcc4e35808087d23 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeConstantTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputClearButtonModeConstantTest { + PAGE_TAG: string = 'TextInputClearButtonModeConstantTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputClearButtonModeConstantTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeInputTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeInputTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..105341aced79a5a73e931c6d600a8c923570e53d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeInputTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputClearButtonModeInputTest { + PAGE_TAG: string = 'TextInputClearButtonModeInputTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputClearButtonModeInputTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeInvisibleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeInvisibleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4eb64a11bdb3a1dd39c3384c342ef2b965f21f48 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClearButtonModeInvisibleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputClearButtonModeInvisibleTest { + PAGE_TAG: string = 'TextInputClearButtonModeInvisibleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputClearButtonModeInvisibleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClipTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClipTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b360d65a3b2401f1d6b0e94e4d39c1e4463935b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputClipTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputBackgroundColorTest { + PAGE_TAG: string = 'TextInputClipTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputClipTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a698aca32a73b3ecd6271c4fdbdae966bb032c01 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputDefaultFocusAbnormalTest { + PAGE_TAG: string = 'TextInputDefaultFocusAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputDefaultFocusAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2fe8e78d9a22dd4f4f34eb083c613cfaade7cec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusFalseTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputDefaultFocusFalseTest { + PAGE_TAG: string = 'TextInputDefaultFocusFalseTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputDefaultFocusFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusMultiTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusMultiTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb590522fdc48ec46782fbd85e61af90f01b12ea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusMultiTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputDefaultFocusMultiTest { + PAGE_TAG: string = 'TextInputDefaultFocusMultiTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputDefaultFocusMultiTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b13cbb1f90764b593db3f4cc52193d63ad10366 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputDefaultFocusNoneTest { + PAGE_TAG: string = 'TextInputDefaultFocusNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputDefaultFocusNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusSingleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusSingleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2b09982b969ea651030502c40e3038747026779d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusSingleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputDefaultFocusSingleTest { + PAGE_TAG: string = 'TextInputDefaultFocusSingleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputDefaultFocusSingleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a50ce5c15059655f2eab5812fe4c499b7723d51f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputDefaultFocusTrueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputDefaultFocusTrueTest { + PAGE_TAG: string = 'TextInputDefaultFocusTrueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputDefaultFocusTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..95068db880c0e4927db4eb036ecb62d47c2695ef --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnableKeyboardOnFocusAbnormalTest { + PAGE_TAG: string = 'TextInputEnableKeyboardOnFocusAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnableKeyboardOnFocusAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusDisableTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusDisableTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d54d775ece4f8a80a385260233ae9ae849c87d92 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusDisableTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnableKeyboardOnFocusDisableTest { + PAGE_TAG: string = 'TextInputEnableKeyboardOnFocusDisableTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnableKeyboardOnFocusDisableTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..857e5efb68691d5f4d5c5627779325e2c40a71e2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnableKeyboardOnFocusTest { + PAGE_TAG: string = 'TextInputEnableKeyboardOnFocusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnableKeyboardOnFocusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..592d3bc0d19fc58e11060f1e46fbb593466fba7c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnabledTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnabledTest { + PAGE_TAG: string = 'TextInputEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnabledTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..50f81c8f051867977602a45af4acb059220a3c58 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnterKeyTypeAbnormalTest { + PAGE_TAG: string = 'TextInputEnterKeyTypeAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnterKeyTypeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeDoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeDoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fee58af0abe4e5f2ee8af16dc09efeb75d13de5f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeDoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnterKeyTypeDoneTest { + PAGE_TAG: string = 'TextInputEnterKeyTypeDoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnterKeyTypeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeNewLineTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeNewLineTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..697d0ab212637c08ad06cdc91839f9be555a951d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeNewLineTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnterKeyTypeNewLineTest { + PAGE_TAG: string = 'TextInputEnterKeyTypeNewLineTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnterKeyTypeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeNextTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeNextTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a8c06ed8787dd6aefefcfb1f116c6b2c80dd5af --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeNextTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnterKeyTypeNextTest { + PAGE_TAG: string = 'TextInputEnterKeyTypeNextTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnterKeyTypeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypePreviousTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypePreviousTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..40876371069a3fdbe7a4d212b593e797657faa6a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypePreviousTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnterKeyTypePreviousTest { + PAGE_TAG: string = 'TextInputEnterKeyTypePreviousTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnterKeyTypeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeSearchTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeSearchTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ff8a165cb966618e07f59cbf6b58c6b28258284 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeSearchTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnterKeyTypeSearchTest { + PAGE_TAG: string = 'TextInputEnterKeyTypeSearchTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnterKeyTypeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeSendTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeSendTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..665527c2a62197943df3144878faaf148268f2c0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeSendTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnterKeyTypeSendTest { + PAGE_TAG: string = 'TextInputEnterKeyTypeSendTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnterKeyTypeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a25ebd7acb1f0f6a3851df757bd88861647dd537 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputEnterKeyTypeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputEnterKeyTypeTest { + PAGE_TAG: string = 'TextInputEnterKeyTypeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputEnterKeyTypeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eada922af1d057cf632d4b714971e4e907b39f14 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputFontColorTest { + PAGE_TAG: string = 'TextInputFontColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputFontColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontFamilyAddTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontFamilyAddTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ddc872422ec5ad119bc435067f9c9fb44c11a78 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontFamilyAddTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputFontFamilyAddTest { + PAGE_TAG: string = 'TextInputFontFamilyAddTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputFontFamilyAddTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontFamilySingleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontFamilySingleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..275d6d71c6e989329c30931b0517557290b5e5e0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontFamilySingleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputFontFamilySingleTest { + PAGE_TAG: string = 'TextInputFontFamilySingleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputFontFamilySingleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontSizeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontSizeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e8c29c266437979627f44d67c9bd75dd6389880d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontSizeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputFontSizeTest { + PAGE_TAG: string = 'TextInputFontSizeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputFontSizeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d79d95f3eca18b54aa415351e7c3e01fd770f44 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputFontStyleTest { + PAGE_TAG: string = 'TextInputFontStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputFontStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontWeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontWeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8b1e2cae834f09e02178516fd4ad021344a4264f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputFontWeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputFontWeightTest { + PAGE_TAG: string = 'TextInputFontWeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputFontWeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..676895c61ed8ea141752860932c369e4f0fe6fd1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputHeightLargeTest { + PAGE_TAG: string = 'TextInputHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..98fc58898dfbcd1455d058073e5acf144d29521d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputHeightTest { + PAGE_TAG: string = 'TextInputHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputKeyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputKeyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e7329f54dc502f16a57adc08039890cbe05f63b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputKeyTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputKeyTest { + PAGE_TAG: string = 'TextInputKeyTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputKeyTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputLineHeightAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputLineHeightAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1f49511428b8ce92803c7b615f8732e26e25bd2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputLineHeightAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputLineHeightAbnormalTest { + PAGE_TAG: string = 'TextInputLineHeightAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputLineHeightAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputLineHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputLineHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9af95e7ab5ba8761cd5a403696d934889b58d41 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputLineHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputLineHeightTest { + PAGE_TAG: string = 'TextInputLineHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputLineHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputMaxLengthAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputMaxLengthAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..22d4ba569490d7125a048f92a5cad931209700b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputMaxLengthAbnormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputMaxLengthAbnormalTest { + PAGE_TAG: string = 'TextInputMaxLengthAbnormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputMaxLengthAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputMaxLengthNoneTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputMaxLengthNoneTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee84b78f3084a1c9b9ca42e25b444421a7db7d0f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputMaxLengthNoneTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputMaxLengthNoneTest { + PAGE_TAG: string = 'TextInputMaxLengthNoneTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputMaxLengthNoneTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputMaxLengthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputMaxLengthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e008a733ca2b02d8148e1d430f48119bc906c8e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputMaxLengthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputMaxLengthTest { + PAGE_TAG: string = 'TextInputMaxLengthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputMaxLengthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnBlurTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnBlurTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cd7610c37eb4436b07a776a1e202766e2c1f3a32 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnBlurTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct textInputOnBlurTest { + PAGE_TAG: string = 'textInputOnBlurTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputOnBlurTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0467b69a2898eff70f710daead99e7936693d63 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputOnChangeTest { + PAGE_TAG: string = 'TextInputOnChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputOnChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnCutTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnCutTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eaa88af95416d33a9bf018eea0669c43d25fb2bf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnCutTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputOnCutTest { + PAGE_TAG: string = 'TextInputOnCutTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputOnCutTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnFocusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnFocusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb52e46dee5f355011c2c8347ddac549d555c4b9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnFocusTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct textInputOnFocusTest { + PAGE_TAG: string = 'textInputOnFocusTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputOnFocusTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnPasteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnPasteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..451c77bcc9bac89969d892721c4b705ccaf10d00 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnPasteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputOnPasteTest { + PAGE_TAG: string = 'TextInputOnPasteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputOnPasteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnSubmitTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnSubmitTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0c5c952f76758a1ceb649ce7acf4293a0f855a0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputOnSubmitTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputOnSubmitTest { + PAGE_TAG: string = 'TextInputOnSubmitTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputOnSubmitTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPaddingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPaddingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2f8717285d1d5099c33dcad4093642807264adda --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPaddingTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputPaddingTest { + PAGE_TAG: string = 'TextInputPaddingTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputPaddingTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderColorBlackTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderColorBlackTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a9ed4d7bdb6550f7a969aa06504b9cd0d74d6720 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderColorBlackTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputPlaceholderColorBlackTest { + PAGE_TAG: string = 'TextInputPlaceholderColorBlackTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputPlaceholderColorBlackTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cd85f061cf9bcfe9eb4a7fd7f1d1bc9d511554cc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputPlaceholderColorTest { + PAGE_TAG: string = 'TextInputPlaceholderColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputPlaceholderColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderColorWhiteTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderColorWhiteTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..12a1b1201694912916d9cf46d1963e744a8cb65f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderColorWhiteTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputPlaceholderColorWhiteTest { + PAGE_TAG: string = 'TextInputPlaceholderColorWhiteTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputPlaceholderColorWhiteTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderFontTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderFontTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a2b75fbbdf09f0335962ad350f31dabc3311cd0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPlaceholderFontTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextInputPlaceholderFontTest { + PAGE_TAG: string = 'TextInputPlaceholderFontTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textInputPlaceholderFontChangeTypeTest(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputPlaceholderFontTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..82f3bbf44f222cfdb1279c8b2cb841cc2408f25d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputPositionTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputPositionTest { + PAGE_TAG: string = 'TextInputPositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputPositionTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputResponseRegionDoubleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputResponseRegionDoubleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9c1746df732b8197193035e46507705869fc4b7c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputResponseRegionDoubleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputResponseRegionDoubleTest { + PAGE_TAG: string = 'TextInputResponseRegionDoubleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputResponseRegionDoubleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputResponseRegionSingleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputResponseRegionSingleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e302bfd492dc55ed518862b25fd1e449fb051648 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputResponseRegionSingleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputResponseRegionSingleTest { + PAGE_TAG: string = 'TextInputResponseRegionSingleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputResponseRegionSingleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputSelectedBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputSelectedBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c678992fb2a9ddde2e96864aa3b6e39f1a9714a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputSelectedBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputSelectedBackgroundColorTest { + PAGE_TAG: string = 'TextInputSelectedBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputSelectedBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputShowPasswordIconTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputShowPasswordIconTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd5231f79f244b329acc6789d20a756f547eeb5b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputShowPasswordIconTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputShowPasswordIconTest { + PAGE_TAG: string = 'TextInputShowPasswordIconTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputShowPasswordIconTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputShowUnderLineTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputShowUnderLineTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0bb2947a7170c51172d2d76de122d205502fac2d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputShowUnderLineTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputShowUnderLineTest { + PAGE_TAG: string = 'TextInputShowUnderLineTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputShowUnderLineTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..931827202c4373bb0ba92853043e117ecf4c5742 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingAbnormalTest.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct TextInputStopEditingAbnormalTest { + PAGE_TAG: string = 'TextInputStopEditingAbnormalTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textInputStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputStopEditingAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..53292a1490a3241c4a49da85f0a73cfee6533106 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingFalseTest.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct TextInputStopEditingFalseTest { + PAGE_TAG: string = 'TextInputStopEditingFalseTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textInputStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputStopEditingFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingNoneAbnormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingNoneAbnormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba6e0f948625a239039eb1fd70afd614b100609e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingNoneAbnormalTest.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct TextInputStopEditingNoneAbnormalTest { + PAGE_TAG: string = 'TextInputStopEditingNoneAbnormalTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textInputStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputStopEditingNoneAbnormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingNoneFalseTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingNoneFalseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c7d9b926e6727fa401370d68418fd18e7ec9b5b9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingNoneFalseTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextInputStopEditingNoneFalseTest { + PAGE_TAG: string = 'TextInputStopEditingNoneFalseTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textInputStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputStopEditingNoneFalseTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingNoneTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingNoneTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec6640d31b097ea5058525f97222b8ef3826b3ce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingNoneTrueTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextInputStopEditingNoneTrueTest { + PAGE_TAG: string = 'TextInputStopEditingNoneTrueTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textInputStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputStopEditingNoneTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingTrueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingTrueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dcf41554e573f695d3667b3ca1df4a4ccad41bd9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputStopEditingTrueTest.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; +import Utils from '../../../test/common/Utils'; +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct TextInputStopEditingTrueTest { + PAGE_TAG: string = 'TextInputStopEditingTrueTest'; + + aboutToAppear() { + Utils.registerEvent(this.PAGE_TAG, 6666, (data: number) => { + render.textInputStopEditingChangeType(data); + }) + } + + aboutToDisappear() { + events_emitter.off(6666) + } + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputStopEditingTrueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputTextAlignTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputTextAlignTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..62c7c9b83f673821a3447785fb9bbba3b6e8e42c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputTextAlignTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputTextAlignTest { + PAGE_TAG: string = 'TextInputTextAlignTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputTextAlignTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputTypeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputTypeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4683f1c104c46a6c4171d8f2551ec79447ba67a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputTypeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputTypeTest { + PAGE_TAG: string = 'TextInputTypeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputTypeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..190a7647bd9325983b1726c5166c137c02bfe0e5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputWidthLargeTest { + PAGE_TAG: string = 'TextInputWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d662be85e1c56f999f5334d529164a8b636f0a5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textinput/TextInputWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextInputWidthTest { + PAGE_TAG: string = 'TextInputWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textInputWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerCanLoopTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerCanLoopTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8b4c4bf6ad27c72a03ee20b5ab31ff6bb1422e9c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerCanLoopTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerCanLoopTest { + PAGE_TAG: string = 'TextPickerCanLoopTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerCanLoopTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDefaultPickerItemHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDefaultPickerItemHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a53f73b228a9c855dd229e4b7f02df2b1d0eaea3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDefaultPickerItemHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerDefaultPickerItemHeightTest { + PAGE_TAG: string = 'TextPickerDefaultPickerItemHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerDefaultPickerItemHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleBoldTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleBoldTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..78079a9bec6989d17e3d1b851eaf1b33122f0c42 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleBoldTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerDisappearTextStyleBoldTest { + PAGE_TAG: string = 'TextPickerDisappearTextStyleBoldTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerDisappearTextStyleBoldTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleBolderTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleBolderTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..752caa994a757772715e45de636123179a6fee5e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleBolderTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerDisappearTextStyleBolderTest { + PAGE_TAG: string = 'TextPickerDisappearTextStyleBolderTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerDisappearTextStyleBolderTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleLighterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleLighterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..19d9602ee6ba76f7dd4cfcd3a6aefd38ad500002 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleLighterTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerDisappearTextStyleLighterTest { + PAGE_TAG: string = 'TextPickerDisappearTextStyleLighterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerDisappearTextStyleLighterTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleMediumTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleMediumTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c38e283b91229cf73c5e51620d849f37f020a109 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleMediumTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerDisappearTextStyleMediumTest { + PAGE_TAG: string = 'TextPickerDisappearTextStyleMediumTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerDisappearTextStyleMediumTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7dc59902b2d2679b0d69432f2b14ae757274fc4e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerDisappearTextStyleNormalTest { + PAGE_TAG: string = 'TextPickerDisappearTextStyleNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerDisappearTextStyleNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleRegularTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleRegularTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b50de9284c1597d9920f4b86e2108dc8dea1093f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleRegularTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerDisappearTextStyleRegularTest { + PAGE_TAG: string = 'TextPickerDisappearTextStyleRegularTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerDisappearTextStyleRegularTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e864bcaa184cae9d3b230dfd7c5715c540ed2776 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerDisappearTextStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerDisappearTextStyleTest { + PAGE_TAG: string = 'TextPickerDisappearTextStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerDisappearTextStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..76dea3e43faba5887441da1c9c0b5478cf1b793e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerHeightLargeTest { + PAGE_TAG: string = 'TextPickerHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..21844e9496e59279aaf47177a0243067ed87f866 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerHeightTest { + PAGE_TAG: string = 'TextPickerHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerOnChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerOnChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..83710e9ed1fdd5fd9a8bbb6f0137af773ca4cfaf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerOnChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerOnChangeTest { + PAGE_TAG: string = 'TextPickerOnChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerOnChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerRangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerRangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..185a8fcb4eb38c2b7d0eb95a7caf70995be29051 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerRangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerRangeTest { + PAGE_TAG: string = 'TextPickerRangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerRangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedIndexTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedIndexTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2dd376d9e18110f34fcb8ad113a0764c51e0de71 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedIndexTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerSelectedIndexTest { + PAGE_TAG: string = 'TextPickerSelectedIndexTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerSelectedIndexTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1622bc458359d958a241e6ee3059892313b860d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerSelectedTest { + PAGE_TAG: string = 'TextPickerSelectedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerSelectedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleBoldTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleBoldTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..484272bea833f0356a4f969723768f2104b69f01 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleBoldTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerSelectedTextStyleBoldTest { + PAGE_TAG: string = 'TextPickerSelectedTextStyleBoldTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerSelectedTextStyleBoldTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleBolderTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleBolderTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..06389103bb82e658f455548393b5e02bd33ee996 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleBolderTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerSelectedTextStyleBolderTest { + PAGE_TAG: string = 'TextPickerSelectedTextStyleBolderTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerSelectedTextStyleBolderTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleLighterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleLighterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2bac2b6f6bc88c276e6b5a2ed155ffc136fbd065 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleLighterTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerSelectedTextStyleLighterTest { + PAGE_TAG: string = 'TextPickerSelectedTextStyleLighterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerSelectedTextStyleLighterTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleMediumTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleMediumTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f9e098de2f7526efb6bb5747a0d750c05fabcc6a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleMediumTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerSelectedTextStyleMediumTest { + PAGE_TAG: string = 'TextPickerSelectedTextStyleMediumTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerSelectedTextStyleMediumTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d21aa0d2ce7de91aa4bb6ad615597b6417a7226f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerSelectedTextStyleNormalTest { + PAGE_TAG: string = 'TextPickerSelectedTextStyleNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerSelectedTextStyleNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleRegularTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleRegularTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a7c4d995f0e7b99a767fb35e5c9cc9be6a53e702 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleRegularTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerSelectedTextStyleRegularTest { + PAGE_TAG: string = 'TextPickerSelectedTextStyleRegularTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerSelectedTextStyleRegularTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..76a906c7f0f8801a37c34ddd26b163cac40c973b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerSelectedTextStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerSelectedTextStyleTest { + PAGE_TAG: string = 'TextPickerSelectedTextStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerSelectedTextStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleBoldTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleBoldTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..673f27f4893e4c4e93d096809101f4bb4c1289e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleBoldTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerTextStyleBoldTest { + PAGE_TAG: string = 'TextPickerTextStyleBoldTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerTextStyleBoldTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleBolderTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleBolderTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a72d743968fa5d55f82e1afd4cedcac12f2dbf32 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleBolderTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerTextStyleBolderTest { + PAGE_TAG: string = 'TextPickerTextStyleBolderTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerTextStyleBolderTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleLighterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleLighterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..51202f84ebedd6483343b04440a7f87ceab02b35 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleLighterTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerTextStyleLighterTest { + PAGE_TAG: string = 'TextPickerTextStyleLighterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerTextStyleLighterTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleMediumTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleMediumTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa23fd1fb62195b25ae77babde43adb7806223b5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleMediumTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerTextStyleMediumTest { + PAGE_TAG: string = 'TextPickerTextStyleMediumTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerTextStyleMediumTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..61455bb13fd09c5e60a847942944a0344bcbbf99 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerTextStyleNormalTest { + PAGE_TAG: string = 'TextPickerTextStyleNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerTextStyleNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleRegularTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleRegularTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5551b4a9759d3c99f739ba5fb05dc99d271a981b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleRegularTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerTextStyleRegularTest { + PAGE_TAG: string = 'TextPickerTextStyleRegularTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerTextStyleRegularTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..52fb47729c4b3b37c7a43a275892cdc272507a6f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerTextStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerTextStyleTest { + PAGE_TAG: string = 'TextPickerTextStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerTextStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerValueTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerValueTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f3cc10737d27b484f161f1e61cba58c4421801f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerValueTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerValueTest { + PAGE_TAG: string = 'TextPickerValueTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerValueTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4da27ad79a2afb1e80f2baa67a46455440170a15 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerWidthLargeTest { + PAGE_TAG: string = 'TextPickerWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..30dde4e360086f4a11e0195272489db30585dbfc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/textpicker/TextPickerWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TextPickerWidthTest { + PAGE_TAG: string = 'TextPickerWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.textPickerWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleBoldTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleBoldTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ae91c1c278d77b54ad5fbec3cd89a633178f43e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleBoldTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerDisappearTextStyleBoldTest { + PAGE_TAG: string = 'TimePickerDisappearTextStyleBoldTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerDisappearTextStyleBoldTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleBolderTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleBolderTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..716ac14a77576d8246e6d6e838b1bd9f476f5269 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleBolderTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerDisappearTextStyleBolderTest { + PAGE_TAG: string = 'TimePickerDisappearTextStyleBolderTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerDisappearTextStyleBolderTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleLighterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleLighterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..03c5849dd78928f14081d949af90e923a1bcac73 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleLighterTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerDisappearTextStyleLighterTest { + PAGE_TAG: string = 'TimePickerDisappearTextStyleLighterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerDisappearTextStyleLighterTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleMediumTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleMediumTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..827a1d297993f44b8b63095602d2ef2922b7f48c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleMediumTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerDisappearTextStyleMediumTest { + PAGE_TAG: string = 'TimePickerDisappearTextStyleMediumTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerDisappearTextStyleMediumTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e3e43bf53221a6e298945b8e6f4677937c33941e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerDisappearTextStyleNormalTest { + PAGE_TAG: string = 'TimePickerDisappearTextStyleNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerDisappearTextStyleNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleRegularTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleRegularTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..09e0f20e283513db242baf90da6c65f6033ab1b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleRegularTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerDisappearTextStyleRegularTest { + PAGE_TAG: string = 'TimePickerDisappearTextStyleRegularTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerDisappearTextStyleRegularTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8581ab064826056ceb13fa3b6033af0c23bb3a5e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerDisappearTextStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerDisappearTextStyleTest { + PAGE_TAG: string = 'TimePickerDisappearTextStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerDisappearTextStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dfa9aace9d7864f4605d9eedf02eb3f361b785db --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerHeightTest { + PAGE_TAG: string = 'TimePickerHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerOnChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerOnChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3828e491913b850dce88a1d1b71e19d8ba7dbb5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerOnChangeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerOnChangeTest { + PAGE_TAG: string = 'TimePickerOnChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerOnChangeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0afe9ef5ead7e4f687a157c26dca897d2d99ca80 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerSelectedTest { + PAGE_TAG: string = 'TimePickerSelectedTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerSelectedTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleBoldTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleBoldTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a411842a33c98f39c8f696cd1f0d26169bd4c52 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleBoldTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerSelectedTextStyleBoldTest { + PAGE_TAG: string = 'TimePickerSelectedTextStyleBoldTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerSelectedTextStyleBoldTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleBolderTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleBolderTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..93a4c7f28d630354af9abc619f43a5a15323dbd9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleBolderTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerSelectedTextStyleBolderTest { + PAGE_TAG: string = 'TimePickerSelectedTextStyleBolderTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerSelectedTextStyleBolderTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleLighterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleLighterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..118f7e23073121d245d83c10cdeebd719c18c080 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleLighterTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerSelectedTextStyleLighterTest { + PAGE_TAG: string = 'TimePickerSelectedTextStyleLighterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerSelectedTextStyleLighterTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleMediumTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleMediumTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..06444b3886396dcaabbae0f02213ddcaa25f1c0d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleMediumTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerSelectedTextStyleMediumTest { + PAGE_TAG: string = 'TimePickerSelectedTextStyleMediumTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerSelectedTextStyleMediumTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..886c58b5ab51eb29aeb91128be0b71720d9d0eac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerSelectedTextStyleNormalTest { + PAGE_TAG: string = 'TimePickerSelectedTextStyleNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerSelectedTextStyleNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleRegularTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleRegularTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fecb5c7c35a519fe9c3bad8dd228f68cec6d04a2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleRegularTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerSelectedTextStyleRegularTest { + PAGE_TAG: string = 'TimePickerSelectedTextStyleRegularTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerSelectedTextStyleRegularTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..213eb5a81dd043085a88904a04d027688297957f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerSelectedTextStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerSelectedTextStyleTest { + PAGE_TAG: string = 'TimePickerSelectedTextStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerSelectedTextStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleBoldTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleBoldTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d03cf81a968ac2b0393e65545695c9607ec1e615 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleBoldTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerTextStyleBoldTest { + PAGE_TAG: string = 'TimePickerTextStyleBoldTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerTextStyleBoldTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleBolderTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleBolderTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..865f4451e389b78ba8b552bc6cb53d724139cadb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleBolderTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerTextStyleBolderTest { + PAGE_TAG: string = 'TimePickerTextStyleBolderTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerTextStyleBolderTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleLighterTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleLighterTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..90ebc43ee7b93cb3ec3aeb3231a36901f965dfa0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleLighterTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerTextStyleLighterTest { + PAGE_TAG: string = 'TimePickerTextStyleLighterTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerTextStyleLighterTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleMediumTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleMediumTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e61475ab304e57fde36c80204645810afe3123a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleMediumTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerTextStyleMediumTest { + PAGE_TAG: string = 'TimePickerTextStyleMediumTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerTextStyleMediumTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleNormalTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleNormalTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8b2da1b9cb032ac785804de4f132d845f0f1ab1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleNormalTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerTextStyleNormalTest { + PAGE_TAG: string = 'TimePickerTextStyleNormalTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerTextStyleNormalTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleRegularTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleRegularTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..99db7c55fdb932e6feb3cb8eec8a5dabfe72effd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleRegularTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerTextStyleRegularTest { + PAGE_TAG: string = 'TimePickerTextStyleRegularTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerTextStyleRegularTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4dbef3911b1a5e880f303c8091917fb17b7b39a1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerTextStyleTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerTextStyleTest { + PAGE_TAG: string = 'TimePickerTextStyleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerTextStyleTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerUseMilitaryTimeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerUseMilitaryTimeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..61ebebcabab1bb6ffbc62c3a8f698733f7c6aecb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/timepicker/TimePickerUseMilitaryTimeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TimePickerUseMilitaryTimeTest { + PAGE_TAG: string = 'TimePickerUseMilitaryTimeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.timePickerUseMilitaryTimeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b69aa8369d8c1a4d70e4dcd3f77f77e158cd8704 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleBackgroundColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleBackgroundColorTest { + PAGE_TAG: string = 'ToggleBackgroundColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleBackgroundColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleClipTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleClipTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..cca3021ce4348192ae7efda5b85c2f3ecc8c8222 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleClipTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleClipTest { + PAGE_TAG: string = 'ToggleClipTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleClipTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleEnabledTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleEnabledTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4c87ca48b194ad19d13ff0295e4068f9778bc684 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleEnabledTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleEnabledTest { + PAGE_TAG: string = 'ToggleEnabledTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleEnabledTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleFocusableCombineTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleFocusableCombineTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..97d622bb436733c0a27fd11faa4ce5f47ed50a0f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleFocusableCombineTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleFocusableCombineTest { + PAGE_TAG: string = 'ToggleFocusableCombineTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleFocusableCombineTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleFocusableTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleFocusableTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a7665eea2f06f07001dbc93a14dc66380ea2eca3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleFocusableTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleFocusableTest { + PAGE_TAG: string = 'ToggleFocusableTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleFocusableTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8a0c3da9fd6dd6e3fc36c889e7b9289125f90474 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleHeightLargeTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleHeightLargeTest { + PAGE_TAG: string = 'ToggleHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleHeightLargeTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f042c12021844e5e1e15d99bdee57e4b618f0d8e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleHeightTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleHeightTest { + PAGE_TAG: string = 'ToggleHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleHeightTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginFourLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginFourLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d8edc192c74ba0e126fe0b1c04bcf6133d23c89 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginFourLargeTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleMarginFourLargeTest { + PAGE_TAG: string = 'ToggleMarginFourLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleMarginFourLargeTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..01fa28edba824ee305601e2a5cda63b98046f157 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginLargeTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleMarginLargeTest { + PAGE_TAG: string = 'ToggleMarginLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleMarginLargeTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginMiddleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginMiddleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c6522e7b7bac29fbd6f1c8edd3ab346d78ce25d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginMiddleTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleMarginMiddleTest { + PAGE_TAG: string = 'ToggleMarginMiddleTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleMarginMiddleTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3050adf9dd60b3933874ebea3bb5271831d62be1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleMarginTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleMarginTest { + PAGE_TAG: string = 'ToggleMarginTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleMarginTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleOnChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleOnChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee23ee28e9dc7c7360b0c617323c971c31c01f9f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleOnChangeTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleOnChangeTest { + PAGE_TAG: string = 'ToggleOnChangeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleOnChangeTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/TogglePositionLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/TogglePositionLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..34c85a89b72a5443f6479baf9e5fa0acb3e735d7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/TogglePositionLargeTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TogglePositionLargeTest { + PAGE_TAG: string = 'TogglePositionLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.togglePositionLargeTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/TogglePositionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/TogglePositionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d0e470734524ee529af3d5b231331ef0246e9159 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/TogglePositionTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct TogglePositionTest { + PAGE_TAG: string = 'TogglePositionTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.togglePositionTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleSelectedColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleSelectedColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1491bc570d64ec0f02a2b3210ac001da62af7430 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleSelectedColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleSelectedColorTest { + PAGE_TAG: string = 'ToggleSelectedColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleSelectedColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleSwitchPointColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleSwitchPointColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..85a2f3f9957c0097908a606f25e5d1eddd0e83d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleSwitchPointColorTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleSwitchPointColorTest { + PAGE_TAG: string = 'ToggleSwitchPointColorTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleSwitchPointColorTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleSwitchTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleSwitchTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..48563ddfeeddc19f8d5490f1a76a0b976ded1b43 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleSwitchTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleSwitchTest { + PAGE_TAG: string = 'ToggleSwitchTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleSwitchTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..489d161b6d05edaac70e84388b4cdd0a65d5252c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleWidthLargeTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleWidthLargeTest { + PAGE_TAG: string = 'ToggleWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleWidthLargeTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..36140e06f09a2b55b18ed6e8e135f94066bbf3f1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/toggle/ToggleWidthTest.ets @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct ToggleWidthTest { + PAGE_TAG: string = 'ToggleWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.toggleWidthTest(this.PAGE_TAG); + + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentHeightLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentHeightLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d26c5efe71bb9ff33799a1294cfb6871889af04 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentHeightLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct XComponentHeightLargeTest { + PAGE_TAG: string = 'XComponentHeightLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.xComponentHeightLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d21acf1a420c4a7f9bb34169a652a616d514b38e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentHeightTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct XComponentHeightTest { + PAGE_TAG: string = 'XComponentHeightTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.xComponentHeightTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentSourceIdTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentSourceIdTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..63933d58373280956106a5f600d5095b8ed9b125 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentSourceIdTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct XComponentSourceIdTest { + PAGE_TAG: string = 'XComponentSourceIdTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.xComponentSourceIdTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentTypeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentTypeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d764016095942889d741dd9616cf688b6e09b77 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentTypeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct XComponentTypeTest { + PAGE_TAG: string = 'XComponentTypeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.xComponentTypeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentWidthLargeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentWidthLargeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cf50f1bfede6ee6e6e52deffb3d930b84702733 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentWidthLargeTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct XComponentWidthLargeTest { + PAGE_TAG: string = 'XComponentWidthLargeTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.xComponentWidthLargeTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f97c079c9a8044c72d7e1193eb9c9064d3ddfe4d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/MainAbility/pages/xcomponent/XComponentWidthTest.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device 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 render from 'libnativerender.so' +import { CommonView } from '../../componet/CommonView'; + +@Entry +@Component +struct XComponentWidthTest { + PAGE_TAG: string = 'XComponentWidthTest'; + + build() { + Column() { + CommonView({ + pageTag: this.PAGE_TAG, + }).onAppear(() => { + render.xComponentWidthTest(this.PAGE_TAG); + }) + } + } +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/List.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..017baee5006846457ab0b3575fb1b94fc2e59374 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,1079 @@ +/* + * Copyright (c) 2024 Huawei Device 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 buttonOnClickTest from './button/ButtonOnClickTest.test' +import buttonBackgroundColorTest from './button/ButtonBackgroundColorTest.test' +import buttonFontColorTest from './button/ButtonFontColorTest.test' +import buttonFontSizeTest from './button/ButtonFontSizeTest.test' +import buttonFontWeightTest from './button/ButtonFontWeightTest.test' +import checkboxSelectTest from './checkbox/CheckboxSelectTest.test' +import checkboxSelectedColorTest from './checkbox/CheckboxSelectedColorTest.test' +import checkboxUnselectedColorTest from './checkbox/CheckboxUnselectedColorTest.test' +import checkboxMarkTest from './checkbox/CheckboxMarkTest.test' +import checkboxShapeTest from './checkbox/CheckboxShapeTest.test' +import checkboxOnChangeTest from './checkbox/CheckboxOnChangeTest.test' +import commonAttrsBackgroundColorTest from './commonattrs/CommonAttrsBackgroundColorTest.test' +import commonAttrsBorderColorTest from './commonattrs/CommonAttrsBorderColorTest.test' +import commonAttrsBorderRadiusTest from './commonattrs/CommonAttrsBorderRadiusTest.test' +import commonAttrsBorderStyleTest from './commonattrs/CommonAttrsBorderStyleTest.test' +import commonAttrsBorderWidthTest from './commonattrs/CommonAttrsBorderWidthTest.test' +import commonAttrsHeightTest from './commonattrs/CommonAttrsHeightTest.test' +import commonAttrsPositionTest from './commonattrs/CommonAttrsPositionTest.test' +import commonAttrsWidthTest from './commonattrs/CommonAttrsWidthTest.test' +import commonEventOnClickTest from './commonevent/CommonEventOnClickTest.test' +import commonEventOnFocusTest from './commonevent/CommonEventOnFocusTest.test' +import commonEventOnBlurTest from './commonevent/CommonEventOnBlurTest.test' +import commonEventOnAppearTest from './commonevent/CommonEventOnAppearTest.test' +import commonEventOnAreaChangeTest from './commonevent/CommonEventOnAreaChangeTest.test' +import commonEventOnTouchTest from './commonevent/CommonEventOnTouchTest.test' +import commonAttrsEnabledTest from './commonattrs/CommonAttrsEnabledTest.test' +import commonAttrsFocusableTest from './commonattrs/CommonAttrsFocusableTest.test' +import commonAttrsAlignTest from './commonattrs/CommonAttrsAlignTest.test' +import commonAttrsDirectionTest from './commonattrs/CommonAttrsDirectionTest.test' +import commonAttrsFlexBasisTest from './commonattrs/CommonAttrsFlexBasisTest.test' +import commonAttrsFlexGrowTest from './commonattrs/CommonAttrsFlexGrowTest.test' +import commonAttrsFlexShrinkTest from './commonattrs/CommonAttrsFlexShrinkTest.test' +import commonAttrsForegroundBlurStyleTest from './commonattrs/CommonAttrsForegroundBlurStyleTest.test' +import commonAttrsAlignSelfTest from './commonattrs/CommonAttrsAlignSelfTest.test' +import commonAttrsAlignContentTest from './commonattrs/CommonAttrsAlignContentTest.test' +import commonAttrsJustifyContentTest from './commonattrs/CommonAttrsJustifyContentTest.test' +import commonAttrsAlignItemsTest from './commonattrs/CommonAttrsAlignItemsTest.test' +import commonAttrsRadialGradientTest from './commonattrs/CommonAttrsRadialGradientTest.test' +import commonAttrsSweepGradientTest from './commonattrs/CommonAttrsSweepGradientTest.test' +import commonAttrsGrayscaleTest from './commonattrs/CommonAttrsGrayscaleTest.test' +import commonAttrsHitTestBehaviorTest from './commonattrs/CommonAttrsHitTestBehaviorTest.test' +import commonAttrsIdTest from './commonattrs/CommonAttrsIdTest.test' +import commonAttrsInvertTest from './commonattrs/CommonAttrsInvertTest.test' +import commonAttrsContrastTest from './commonattrs/CommonAttrsContrastTest.test' +import commonAttrsSepiaTest from './commonattrs/CommonAttrsSepiaTest.test' +import commonAttrsClipTest from './commonattrs/CommonAttrsClipTest.test' +import commonAttrsConstraintSizeTest from './commonattrs/CommonAttrsConstraintSizeTest.test' +import commonAttrsLinearGradientTest from './commonattrs/CommonAttrsLinearGradientTest.test' +import commonAttrsMarginTest from './commonattrs/CommonAttrsMarginTest.test' +import commonAttrsScaleTest from './commonattrs/CommonAttrsScaleTest.test' +import commonAttrsShadowTest from './commonattrs/CommonAttrsShadowTest.test' +import commonAttrsTransformTest from './commonattrs/CommonAttrsTransformTest.test' +import commonAttrsMaskTest from './commonattrs/CommonAttrsMaskTest.test' +import commonAttrsBlendModeTest from './commonattrs/CommonAttrsBlendModeTest.test' +import commonAttrsOpacityTest from './commonattrs/CommonAttrsOpacityTest.test' +import customComponentOnMeasureTest from './customcomponent/CustomComponentOnMeasureTest.test' +import customComponentOnLayoutTest from './customcomponent/CustomComponentOnLayoutTest.test' +import customComponentOnDrawTest from './customcomponent/CustomComponentOnDrawTest.test' +import listBackgroundColorTest from './list/ListBackgroundColorTest.test' +import listBlurTest from './list/ListBlurTest.test' +import listBorderColorTest from './list/ListBorderColorTest.test' +import listBorderRadiusTest from './list/ListBorderRadiusTest.test' +import listBorderWidthTest from './list/ListBorderWidthTest.test' +import listBrightnessTest from './list/ListBrightnessTest.test' +import listClipTest from './list/ListClipTest.test' +import listEnableScrollInteractionTest from './list/ListEnableScrollInteractionTest.test' +import listFrictionTest from './list/ListFrictionTest.test' +import listHeightTest from './list/ListHeightTest.test' +import listHitTestBehaviorTest from './list/ListHitTestBehaviorTest.test' +import listLinearGradientTest from './list/ListLinearGradientTest.test' +import listListDirectionTest from './list/ListListDirectionTest.test' +import listOpacityTest from './list/ListOpacityTest.test' +import listRotateTest from './list/ListRotateTest.test' +import listSaturateTest from './list/ListSaturateTest.test' +import listScaleTest from './list/ListScaleTest.test' +import listScrollBarTest from './list/ListScrollBarTest.test' +import listShadowTest from './list/ListShadowTest.test' +import listStickyTest from './list/ListStickyTest.test' +import listTranslateTest from './list/ListTranslateTest.test' +import listWidthTest from './list/ListWidthTest.test' +import listItemBackgroundColorTest from './listitem/ListItemBackgroundColorTest.test' +import listItemBlurTest from './listitem/ListItemBlurTest.test' +import listItemBorderColorTest from './listitem/ListItemBorderColorTest.test' +import listItemBorderRadiusTest from './listitem/ListItemBorderRadiusTest.test' +import listItemBorderWidthTest from './listitem/ListItemBorderWidthTest.test' +import listItemBrightnessTest from './listitem/ListItemBrightnessTest.test' +import listItemClipTest from './listitem/ListItemClipTest.test' +import listItemHeightTest from './listitem/ListItemHeightTest.test' +import listItemHitTestBehaviorTest from './listitem/ListItemHitTestBehaviorTest.test' +import listItemLinearGradientTest from './listitem/ListItemLinearGradientTest.test' +import listItemOpacityTest from './listitem/ListItemOpacityTest.test' +import listItemRotateTest from './listitem/ListItemRotateTest.test' +import listItemSaturateTest from './listitem/ListItemSaturateTest.test' +import listItemScaleTest from './listitem/ListItemScaleTest.test' +import listItemShadowTest from './listitem/ListItemShadowTest.test' +import listItemTranslateTest from './listitem/ListItemTranslateTest.test' +import listItemWidthTest from './listitem/ListItemWidthTest.test' +import scrollWidthTest from './scroll/ScrollWidthTest.test' +import scrollHeightTest from './scroll/ScrollHeightTest.test' +import scrollPositionTest from './scroll/ScrollPositionTest.test' +import scrollNestedScrollTest from './scroll/ScrollNestedScrollTest.test' +import toggleMarginTest from './toggle/ToggleMarginTest.test' +import toggleEnabledTest from './toggle/ToggleEnabledTest.test' +import swiperVerticalTest from './swiper/SwiperVerticalTest.test' +import swiperDisplayArrowTest from './swiper/SwiperDisplayArrowTest.test' +import swiperItemSpaceTest from './swiper/SwiperItemSpaceTest.test' +import toggleWidthTest from './toggle/ToggleWidthTest.test' +import toggleHeightTest from './toggle/ToggleHeightTest.test' +import swiperDisplayCountTest from './swiper/SwiperDisplayCountTest.test' +import swiperIndexTest from './swiper/SwiperIndexTest.test' +import toggleBackgroundColorTest from './toggle/ToggleBackgroundColorTest.test' +import toggleSwitchPointColorTest from './toggle/ToggleSwitchPointColorTest.test' +import toggleSelectedColorTest from './toggle/ToggleSelectedColorTest.test' +import togglePositionTest from './toggle/TogglePositionTest.test' +import toggleClipTest from './toggle/ToggleClipTest.test' +import toggleSwitchTest from './toggle/ToggleSwitchTest.test' +import swiperBackgroundColorTest from './swiper/SwiperBackgroundColorTest.test' +import swiperAutoPlayTest from './swiper/SwiperAutoPlayTest.test' +import swiperBackgroundImageTest from './swiper/SwiperBackgroundImageTest.test' +import swiperWidthTest from './swiper/SwiperWidthTest.test' +import swiperHeightTest from './swiper/SwiperHeightTest.test' +import swiperPositionTest from './swiper/SwiperPositionTest.test' +import swiperClipTest from './swiper/SwiperClipTest.test' +import swiperIndicatorTest from './swiper/SwiperIndicatorTest.test' +import swiperDisableSwipeTest from './swiper/SwiperDisableSwipeTest.test' +import swiperCachedCountTest from './swiper/SwiperCachedCountTest.test' +import toggleOnChangeTest from './toggle/ToggleOnChangeTest.test' +import toggleFocusableTest from './toggle/ToggleFocusableTest.test' +import scrollScrollBarTest from './scroll/ScrollScrollBarTest.test' +import scrollScrollBarColorTest from './scroll/ScrollScrollBarColorTest.test' +import scrollEnableScrollInteractionTest from './scroll/ScrollEnableScrollInteractionTest' +import scrollClipTest from './scroll/ScrollClipTest' +import scrollBackgroundColorTest from './scroll/ScrollBackgroundColorTest' +import scrollBorderWidthTest from './scroll/ScrollBorderWidthTest' +import scrollBorderColorTest from './scroll/ScrollBorderColorTest' +import scrollBorderRadiusTest from './scroll/ScrollBorderRadiusTest' +import scrollScrollAbleTest from './scroll/ScrollScrollAbleTest' +import scrollOpacityTest from './scroll/ScrollOpacityTest.test' +import scrollTranslateTest from './scroll/ScrollTranslateTest.test' +import scrollScaleTest from './scroll/ScrollScaleTest.test' +import scrollRotateTest from './scroll/ScrollRotateTest.test' +import scrollBrightnessTest from './scroll/ScrollBrightnessTest.test' +import scrollBlurTest from './scroll/ScrollBlurTest' +import scrollShadowTest from './scroll/ScrollShadowTest.test' +import scrollOnScrollFrameBeginTest from './scroll/ScrollOnScrollFrameBeginTest.test' +import scrollOnScrollTest from './scroll/ScrollOnScrollTest.test' +import scrollOnScrollStartTest from './scroll/ScrollOnScrollStartTest.test' +import scrollOnScrollStopTest from './scroll/ScrollOnScrollStopTest.test' +import scrollOnScrollEdgeTest from './scroll/ScrollOnScrollEdgeTest.test' +import scrollScrollEdgeTest from './scroll/ScrollScrollEdgeTest.test' +import scrollOnAppearTest from './scroll/ScrollOnAppearTest.test' +import scrollEdgeEffectTest from './scroll/ScrollEdgeEffectTest.test' +import scrollFrictionTest from './scroll/ScrollFrictionTest' +import scrollScrollSnapTest from './scroll/ScrollScrollSnapTest.test' +import scrollCurrentOffsetTest from './scroll/ScrollCurrentOffsetTest.test' +import scrollSaturateTest from './scroll/ScrollSaturateTest' +import scrollScrollToTest from './scroll/ScrollScrollToTest.test' +import scrollOverlayTest from './scroll/ScrollOverlayTest.test' +import scrollHitTestBehaviorTest from './scroll/ScrollHitTestBehaviorTest.test' +import scrollLinearGradientTest from './scroll/ScrollLinearGradientTest' +import stackBackgroundColorTest from './stack/StackBackgroundColorTest.test' +import stackBorderColorTest from './stack/StackBorderColorTest.test' +import stackBorderRadiusTest from './stack/StackBorderRadiusTest.test' +import stackBrightnessTest from './stack/StackBrightnessTest.test' +import stackSaturateTest from './stack/StackSaturateTest.test' +import stackOpacityTest from './stack/StackOpacityTest.test' +import stackScaleTest from './stack/StackScaleTest.test' +import stackClipTest from './stack/StackClipTest.test' +import stackRotateTest from './stack/StackRotateTest.test' +import stackTranslateTest from './stack/StackTranslateTest.test' +import stackTransitionTest from './stack/StackTransitionTest.test' +import stackBackgroundImageSizeTest from './stack/StackBackgroundImageSizeTest.test' +import stackBackgroundImagePositionTest from './stack/StackBackgroundImagePositionTest.test' +import stackBorderWidthTest from './stack/StackBorderWidthTest.test' +import stackBackgroundBlurStyleTest from './stack/StackBackgroundBlurStyleTest.test' +import stackShadowTest from './stack/StackShadowTest.test' +import stackLinearGradientTest from './stack/StackLinearGradientTest.test' +import stackIdTest from './stack/StackIdTest.test' +import stackBackgroundImageTest from './stack/StackBackgroundImageTest.test' +import stackHitTestBehaviorTest from './stack/StackHitTestBehaviorTest.test' +import stackOnAreaChangeTest from './stack/StackOnAreaChangeTest.test' +import stackOnTouchTest from './stack/StackOnTouchTest.test' +import stackMarginTest from './stack/StackMarginTest.test' +import stackAlignTest from './stack/StackAlignTest.test' +import stackWidthTest from './stack/StackWidthTest.test' +import stackHeightTest from './stack/StackHeightTest.test' +import stackPositionTest from './stack/StackPositionTest.test' +import stackBorderStyleTest from './stack/StackBorderStyleTest.test' +import stackTransformTest from './stack/StackTransformTest.test' +import textEnabledTest from './text/TextEnabledTest.test' +import textHeightTest from './text/TextHeightTest.test' +import textWidthTest from './text/TextWidthTest.test' +import textBackgroundImageTest from './text/TextBackgroundImageTest.test' +import textBackgroundColorTest from './text/TextBackgroundColorTest.test' +import textPositionTest from './text/TextPositionTest.test' +import textBorderWidthTest from './text/TextBorderWidthTest.test' +import textBorderColorTest from './text/TextBorderColorTest.test' +import textBorderRadiusTest from './text/TextBorderRadiusTest.test' +import textOpacityTest from './text/TextOpacityTest.test' +import textFontColorTest from './text/TextFontColorTest.test' +import textFontSizeTest from './text/TextFontSizeTest.test' +import textMaxLinesTest from './text/TextMaxLinesTest.test' +import textLineHeightTest from './text/TextLineHeightTest.test' +import textTextOverflowTest from './text/TextTextOverflowTest.test' +import textTextAlignTest from './text/TextTextAlignTest.test' +import textDecorationTest from './text/TextDecorationTest.test' +import textFontWeightTest from './text/TextFontWeightTest.test' +import textFontStyleTest from './text/TextFontStyleTest.test' +import textPaddingTest from './text/TextPaddingTest.test' +import textBaselineOffsetTest from './text/TextBaselineOffsetTest.test' +import textTextShadowTest from './text/TextTextShadowTest.test' +import textLetterSpacingTest from './text/TextLetterSpacingTest.test' +import textTextCaseTest from './text/TextTextCaseTest.test' +import textVisibilityTest from './text/TextVisibilityTest.test' +import textOffsetTest from './text/TextOffsetTest.test' +import textMaskTest from './text/TextMaskTest.test' +import textShadowTest from './text/TextShadowTest.test' +import textLinearGradientTest from './text/TextLinearGradientTest.test' +import textScaleTest from './text/TextScaleTest.test' +import textTransformTest from './text/TextTransformTest.test' +import textTextIndentTest from './text/TextTextIndentTest.test' +import textMinFontSizeTest from './text/TextMinFontSizeTest.test' +import textMaxFontSizeTest from './text/TextMaxFontSizeTest.test' +import textHeightAdaptivePolicyTest from './text/TextHeightAdaptivePolicyTest.test' +import textOverlayTest from './text/TextOverlayTest.test' +import textFontFamilyTest from './text/TextFontFamilyTest.test' +import textClipTest from './text/TextClipTest.test' +import textRadialGradientTest from './text/TextRadialGradientTest.test' +import textSweepGradientTest from './text/TextSweepGradientTest.test' +import textFontTest from './text/TextFontTest.test' +import textAlignTest from './text/TextAlignTest.test' +import textAlignRulesTest from './text/TextAlignRulesTest.test' +import imageWidthTest from './image/ImageWidthTest.test' +import imageHeightTest from './image/ImageHeightTest.test' +import imagePositionTest from './image/ImagePositionTest.test' +import imageBackgroundColorTest from './image/ImageBackgroundColorTest.test' +import imageBorderColorTest from './image/ImageBorderColorTest.test' +import imageBorderWidthTest from './image/ImageBorderWidthTest.test' +import imageBorderRadiusTest from './image/ImageBorderRadiusTest.test' +import imageOpacityTest from './image/ImageOpacityTest.test' +import imageHitTestBehaviorTest from './image/ImageHitTestBehaviorTest.test' +import imageRotateTest from './image/ImageRotateTest.test' +import imageScaleTest from './image/ImageScaleTest.test' +import imageTranslateTest from './image/ImageTranslateTest.test' +import imageBlurTest from './image/ImageBlurTest.test' +import imageBrightnessTest from './image/ImageBrightnessTest.test' +import imageSaturateTest from './image/ImageSaturateTest.test' +import imageAutoResizeTest from './image/ImageAutoResizeTest.test' +import imageLinearGradientTest from './image/ImageLinearGradientTest.test' +import imageShadowTest from './image/ImageShadowTest.test' +import imageInterpolationTest from './image/ImageInterpolationTest.test' +import imageObjectFitTest from './image/ImageObjectFitTest.test' +import imageObjectRepeatTest from './image/ImageObjectRepeatTest.test' +import imageSrcTest from './image/ImageSrcTest.test' +import imageBorderStyleTest from './image/ImageBorderStyleTest.test' +import imageColorFilterTest from './image/ImageColorFilterTest.test' +import imageIdTest from './image/ImageIdTest.test' +import imageClipTest from './image/ImageClipTest.test' +import imageTransformTest from './image/ImageTransformTest.test' +import imageAltTest from './image/ImageAltTest.test' +import imageOnCompleteTest from './image/ImageOnCompleteTest.test' +import imageOnErrorTest from './image/ImageOnErrorTest.test' +import imageRadialGradientTest from './image/ImageRadialGradientTest.test' +import imageSweepGradientTest from './image/ImageSweepGradientTest.test' +import listCachedCountTest from './list/ListCachedCountTest.test' +import textCopyOptionTest from './text/TextCopyOptionTest.test' +import textLineBreakStrategyTest from './text/TextLineBreakStrategyTest.test' +import scrollPageEnableTest from './scroll/ScrollPageEnableTest' +import spanTextCaseTest from './span/SpanTextCaseTest.test' +import spanLetterSpacingTest from './span/SpanLetterSpacingTest.test' +import spanDecorationTest from './span/SpanDecorationTest.test' +import spanLineHeightTest from './span/SpanLineHeightTest.test' +import columnWidthTest from './column/ColumnWidthTest.test' +import columnHeightTest from './column/ColumnHeightTest.test' +import columnForegroundBlurStyleTest from './column/ColumnForegroundBlurStyleTest.test' +import rowHeightTest from './row/RowHeightTest.test' +import sliderWidthTest from './slider/SliderWidthTest.test' +import sliderHeightTest from './slider/SliderHeightTest.test' +import sliderEnabledTest from './slider/SliderEnabledTest.test' +import columnPaddingTest from './column/ColumnPaddingTest.test' +import textAreaWidthTest from './textarea/TextAreaWidthTest.test' +import textAreaHeightTest from './textarea/TextAreaHeightTest.test' +import textAreaPositionTest from './textarea/TextAreaPositionTest.test' +import textAreaEnabledTest from './textarea/TextAreaEnabledTest.test' +import textInputHeightTest from './textinput/TextInputHeightTest.test' +import textInputWidthTest from './textinput/TextInputWidthTest.test' +import textInputPositionTest from './textinput/TextInputPositionTest.test' +import textInputShowPasswordIconTest from './textinput/TextInputShowPasswordIconTest.test' +import textInputSelectedBackgroundColorTest from './textinput/TextInputSelectedBackgroundColorTest.test' +import textInputCaretStyleTest from './textinput/TextInputCaretStyleTest.test' +import textInputEnabledTest from './textinput/TextInputEnabledTest.test' +import textInputEnterKeyTypeTest from './textinput/TextInputEnterKeyTypeTest.test' +import textInputTypeTest from './textinput/TextInputTypeTest.test' +import textInputOnChangeTest from './textinput/TextInputOnChangeTest.test' +import textInputEnableKeyboardOnFocusTest from './textinput/TextInputEnableKeyboardOnFocusTest.test' +import calendarPickerWidthTest from './calendarpicker/CalendarPickerWidthTest.test' +import calendarPickerEnabledTest from './calendarpicker/CalendarPickerEnabledTest.test' +import datePickerWidthTest from './datepicker/DatePickerWidthTest.test' +import datePickerEnabledTest from './datepicker/DatePickerEnabledTest.test' +import checkboxWidthTest from './checkbox/CheckboxWidthTest.test' +import checkboxHeightTest from './checkbox/CheckboxHeightTest.test' +import checkboxEnabledTest from './checkbox/CheckboxEnabledTest.test' +import xComponentWidthTest from './xcomponent/XComponentWidthTest.test' +import xComponentHeightTest from './xcomponent/XComponentHeightTest.test' +import textPickerWidthTest from './textpicker/TextPickerWidthTest.test' +import textPickerHeightTest from './textpicker/TextPickerHeightTest.test' +import flexWidthTest from './flex/FlexWidthTest.test' +import flexHeightTest from './flex/FlexHeightTest.test' +import imageSpanWidthTest from './imagespan/ImageSpanWidthTest.test' +import imageSpanHeightTest from './imagespan/ImageSpanHeightTest.test' +import imageSpanObjectFitTest from './imagespan/ImageSpanObjectFitTest.test' +import imageSpanVerticalAlignTest from './imagespan/ImageSpanVerticalAlignTest.test' +import imageSpanPaddingTest from './imagespan/ImageSpanPaddingTest.test' +import spanFontStyleTest from './span/SpanFontStyleTest.test' +import spanFontWeightTest from './span/SpanFontWeightTest.test' +import spanFontColorTest from './span/SpanFontColorTest.test' +import spanFontSizeTest from './span/SpanFontSizeTest.test' +import calendarPickerEdgeAlignTest from './calendarpicker/CalendarPickerEdgeAlignTest.test' +import calendarPickerTextStyleTest from './calendarpicker/CalendarPickerTextStyleTest.test' +import customDialogOpenTest from './customdialog/CustomDialogOpenTest.test' +import calendarPickerOnChangeTest from './calendarpicker/CalendarPickerOnChangeTest.test' +import datePickerLunarTest from './datepicker/DatePickerLunarTest.test' +import textPickerRangeTest from './textpicker/TextPickerRangeTest.test' +import textPickerSelectedTest from './textpicker/TextPickerSelectedTest.test' +import textPickerValueTest from './textpicker/TextPickerValueTest.test' +import textPickerDisappearTextStyleTest from './textpicker/TextPickerDisappearTextStyleTest.test' +import textPickerTextStyleTest from './textpicker/TextPickerTextStyleTest.test' +import textPickerSelectedTextStyleTest from './textpicker/TextPickerSelectedTextStyleTest.test' +import textPickerSelectedIndexTest from './textpicker/TextPickerSelectedIndexTest.test' +import textPickerCanLoopTest from './textpicker/TextPickerCanLoopTest.test' +import textPickerDefaultPickerItemHeightTest from './textpicker/TextPickerDefaultPickerItemHeightTest.test' +import textPickerOnChangeTest from './textpicker/TextPickerOnChangeTest.test' +import xComponentSourceIdTest from './xcomponent/XComponentSourceIdTest.test' +import xComponentTypeTest from './xcomponent/XComponentTypeTest.test' +import customDialogCloseTest from './customdialog/CustomDialogCloseTest.test' +import timePickerUseMilitaryTimeTest from './timepicker/TimePickerUseMilitaryTimeTest.test' +import customDialogAlignmentTest from './customdialog/CustomDialogAlignmentTest.test' +import customDialogCustomStyleTest from './customdialog/CustomDialogCustomStyleTest.test' +import customDialogMaskColorTest from './customdialog/CustomDialogMaskColorTest.test' +import datePickerOnDateChangeTest from './datepicker/DatePickerOnDateChangeTest.test' +import datePickerStartTest from './datepicker/DatePickerStartTest.test' +import datePickerEndTest from './datepicker/DatePickerEndTest.test' +import datePickerSelectedTest from './datepicker/DatePickerSelectedTest.test' +import datePickerSelectedTextStyleTest from './datepicker/DatePickerSelectedTextStyleTest.test' +import datePickerDisappearTextStyleTest from './datepicker/DatePickerDisappearTextStyleTest.test' +import datePickerTextStyleTest from './datepicker/DatePickerTextStyleTest.test' +import timePickerOnChangeTest from './timepicker/TimePickerOnChangeTest.test' +import timePickerHeightTest from './timepicker/TimePickerHeightTest.test' +import timePickerSelectedTest from './timepicker/TimePickerSelectedTest.test' +import timePickerTextStyleTest from './timepicker/TimePickerTextStyleTest.test' +import timePickerDisappearTextStyleTest from './timepicker/TimePickerDisappearTextStyleTest.test' +import timePickerSelectedTextStyleTest from './timepicker/TimePickerSelectedTextStyleTest.test' +import customComponentWidthTest from './customcomponent/CustomComponentWidthTest.test' +import customComponentHeightTest from './customcomponent/CustomComponentHeightTest.test' +import customComponentBackgroundColorTest from './customcomponent/CustomComponentBackgroundColorTest.test' +import customComponentPositionTest from './customcomponent/CustomComponentPositionTest.test' +import customComponentBorderWidthTest from './customcomponent/CustomComponentBorderWidthTest.test' +import customComponentBorderColorTest from './customcomponent/CustomComponentBorderColorTest.test' +import customComponentBorderRadiusTest from './customcomponent/CustomComponentBorderRadiusTest.test' +import customComponentBorderStyleTest from './customcomponent/CustomComponentBorderStyleTest.test' +import customComponentAlignTest from './customcomponent/CustomComponentAlignTest.test' +import customComponentDirectionTest from './customcomponent/CustomComponentDirectionTest.test' +import customComponentEnabledTest from './customcomponent/CustomComponentEnabledTest.test' +import customComponentFocusableTest from './customcomponent/CustomComponentFocusableTest.test' +import customComponentFlexBasisTest from './customcomponent/CustomComponentFlexBasisTest.test' +import customComponentFlexGrowTest from './customcomponent/CustomComponentFlexGrowTest.test' +import customComponentFlexShrinkTest from './customcomponent/CustomComponentFlexShrinkTest.test' +import customComponentAlignSelfTest from './customcomponent/CustomComponentAlignSelfTest.test' +import customComponentRadialGradientTest from './customcomponent/CustomComponentRadialGradientTest.test' +import customComponentSweepGradientTest from './customcomponent/CustomComponentSweepGradientTest.test' +import customComponentGrayscaleTest from './customcomponent/CustomComponentGrayscaleTest.test' +import customComponentHitTestBehaviorTest from './customcomponent/CustomComponentHitTestBehaviorTest.test' +import customComponentIdTest from './customcomponent/CustomComponentIdTest.test' +import customComponentOpacityTest from './customcomponent/CustomComponentOpacityTest.test' +import customComponentInvertTest from './customcomponent/CustomComponentInvertTest.test' +import customComponentSepiaTest from './customcomponent/CustomComponentSepiaTest.test' +import customComponentContrastTest from './customcomponent/CustomComponentContrastTest.test' +import customComponentClipTest from './customcomponent/CustomComponentClipTest.test' +import customComponentLinearGradientTest from './customcomponent/CustomComponentLinearGradientTest.test' +import customComponentShadowTest from './customcomponent/CustomComponentShadowTest.test' +import customComponentScaleTest from './customcomponent/CustomComponentScaleTest.test' +import customComponentMarginTest from './customcomponent/CustomComponentMarginTest.test' +import customComponentConstraintSizeTest from './customcomponent/CustomComponentConstraintSizeTest.test' +import customComponentTransformTest from './customcomponent/CustomComponentTransformTest.test' +import customComponentMaskTest from './customcomponent/CustomComponentMaskTest.test' +import customComponentBlendModeTest from './customcomponent/CustomComponentBlendModeTest.test' +import customComponentOnAppearTest from './customcomponent/CustomComponentOnAppearTest.test' +import customComponentOnAreaChangeTest from './customcomponent/CustomComponentOnAreaChangeTest.test' +import customComponentOnBlurTest from './customcomponent/CustomComponentOnBlurTest.test' +import customComponentOnFocusTest from './customcomponent/CustomComponentOnFocusTest.test' +import customComponentOnTouchTest from './customcomponent/CustomComponentOnTouchTest.test' +import customComponentOnClickTest from './customcomponent/CustomComponentOnClickTest.test' +import customComponentAccessibilityGroupTest from './customcomponent/CustomComponentAccessibilityGroupTest.test' +import customComponentAccessibilityTextTest from './customcomponent/CustomComponentAccessibilityTextTest.test' +import customComponentAccessibilityLevelTest from './customcomponent/CustomComponentAccessibilityLevelTest.test' +import customComponentAccessibilityDescriptionTest from './customcomponent/CustomComponentAccessibilityDescriptionTest.test' +import textInputAccessibilityGroupTest from './accessibility/TextInputAccessibilityGroupTest.test' +import textInputAccessibilityTextTest from './accessibility/TextInputAccessibilityTextTest.test' +import textInputAccessibilityLevelTest from './accessibility/TextInputAccessibilityLevelTest.test' +import textInputAccessibilityDescriptionTest from './accessibility/TextInputAccessibilityDescriptionTest.test' +import textAreaAccessibilityGroupTest from './accessibility/TextAreaAccessibilityGroupTest.test' +import textAreaAccessibilityTextTest from './accessibility/TextAreaAccessibilityTextTest.test' +import textAreaAccessibilityLevelTest from './accessibility/TextAreaAccessibilityLevelTest.test' +import textAreaAccessibilityDescriptionTest from './accessibility/TextAreaAccessibilityDescriptionTest.test' +import swiperAccessibilityGroupTest from './accessibility/SwiperAccessibilityGroupTest.test' +import swiperAccessibilityTextTest from './accessibility/SwiperAccessibilityTextTest.test' +import swiperAccessibilityLevelTest from './accessibility/SwiperAccessibilityLevelTest.test' +import swiperAccessibilityDescriptionTest from './accessibility/SwiperAccessibilityDescriptionTest.test' +import scrollAccessibilityGroupTest from './accessibility/ScrollAccessibilityGroupTest.test' +import scrollAccessibilityTextTest from './accessibility/ScrollAccessibilityTextTest.test' +import scrollAccessibilityLevelTest from './accessibility/ScrollAccessibilityLevelTest.test' +import scrollAccessibilityDescriptionTest from './accessibility/ScrollAccessibilityDescriptionTest.test' +import listAccessibilityGroupTest from './accessibility/ListAccessibilityGroupTest.test' +import listAccessibilityTextTest from './accessibility/ListAccessibilityTextTest.test' +import listAccessibilityLevelTest from './accessibility/ListAccessibilityLevelTest.test' +import listAccessibilityDescriptionTest from './accessibility/ListAccessibilityDescriptionTest.test' +import toggleAccessibilityGroupTest from './accessibility/ToggleAccessibilityGroupTest.test' +import toggleAccessibilityTextTest from './accessibility/ToggleAccessibilityTextTest.test' +import toggleAccessibilityLevelTest from './accessibility/ToggleAccessibilityLevelTest.test' +import toggleAccessibilityDescriptionTest from './accessibility/ToggleAccessibilityDescriptionTest.test' +import textAccessibilityGroupTest from './accessibility/TextAccessibilityGroupTest.test' +import textAccessibilityTextTest from './accessibility/TextAccessibilityTextTest.test' +import textAccessibilityLevelTest from './accessibility/TextAccessibilityLevelTest.test' +import textAccessibilityDescriptionTest from './accessibility/TextAccessibilityDescriptionTest.test' +import refreshAccessibilityGroupTest from './accessibility/RefreshAccessibilityGroupTest.test' +import refreshAccessibilityTextTest from './accessibility/RefreshAccessibilityTextTest.test' +import refreshAccessibilityLevelTest from './accessibility/RefreshAccessibilityLevelTest.test' +import refreshAccessibilityDescriptionTest from './accessibility/RefreshAccessibilityDescriptionTest.test' +import datePickerAccessibilityGroupTest from './accessibility/DatePickerAccessibilityGroupTest.test' +import datePickerAccessibilityTextTest from './accessibility/DatePickerAccessibilityTextTest.test' +import datePickerAccessibilityLevelTest from './accessibility/DatePickerAccessibilityLevelTest.test' +import datePickerAccessibilityDescriptionTest from './accessibility/DatePickerAccessibilityDescriptionTest.test' +import timePickerAccessibilityGroupTest from './accessibility/TimePickerAccessibilityGroupTest.test' +import timePickerAccessibilityTextTest from './accessibility/TimePickerAccessibilityTextTest.test' +import timePickerAccessibilityLevelTest from './accessibility/TimePickerAccessibilityLevelTest.test' +import timePickerAccessibilityDescriptionTest from './accessibility/TimePickerAccessibilityDescriptionTest.test' +import sliderAccessibilityGroupTest from './accessibility/SliderAccessibilityGroupTest.test' +import sliderAccessibilityTextTest from './accessibility/SliderAccessibilityTextTest.test' +import sliderAccessibilityLevelTest from './accessibility/SliderAccessibilityLevelTest.test' +import sliderAccessibilityDescriptionTest from './accessibility/SliderAccessibilityDescriptionTest.test' +import buttonAccessibilityGroupTest from './accessibility/ButtonAccessibilityGroupTest.test' +import buttonAccessibilityTextTest from './accessibility/ButtonAccessibilityTextTest.test' +import buttonAccessibilityLevelTest from './accessibility/ButtonAccessibilityLevelTest.test' +import buttonAccessibilityDescriptionTest from './accessibility/ButtonAccessibilityDescriptionTest.test' +import textPickerAccessibilityGroupTest from './accessibility/TextPickerAccessibilityGroupTest.test' +import textPickerAccessibilityTextTest from './accessibility/TextPickerAccessibilityTextTest.test' +import textPickerAccessibilityLevelTest from './accessibility/TextPickerAccessibilityLevelTest.test' +import textPickerAccessibilityDescriptionTest from './accessibility/TextPickerAccessibilityDescriptionTest.test' +import checkboxAccessibilityGroupTest from './accessibility/CheckboxAccessibilityGroupTest.test' +import checkboxAccessibilityTextTest from './accessibility/CheckboxAccessibilityTextTest.test' +import checkboxAccessibilityLevelTest from './accessibility/CheckboxAccessibilityLevelTest.test' +import checkboxAccessibilityDescriptionTest from './accessibility/CheckboxAccessibilityDescriptionTest.test' +import progressAccessibilityGroupTest from './accessibility/ProgressAccessibilityGroupTest.test' +import progressAccessibilityTextTest from './accessibility/ProgressAccessibilityTextTest.test' +import progressAccessibilityLevelTest from './accessibility/ProgressAccessibilityLevelTest.test' +import progressAccessibilityDescriptionTest from './accessibility/ProgressAccessibilityDescriptionTest.test' +import customComponentForegroundBlurStyleTest from './customcomponent/CustomComponentForegroundBlurStyleTest.test' +import textInputBackgroundColorTest from './textinput/TextInputBackgroundColorTest.test' +import textInputBackgroundImageTest from './textinput/TextInputBackgroundImageTest.test' +import textInputClipTest from './textinput/TextInputClipTest.test' +import textInputFontColorTest from './textinput/TextInputFontColorTest.test' +import textInputCaretColorTest from './textinput/TextInputCaretColorTest.test' +import textInputFontSizeTest from './textinput/TextInputFontSizeTest.test' +import textInputFontStyleTest from './textinput/TextInputFontStyleTest.test' +import textInputFontWeightTest from './textinput/TextInputFontWeightTest.test' +import textInputPaddingTest from './textinput/TextInputPaddingTest.test' +import textInputShowUnderLineTest from './textinput/TextInputShowUnderLineTest.test' +import textInputTextAlignTest from './textinput/TextInputTextAlignTest.test' +import textInputOnBlurTest from './textinput/TextInputOnBlurTest.test' +import textInputOnFocusTest from './textinput/TextInputOnFocusTest.test' +import textInputOnSubmitTest from './textinput/TextInputOnSubmitTest.test' +import textInputOnCutTest from './textinput/TextInputOnCutTest.test' +import textInputOnPasteTest from './textinput/TextInputOnPasteTest.test' +import textInputDefaultFocusTest from './textinput/TextInputDefaultFocusTest' +import sliderBlockColorTest from './slider/SliderBlockColorTest.test' +import sliderBlockStyleTest from './slider/SliderBlockStyleTest.test' +import sliderDirectionTest from './slider/SliderDirectionTest.test' +import sliderValueTest from './slider/SliderValueTest.test' +import sliderMinTest from './slider/SliderMinTest.test' +import sliderMaxTest from './slider/SliderMaxTest.test' +import sliderReverseTest from './slider/SliderReverseTest.test' +import sliderSelectedColorTest from './slider/SliderSelectedColorTest.test' +import sliderShowStepsTest from './slider/SliderShowStepsTest.test' +import sliderStepTest from './slider/SliderStepTest.test' +import sliderStyleTest from './slider/SliderStyleTest.test' +import sliderTrackColorTest from './slider/SliderTrackColorTest.test' +import sliderOnChangeTest from './slider/SliderOnChangeTest.test' +import textInputStopEditingTest from './textInput/TextInputStopEditingTest.test' +import textInputLineHeightTest from './textInput/TextInputLineHeightTest.test' +import textAreaFontColorTest from './textarea/TextAreaFontColorTest' +import textAreaFontFamilyTest from './textarea/TextAreaFontFamilyTest' +import textAreaFontSizeTest from './textarea/TextAreaFontSizeTest' +import textAreaFontStyleTest from './textarea/TextAreaFontStyleTest' +import textAreaFontWeightTest from './textarea/TextAreaFontWeightTest' +import textAreaMaxLengthTest from './textarea/TextAreaMaxLengthTest' +import textAreaTextAlignTest from './textarea/TextAreaTextAlignTest' +import textAreaPlaceHolderColorTest from './textarea/TextAreaPlaceHolderColorTest' +import textAreaPlaceHolderFontTest from './textarea/TextAreaPlaceholderFontTest' +import textAreaPaddingTest from './textarea/TextAreaPaddingTest' +import textAreaBackgroundColorTest from './textarea/TextAreaBackgroundColorTest' +import textAreaBorderRadiusTest from './textarea/TextAreaBorderRadiusTest' +import textAreaCaretColorTest from './textarea/TextAreaCaretColorTest' +import textAreaStopEditingTest from './textarea/TextAreaStopEditingTest' +import textAreaLineHeightTest from './textarea/TextAreaLineHeightTest' +import loadingProgressColorTest from './loadingprogress/LoadingProgressColorTest' +import loadingProgressEnableLoadingTest from './loadingprogress/LoadingProgressEnableLoadingTest' +import progressColorTest from './progress/ProgressColorTest' +import progressBackgroundColorTest from './progress/ProgressBackgroundColorTest' +import progressStyleTest from './progress/ProgressStyleTest' +import textAreaOnFocusTest from './textarea/TextAreaOnFocusTest' +import refreshOnStateChangeTest from './refresh/RefreshOnStateChangeTest' +import refreshOnRefreshingTest from './refresh/RefreshOnRefreshingTest' +import textAreaOnChangeTest from './textarea/TextAreaOnChangeTest' +import textInputMaxLengthTest from './textinput/TextInputMaxLengthTest' +import textInputPlaceholderColorTest from './textinput/TextInputPlaceholderColorTest' +import textInputPlaceholderFontTest from './textinput/TextInputPlaceholderFontTest' +import textInputFontFamilyTest from './textinput/TextInputFontFamilyTest' +import textInputClearButtonModeTest from './textinput/TextInputClearButtonModeTest' +import textInputResponseRegionTest from './textinput/TextInputResponseRegionTest' +import textAreaResponseRegionTest from './textarea/TextAreaResponseRegionTest' +import textAreaDefaultFocusTest from './textarea/TextAreaDefaultFocusTest' +import textAreaOnBlurTest from './textarea/TextAreaOnBlurTest' +import textInputKeyTest from './textinput/TextInputKeyTest' +import textAreaKeyTest from './textarea/TextAreaKeyTest' +import listEdgeEffectTest from './list/ListEdgeEffectTest.test' +import listItemEdgeEffectTest from './listitem/ListItemEdgeEffectTest.test' +import swiperDurationTest from './swiper/SwiperDurationTest.test' +import swiperCurveTest from './swiper/SwiperCurveTest.test' +import swiperIntervalTest from './swiper/SwiperIntervalTest.test' +import swiperLoopTest from './swiper/SwiperLoopTest.test' +export default function testsuite() { + swiperDurationTest() + swiperLoopTest() + swiperIntervalTest() + swiperCurveTest() + listEdgeEffectTest() + listItemEdgeEffectTest() + textInputDefaultFocusTest() + buttonOnClickTest() + buttonFontSizeTest() + buttonFontColorTest() + buttonFontWeightTest() + buttonBackgroundColorTest() + checkboxSelectTest() + checkboxSelectedColorTest() + checkboxUnselectedColorTest() + checkboxMarkTest() + checkboxShapeTest() + checkboxOnChangeTest() + timePickerTextStyleTest() + timePickerDisappearTextStyleTest() + timePickerSelectedTextStyleTest() + timePickerSelectedTest() + timePickerHeightTest() + timePickerOnChangeTest() + datePickerTextStyleTest() + datePickerDisappearTextStyleTest() + datePickerSelectedTextStyleTest() + datePickerSelectedTest() + datePickerEndTest() + datePickerStartTest() + customDialogCloseTest() + timePickerUseMilitaryTimeTest() + customDialogAlignmentTest() + customDialogCustomStyleTest() + customDialogMaskColorTest() + datePickerOnDateChangeTest() + commonAttrsWidthTest() + commonAttrsHeightTest() + commonAttrsBackgroundColorTest() + commonAttrsPositionTest() + commonAttrsBorderWidthTest() + commonAttrsBorderColorTest() + commonAttrsBorderRadiusTest() + commonAttrsBorderStyleTest() + commonAttrsAlignTest() + commonAttrsDirectionTest() + commonAttrsEnabledTest() + commonAttrsFocusableTest() + commonAttrsForegroundBlurStyleTest() + commonEventOnAppearTest() + commonEventOnAreaChangeTest() + commonEventOnBlurTest() + commonEventOnFocusTest() + commonEventOnTouchTest() + commonEventOnClickTest() + commonAttrsFlexBasisTest() + commonAttrsFlexGrowTest() + commonAttrsFlexShrinkTest() + commonAttrsAlignSelfTest() + commonAttrsAlignContentTest() + commonAttrsJustifyContentTest() + commonAttrsAlignItemsTest() + commonAttrsRadialGradientTest() + commonAttrsSweepGradientTest() + commonAttrsGrayscaleTest() + commonAttrsHitTestBehaviorTest() + commonAttrsIdTest() + commonAttrsOpacityTest() + commonAttrsInvertTest() + commonAttrsSepiaTest() + commonAttrsContrastTest() + commonAttrsClipTest() + commonAttrsLinearGradientTest() + commonAttrsShadowTest() + commonAttrsScaleTest() + commonAttrsMarginTest() + commonAttrsConstraintSizeTest() + commonAttrsTransformTest() + commonAttrsMaskTest() + commonAttrsBlendModeTest() + listHeightTest() + listWidthTest() + listBackgroundColorTest() + listBorderWidthTest() + listBorderColorTest() + listBorderRadiusTest() + listOpacityTest() + listClipTest() + listHitTestBehaviorTest() + listTranslateTest() + listScaleTest() + listRotateTest() + listBrightnessTest() + listSaturateTest() + listBlurTest() + listShadowTest() + listScrollBarTest() + listLinearGradientTest() + listListDirectionTest() + listStickyTest() + listFrictionTest() + listCachedCountTest() + listEnableScrollInteractionTest() + listItemHeightTest() + listItemWidthTest() + listItemBackgroundColorTest() + listItemBorderWidthTest() + listItemBorderColorTest() + listItemBorderRadiusTest() + listItemOpacityTest() + listItemClipTest() + listItemHitTestBehaviorTest() + listItemTranslateTest() + listItemScaleTest() + listItemRotateTest() + listItemBrightnessTest() + listItemSaturateTest() + listItemBlurTest() + listItemShadowTest() + listItemLinearGradientTest() + scrollWidthTest() + scrollHeightTest() + scrollPositionTest() + scrollNestedScrollTest() + scrollScrollBarTest() + scrollScrollBarColorTest() + scrollEnableScrollInteractionTest() + scrollClipTest() + scrollBackgroundColorTest() + scrollBorderWidthTest() + scrollBorderColorTest() + scrollBorderRadiusTest() + scrollScrollAbleTest() + scrollOpacityTest() + scrollTranslateTest() + scrollScaleTest() + scrollRotateTest() + scrollBrightnessTest() + scrollBlurTest() + scrollShadowTest() + scrollOnScrollFrameBeginTest() + scrollOnScrollTest() + scrollOnScrollStartTest() + scrollOnScrollEdgeTest() + scrollScrollEdgeTest() + scrollOnAppearTest() + scrollOnScrollStopTest() + scrollEdgeEffectTest() + scrollFrictionTest() + scrollScrollSnapTest() + scrollCurrentOffsetTest() + scrollScrollToTest() + scrollOverlayTest() + scrollHitTestBehaviorTest() + scrollLinearGradientTest() + scrollSaturateTest() + scrollPageEnableTest() + toggleMarginTest() + toggleEnabledTest() + swiperVerticalTest() + swiperDisplayArrowTest() + swiperItemSpaceTest() + toggleWidthTest() + toggleHeightTest() + swiperDisplayCountTest() + swiperIndexTest() + toggleBackgroundColorTest() + toggleSwitchPointColorTest() + toggleSelectedColorTest() + togglePositionTest() + toggleSwitchTest() + toggleOnChangeTest() + toggleFocusableTest() + toggleClipTest() + swiperBackgroundColorTest() + swiperAutoPlayTest() + swiperBackgroundImageTest() + swiperWidthTest() + swiperHeightTest() + swiperPositionTest() + swiperClipTest() + swiperIndicatorTest() + swiperDisableSwipeTest() + swiperCachedCountTest() + stackBackgroundColorTest() + stackHitTestBehaviorTest() + stackBorderColorTest() + stackBorderRadiusTest() + stackBrightnessTest() + stackSaturateTest() + stackOpacityTest() + stackScaleTest() + stackClipTest() + stackRotateTest() + stackTranslateTest() + stackTransitionTest() + stackBackgroundImageSizeTest() + stackBackgroundImagePositionTest() + stackBorderWidthTest() + stackBackgroundBlurStyleTest() + stackShadowTest() + stackLinearGradientTest() + stackIdTest() + stackBackgroundImageTest() + stackOnAreaChangeTest() + stackOnTouchTest() + stackMarginTest() + stackAlignTest() + stackWidthTest() + stackHeightTest() + stackPositionTest() + stackBorderStyleTest() + stackTransformTest() + textWidthTest() + textHeightTest() + textPositionTest() + textEnabledTest() + textBackgroundColorTest() + textBackgroundImageTest() + textBorderWidthTest() + textBorderColorTest() + textBorderRadiusTest() + textOpacityTest() + textFontColorTest() + textFontSizeTest() + textMaxLinesTest() + textLineHeightTest() + textMaxLinesTest() + textTextOverflowTest() + textTextAlignTest() + textAlignRulesTest() + textDecorationTest() + textFontWeightTest() + textFontStyleTest() + textPaddingTest() + textBaselineOffsetTest() + textTextShadowTest() + textLetterSpacingTest() + textTextCaseTest() + textVisibilityTest() + textOffsetTest() + textMaskTest() + textShadowTest() + textLinearGradientTest() + textScaleTest() + textTransformTest() + textTextIndentTest() + textMinFontSizeTest() + textMaxFontSizeTest() + textHeightAdaptivePolicyTest() + textOverlayTest() + textFontFamilyTest() + textClipTest() + textRadialGradientTest() + textSweepGradientTest() + textFontTest() + textAlignTest() + textLineBreakStrategyTest() + textCopyOptionTest() + imageWidthTest() + imageHeightTest() + imagePositionTest() + imageBackgroundColorTest() + imageBorderColorTest() + imageBorderWidthTest() + imageBorderRadiusTest() + imageOpacityTest() + imageHitTestBehaviorTest() + imageRotateTest() + imageScaleTest() + imageTranslateTest() + imageBlurTest() + imageBrightnessTest() + imageSaturateTest() + imageAutoResizeTest() + imageLinearGradientTest() + imageShadowTest() + imageInterpolationTest() + imageObjectFitTest() + imageObjectRepeatTest() + imageBorderStyleTest() + imageColorFilterTest() + imageSrcTest() + imageIdTest() + imageClipTest() + imageTransformTest() + imageAltTest() + imageRadialGradientTest() + imageSweepGradientTest() + imageOnCompleteTest() + imageOnErrorTest() + spanLetterSpacingTest() + spanTextCaseTest() + spanDecorationTest() + spanLineHeightTest() + columnWidthTest() + columnHeightTest() + columnForegroundBlurStyleTest() + rowHeightTest() + sliderWidthTest() + sliderHeightTest() + sliderEnabledTest() + columnPaddingTest() + textAreaWidthTest() + textAreaHeightTest() + textAreaPositionTest() + textAreaEnabledTest() + textInputWidthTest() + textInputHeightTest() + textInputPositionTest() + textInputShowPasswordIconTest() + textInputSelectedBackgroundColorTest() + textInputCaretStyleTest() + textInputEnabledTest() + textInputEnterKeyTypeTest() + textInputTypeTest() + textInputOnChangeTest() + textInputEnableKeyboardOnFocusTest() + calendarPickerWidthTest() + calendarPickerEnabledTest() + datePickerWidthTest() + datePickerEnabledTest() + checkboxWidthTest() + checkboxHeightTest() + checkboxEnabledTest() + xComponentWidthTest() + xComponentHeightTest() + textPickerWidthTest() + textPickerHeightTest() + flexWidthTest() + flexHeightTest() + imageSpanWidthTest() + imageSpanHeightTest() + imageSpanObjectFitTest() + imageSpanVerticalAlignTest() + imageSpanPaddingTest() + spanFontStyleTest() + spanFontWeightTest() + spanFontColorTest() + spanFontSizeTest() + calendarPickerEdgeAlignTest() + calendarPickerTextStyleTest() + textCopyOptionTest() + customDialogOpenTest() + calendarPickerOnChangeTest() + datePickerLunarTest() + textPickerRangeTest() + textPickerSelectedTest() + textPickerValueTest() + textPickerDisappearTextStyleTest() + textPickerTextStyleTest() + textPickerSelectedTextStyleTest() + textPickerSelectedIndexTest() + textPickerCanLoopTest() + textPickerDefaultPickerItemHeightTest() + textPickerOnChangeTest() + xComponentSourceIdTest() + xComponentTypeTest() + customComponentWidthTest() + customComponentHeightTest() + customComponentBackgroundColorTest() + customComponentPositionTest() + customComponentBorderWidthTest() + customComponentBorderColorTest() + customComponentBorderRadiusTest() + customComponentBorderStyleTest() + customComponentAlignTest() + customComponentDirectionTest() + customComponentEnabledTest() + customComponentFocusableTest() + customComponentOnAppearTest() + customComponentOnAreaChangeTest() + customComponentOnBlurTest() + customComponentOnFocusTest() + customComponentOnTouchTest() + customComponentOnClickTest() + customComponentFlexBasisTest() + customComponentFlexGrowTest() + customComponentFlexShrinkTest() + customComponentAlignSelfTest() + customComponentRadialGradientTest() + customComponentSweepGradientTest() + customComponentGrayscaleTest() + customComponentHitTestBehaviorTest() + customComponentIdTest() + customComponentOpacityTest() + customComponentInvertTest() + customComponentSepiaTest() + customComponentContrastTest() + customComponentClipTest() + customComponentLinearGradientTest() + customComponentShadowTest() + customComponentScaleTest() + customComponentMarginTest() + customComponentConstraintSizeTest() + customComponentTransformTest() + customComponentMaskTest() + customComponentBlendModeTest() + customComponentAccessibilityGroupTest() + customComponentAccessibilityTextTest() + customComponentAccessibilityLevelTest() + customComponentAccessibilityDescriptionTest() + customComponentForegroundBlurStyleTest() + textInputAccessibilityGroupTest() + textInputAccessibilityTextTest() + textInputAccessibilityLevelTest() + textInputAccessibilityDescriptionTest() + textAreaAccessibilityGroupTest() + textAreaAccessibilityTextTest() + textAreaAccessibilityLevelTest() + textAreaAccessibilityDescriptionTest() + swiperAccessibilityGroupTest() + swiperAccessibilityTextTest() + swiperAccessibilityLevelTest() + swiperAccessibilityDescriptionTest() + scrollAccessibilityGroupTest() + scrollAccessibilityTextTest() + scrollAccessibilityLevelTest() + scrollAccessibilityDescriptionTest() + listAccessibilityGroupTest() + listAccessibilityTextTest() + listAccessibilityLevelTest() + listAccessibilityDescriptionTest() + toggleAccessibilityGroupTest() + toggleAccessibilityTextTest() + toggleAccessibilityLevelTest() + toggleAccessibilityDescriptionTest() + textAccessibilityGroupTest() + textAccessibilityTextTest() + textAccessibilityLevelTest() + textAccessibilityDescriptionTest() + refreshAccessibilityGroupTest() + refreshAccessibilityTextTest() + refreshAccessibilityLevelTest() + refreshAccessibilityDescriptionTest() + datePickerAccessibilityGroupTest() + datePickerAccessibilityTextTest() + datePickerAccessibilityLevelTest() + datePickerAccessibilityDescriptionTest() + timePickerAccessibilityGroupTest() + timePickerAccessibilityTextTest() + timePickerAccessibilityLevelTest() + timePickerAccessibilityDescriptionTest() + sliderAccessibilityGroupTest() + sliderAccessibilityTextTest() + sliderAccessibilityLevelTest() + sliderAccessibilityDescriptionTest() + buttonAccessibilityGroupTest() + buttonAccessibilityTextTest() + buttonAccessibilityLevelTest() + buttonAccessibilityDescriptionTest() + textPickerAccessibilityGroupTest() + textPickerAccessibilityTextTest() + textPickerAccessibilityLevelTest() + textPickerAccessibilityDescriptionTest() + checkboxAccessibilityGroupTest() + checkboxAccessibilityTextTest() + checkboxAccessibilityLevelTest() + checkboxAccessibilityDescriptionTest() + progressAccessibilityGroupTest() + progressAccessibilityTextTest() + progressAccessibilityLevelTest() + progressAccessibilityDescriptionTest() + textInputBackgroundColorTest() + textInputBackgroundImageTest() + textInputClipTest() + textInputFontColorTest() + textInputCaretColorTest() + textInputFontSizeTest() + textInputFontStyleTest() + textInputFontWeightTest() + textInputPaddingTest() + textInputShowUnderLineTest() + textInputTextAlignTest() + textInputOnFocusTest() + textInputOnBlurTest() + textInputOnSubmitTest() + textInputOnCutTest() + textInputOnPasteTest() + customComponentOnMeasureTest() + customComponentOnLayoutTest() + customComponentOnDrawTest() + sliderBlockColorTest() + sliderBlockStyleTest() + sliderDirectionTest() + sliderValueTest() + sliderMinTest() + sliderMaxTest() + sliderReverseTest() + sliderSelectedColorTest() + sliderShowStepsTest() + sliderStepTest() + sliderStyleTest() + sliderTrackColorTest() + sliderOnChangeTest() + textInputStopEditingTest() + textInputLineHeightTest() + textAreaFontColorTest() + textAreaFontFamilyTest() + textAreaFontSizeTest() + textAreaFontStyleTest() + textAreaFontWeightTest() + textAreaMaxLengthTest() + textAreaTextAlignTest() + textAreaPlaceHolderColorTest() + textAreaPlaceHolderFontTest() + textAreaPaddingTest() + textAreaBackgroundColorTest() + textAreaBorderRadiusTest() + textAreaCaretColorTest() + textAreaStopEditingTest() + textAreaLineHeightTest() + textAreaOnChangeTest() + loadingProgressColorTest() + loadingProgressEnableLoadingTest() + progressColorTest() + progressBackgroundColorTest() + progressStyleTest() + textAreaOnFocusTest() + refreshOnStateChangeTest() + refreshOnRefreshingTest() + textInputMaxLengthTest() + textInputPlaceholderColorTest() + textInputPlaceholderFontTest() + textInputFontFamilyTest() + textInputClearButtonModeTest() + textInputResponseRegionTest() + textAreaResponseRegionTest() + textAreaDefaultFocusTest() + textAreaOnBlurTest() + textInputKeyTest() + textAreaKeyTest() +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f0f4b9272d9c320da3fa4b212c225cd61d9363a8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function buttonAccessibilityDescriptionTest() { + + describe('ButtonAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件AccessibilityDescription属性为"test" + it('testButtonAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Button组件AccessibilityDescription属性为"" + it('testButtonAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..014749016c5bd0d020832fdac2d038fa44ea75f4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function buttonAccessibilityGroupTest() { + + describe('ButtonAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件AccessibilityGroup属性为true + it('testButtonAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Button组件AccessibilityGroup属性为false + it('testButtonAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf5d27c08f4437e70cca40fff076a1e9cf875f21 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function buttonAccessibilityLevelTest() { + + describe('ButtonAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件AccessibilityLevel属性为AUTO + it('testButtonAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Button组件AccessibilityLevel属性为ENABLED + it('testButtonAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Button组件AccessibilityLevel属性为DISABLED + it('testButtonAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Button组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testButtonAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Button组件AccessibilityLevel属性为-10 + it('testButtonAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Button组件AccessibilityLevel属性为10 + it('testButtonAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..79af646760929023c3c5ec3a6030c50156d53f83 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ButtonAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function buttonAccessibilityTextTest() { + + describe('ButtonAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件AccessibilityText属性为"test" + it('testButtonAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Button组件AccessibilityText属性为"" + it('testButtonAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'ButtonAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2de4f98b9018d5d1080b52d5dcf30077ef629bda --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxAccessibilityDescriptionTest() { + + describe('CheckboxAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Checkbox组件AccessibilityDescription属性为"test" + it('testCheckboxAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Checkbox组件AccessibilityDescription属性为"" + it('testCheckboxAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8220347afe8a7be63ceabe03be3a2a8739f60aee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxAccessibilityGroupTest() { + + describe('CheckboxAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Checkbox组件AccessibilityGroup属性为true + it('testCheckboxAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Checkbox组件AccessibilityGroup属性为false + it('testCheckboxAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..90d0082cf50b1ae35fa591f06859c68345d7efd2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxAccessibilityLevelTest() { + + describe('CheckboxAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Checkbox组件AccessibilityLevel属性为AUTO + it('testCheckboxAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Checkbox组件AccessibilityLevel属性为ENABLED + it('testCheckboxAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Checkbox组件AccessibilityLevel属性为DISABLED + it('testCheckboxAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Checkbox组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testCheckboxAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Checkbox组件AccessibilityLevel属性为-10 + it('testCheckboxAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Checkbox组件AccessibilityLevel属性为10 + it('testCheckboxAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7bd75778f9fbc3e5a6e24c223af1d86e05eb2003 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/CheckboxAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxAccessibilityTextTest() { + + describe('CheckboxAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Checkbox组件AccessibilityText属性为"test" + it('testCheckboxAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Checkbox组件AccessibilityText属性为"" + it('testCheckboxAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'CheckboxAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8a99ff166612ac237dabd117da9be87958c99fb5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerAccessibilityDescriptionTest() { + + describe('DatePickerAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件AccessibilityDescription属性为"test" + it('testDatePickerAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // DatePicker组件AccessibilityDescription属性为"" + it('testDatePickerAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..41ed4f85a940f9fb35520d2c94c754ff7e67e3a1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerAccessibilityGroupTest() { + + describe('DatePickerAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件AccessibilityGroup属性为true + it('testDatePickerAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // DatePicker组件AccessibilityGroup属性为false + it('testDatePickerAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d5a2cf206fae60bb90801414fc9c44a933a905c7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityLevelTest.test.ets @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerAccessibilityLevelTest() { + + describe('DatePickerAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件AccessibilityLevel属性为AUTO + it('testDatePickerAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // DatePicker组件AccessibilityLevel属性为ENABLED + it('testDatePickerAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // DatePicker组件AccessibilityLevel属性为DISABLED + it('testDatePickerAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // DatePicker组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testDatePickerAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + + // DatePicker组件AccessibilityLevel属性为-10 + it('testDatePickerAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // DatePicker组件AccessibilityLevel属性为10 + it('testDatePickerAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0316271f53d00a9ad73841c607e3e97af162cd5d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/DatePickerAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerAccessibilityTextTest() { + + describe('DatePickerAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件AccessibilityText属性为"test" + it('testDatePickerAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // DatePicker组件AccessibilityText属性为"" + it('testDatePickerAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..23ee685f3152ae566d28ad5313c6fbb83cb85043 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listAccessibilityDescriptionTest() { + + describe('ListAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // List组件AccessibilityDescription属性为"test" + it('testListAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // List组件AccessibilityDescription属性为"" + it('testListAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b755997e5561d31f8c33cb5939cf0105736629e1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listAccessibilityGroupTest() { + + describe('ListAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // List组件AccessibilityGroup属性为true + it('testListAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // List组件AccessibilityGroup属性为false + it('testListAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b1fb65ac2bcb990a37dba4b818392dd642617e7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listAccessibilityLevelTest() { + + describe('ListAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // List组件AccessibilityLevel属性为AUTO + it('testListAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // List组件AccessibilityLevel属性为ENABLED + it('testListAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // List组件AccessibilityLevel属性为DISABLED + it('testListAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // List组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testListAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // List组件AccessibilityLevel属性为-10 + it('testListAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // List组件AccessibilityLevel属性为10 + it('testListAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a242a5b22e66819be4769e45ecea9ecdb815802 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ListAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listAccessibilityTextTest() { + + describe('ListAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // List组件AccessibilityText属性为"test" + it('testListAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // List组件AccessibilityText属性为"" + it('testListAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'ListAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9dec4e03ecfb6644876494cd37fbdf5ed81ab82b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function progressAccessibilityDescriptionTest() { + + describe('ProgressAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Progress组件AccessibilityDescription属性为"test" + it('testProgressAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Progress组件AccessibilityDescription属性为"" + it('testProgressAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..42abae7a572f77fa8759e7b61e7d7c7a013b3084 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function progressAccessibilityGroupTest() { + + describe('ProgressAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Progress组件AccessibilityGroup属性为true + it('testProgressAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Progress组件AccessibilityGroup属性为false + it('testProgressAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8aa5522d67b0d54835d7b8970b73519496c22a83 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function progressAccessibilityLevelTest() { + + describe('ProgressAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Progress组件AccessibilityLevel属性为AUTO + it('testProgressAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Progress组件AccessibilityLevel属性为ENABLED + it('testProgressAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Progress组件AccessibilityLevel属性为DISABLED + it('testProgressAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Progress组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testProgressAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Progress组件AccessibilityLevel属性为-10 + it('testProgressAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Progress组件AccessibilityLevel属性为10 + it('testProgressAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..eed9002473245802f2e19362080ea24d114084d8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ProgressAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function progressAccessibilityTextTest() { + + describe('ProgressAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Progress组件AccessibilityText属性为"test" + it('testProgressAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Progress组件AccessibilityText属性为"" + it('testProgressAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8505d6312dd35c55df0ab8a7fc00d275c780ab88 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function refreshAccessibilityDescriptionTest() { + + describe('RefreshAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Refresh组件AccessibilityDescription属性为"test" + it('testRefreshAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Refresh组件AccessibilityDescription属性为"" + it('testRefreshAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..82cc393a947d6e8549c4c6e2017af2e87b3b6a74 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function refreshAccessibilityGroupTest() { + + describe('RefreshAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Refresh组件AccessibilityGroup属性为true + it('testRefreshAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Refresh组件AccessibilityGroup属性为false + it('testRefreshAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d31cfb7274d58ffbcfdace9d71819f26e49df2f3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function refreshAccessibilityLevelTest() { + + describe('RefreshAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Refresh组件AccessibilityLevel属性为AUTO + it('testRefreshAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Refresh组件AccessibilityLevel属性为ENABLED + it('testRefreshAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Refresh组件AccessibilityLevel属性为DISABLED + it('testRefreshAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Refresh组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testRefreshAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Refresh组件AccessibilityLevel属性为-10 + it('testRefreshAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Refresh组件AccessibilityLevel属性为10 + it('testRefreshAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8de610049b4bab1e37370d586f74c441957bffc5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/RefreshAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function refreshAccessibilityTextTest() { + + describe('RefreshAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Refresh组件AccessibilityText属性为"test" + it('testRefreshAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Refresh组件AccessibilityText属性为"" + it('testRefreshAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d7a369314bf0bab9086c453781c61b015bf1c27c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollAccessibilityDescriptionTest() { + + describe('ScrollAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件AccessibilityDescription属性为"test" + it('testScrollAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Scroll组件AccessibilityDescription属性为"" + it('testScrollAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ef976bb0e3bd2a67d8c98ca3af771d30f26a5c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollAccessibilityGroupTest() { + + describe('ScrollAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件AccessibilityGroup属性为true + it('testScrollAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Scroll组件AccessibilityGroup属性为false + it('testScrollAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..846365391f95031ca48d401328e1c2de96b25557 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollAccessibilityLevelTest() { + + describe('ScrollAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件AccessibilityLevel属性为AUTO + it('testScrollAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Scroll组件AccessibilityLevel属性为ENABLED + it('testScrollAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Scroll组件AccessibilityLevel属性为DISABLED + it('testScrollAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Scroll组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testScrollAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Scroll组件AccessibilityLevel属性为-10 + it('testScrollAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Scroll组件AccessibilityLevel属性为10 + it('testScrollAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..137d9a162c9423a5a5dbda213d19344453373886 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ScrollAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollAccessibilityTextTest() { + + describe('ScrollAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件AccessibilityText属性为"test" + it('testScrollAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Scroll组件AccessibilityText属性为"" + it('testScrollAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e58365bf0953ce0cc4231159ef5bacff13cacdf2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderAccessibilityDescriptionTest() { + + describe('SliderAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Slider组件AccessibilityDescription属性为"test" + it('testSliderAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Slider组件AccessibilityDescription属性为"" + it('testSliderAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d9e8eef40f09bfde2c89b2b69a6b859eb59eceda --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderAccessibilityGroupTest() { + + describe('SliderAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Slider组件AccessibilityGroup属性为true + it('testSliderAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Slider组件AccessibilityGroup属性为false + it('testSliderAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b13e2dbe01acd02cca89985d3699fb468e80cdd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderAccessibilityLevelTest() { + + describe('SliderAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Slider组件AccessibilityLevel属性为AUTO + it('testSliderAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Slider组件AccessibilityLevel属性为ENABLED + it('testSliderAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Slider组件AccessibilityLevel属性为DISABLED + it('testSliderAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Slider组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testSliderAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Slider组件AccessibilityLevel属性为-10 + it('testSliderAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Slider组件AccessibilityLevel属性为10 + it('testSliderAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..25012ae5fc22eb92039456661b91e1d592c97ef9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SliderAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderAccessibilityTextTest() { + + describe('SliderAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Slider组件AccessibilityText属性为"test" + it('testSliderAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Slider组件AccessibilityText属性为"" + it('testSliderAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..db8336267ff0f3702cc304980a1ea07f528cb931 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperAccessibilityDescriptionTest() { + + describe('SwiperAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Swiper组件AccessibilityDescription属性为"test" + it('testSwiperAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Swiper组件AccessibilityDescription属性为"" + it('testSwiperAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9f550e0fd47688538beb5f43b9c6907c1e3ff74b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperAccessibilityGroupTest() { + + describe('SwiperAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Swiper组件AccessibilityGroup属性为true + it('testSwiperAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Swiper组件AccessibilityGroup属性为false + it('testSwiperAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7fe1fe664f19df198a145cdd2d2d6f9b32f0bcad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperAccessibilityLevelTest() { + + describe('SwiperAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Swiper组件AccessibilityLevel属性为AUTO + it('testSwiperAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Swiper组件AccessibilityLevel属性为ENABLED + it('testSwiperAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Swiper组件AccessibilityLevel属性为DISABLED + it('testSwiperAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Swiper组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testSwiperAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Swiper组件AccessibilityLevel属性为-10 + it('testSwiperAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Swiper组件AccessibilityLevel属性为10 + it('testSwiperAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..100df058704f4466977e94394a4b8cde09c56918 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/SwiperAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperAccessibilityTextTest() { + + describe('SwiperAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Swiper组件AccessibilityText属性为"test" + it('testSwiperAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Swiper组件AccessibilityText属性为"" + it('testSwiperAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'SwiperAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0eff90adf4e189078e5345f6f525a76121a1cb0a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAccessibilityDescriptionTest() { + + describe('TextAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件AccessibilityDescription属性为"test" + it('testTextAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Text组件AccessibilityDescription属性为"" + it('testTextAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab9af2b5c4785753d18fba64e2d0ca8ff4e76d45 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAccessibilityGroupTest() { + + describe('TextAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件AccessibilityGroup属性为true + it('testTextAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Text组件AccessibilityGroup属性为false + it('testTextAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9c4385ff889128900d56630a4674825901f88319 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAccessibilityLevelTest() { + + describe('TextAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件AccessibilityLevel属性为AUTO + it('testTextAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Text组件AccessibilityLevel属性为ENABLED + it('testTextAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Text组件AccessibilityLevel属性为DISABLED + it('testTextAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Text组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testTextAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Text组件AccessibilityLevel属性为-10 + it('testTextAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Text组件AccessibilityLevel属性为10 + it('testTextAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f9da4edc30f4b196652c1642dc7e578e38bb7b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAccessibilityTextTest() { + + describe('TextAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件AccessibilityText属性为"test" + it('testTextAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Text组件AccessibilityText属性为"" + it('testTextAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ddc9f09d4914ea3b1645a26962bb12301db6587 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaAccessibilityDescriptionTest() { + + describe('TextAreaAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件AccessibilityDescription属性为"test" + it('testTextAreaAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextArea组件AccessibilityDescription属性为"" + it('testTextAreaAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0e0afe3ff8023522f68e1e3653fe7a8c8a289eb1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaAccessibilityGroupTest() { + + describe('TextAreaAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件AccessibilityGroup属性为true + it('testTextAreaAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextArea组件AccessibilityGroup属性为false + it('testTextAreaAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0fad69c1b6aa3c0ecdc021463b8413a50136e4e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaAccessibilityLevelTest() { + + describe('TextAreaAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件AccessibilityLevel属性为AUTO + it('testTextAreaAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextArea组件AccessibilityLevel属性为ENABLED + it('testTextAreaAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextArea组件AccessibilityLevel属性为DISABLED + it('testTextAreaAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextArea组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testTextAreaAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextArea组件AccessibilityLevel属性为-10 + it('testTextAreaAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextArea组件AccessibilityLevel属性为10 + it('testTextAreaAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9f21ac6850ffebf32f472e1b9e1e9b82f153c031 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextAreaAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaAccessibilityTextTest() { + + describe('TextAreaAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件AccessibilityText属性为"test" + it('testTextAreaAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextArea组件AccessibilityText属性为"" + it('testTextAreaAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9f72a7f24b692e4b3ba5b6d2fbb4c3b383b78469 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputAccessibilityDescriptionTest() { + + describe('TextInputAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件AccessibilityDescription属性为"test" + it('testTextInputAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextInput组件AccessibilityDescription属性为"" + it('testTextInputAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..85f7f8f1de9437bf1b846bd00356e527ef5e1389 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputAccessibilityGroupTest() { + + describe('TextInputAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件AccessibilityGroup属性为true + it('testTextInputAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextInput组件AccessibilityGroup属性为false + it('testTextInputAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0c6d0cbc9335e3501ed243c1c9165992f2d2ab2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputAccessibilityLevelTest() { + + describe('TextInputAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件AccessibilityLevel属性为AUTO + it('testTextInputAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextInput组件AccessibilityLevel属性为ENABLED + it('testTextInputAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextInput组件AccessibilityLevel属性为DISABLED + it('testTextInputAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextInput组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testTextInputAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextInput组件AccessibilityLevel属性为-10 + it('testTextInputAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextInput组件AccessibilityLevel属性为10 + it('testTextInputAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8dbf04249bb57d032b28fa617372c99d5eb7336a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextInputAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputAccessibilityTextTest() { + + describe('TextInputAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件AccessibilityText属性为"test" + it('testTextInputAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextInput组件AccessibilityText属性为"" + it('testTextInputAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..69996e567be575c9b2bd5b91022d3725614d07b8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerAccessibilityDescriptionTest() { + + describe('TextPickerAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件AccessibilityDescription属性为"test" + it('testTextPickerAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextPicker组件AccessibilityDescription属性为"" + it('testTextPickerAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bdd25b1a625fc835bb18599fb8af225fc1f11545 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerAccessibilityGroupTest() { + + describe('TextPickerAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件AccessibilityGroup属性为true + it('testTextPickerAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextPicker组件AccessibilityGroup属性为false + it('testTextPickerAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e48e96de431c01d2357114e8fd3cccdc38927482 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerAccessibilityLevelTest() { + + describe('TextPickerAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件AccessibilityLevel属性为AUTO + it('testTextPickerAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextPicker组件AccessibilityLevel属性为ENABLED + it('testTextPickerAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextPicker组件AccessibilityLevel属性为DISABLED + it('testTextPickerAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextPicker组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testTextPickerAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextPicker组件AccessibilityLevel属性为-10 + it('testTextPickerAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextPicker组件AccessibilityLevel属性为10 + it('testTextPickerAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5dee33325730453bc0267e169209f20de981550d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TextPickerAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerAccessibilityTextTest() { + + describe('TextPickerAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件AccessibilityText属性为"test" + it('testTextPickerAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TextPicker组件AccessibilityText属性为"" + it('testTextPickerAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f0585c236e79dc2f5aa607996c6b8831c00d0bb9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerAccessibilityDescriptionTest() { + + describe('TimePickerAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TimePicker组件AccessibilityDescription属性为"test" + it('testTimePickerAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TimePicker组件AccessibilityDescription属性为"" + it('testTimePickerAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..79105a78d8d23eac8bbbb7ef99b3139a3976db2d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerAccessibilityGroupTest() { + + describe('TimePickerAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TimePicker组件AccessibilityGroup属性为true + it('testTimePickerAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TimePicker组件AccessibilityGroup属性为false + it('testTimePickerAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c63544c34c8ea92dca702199cf398efcd68eb84 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerAccessibilityLevelTest() { + + describe('TimePickerAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TimePicker组件AccessibilityLevel属性为AUTO + it('testTimePickerAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TimePicker组件AccessibilityLevel属性为ENABLED + it('testTimePickerAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TimePicker组件AccessibilityLevel属性为DISABLED + it('testTimePickerAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TimePicker组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testTimePickerAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TimePicker组件AccessibilityLevel属性为-10 + it('testTimePickerAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TimePicker组件AccessibilityLevel属性为10 + it('testTimePickerAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5132fd91caef9f926ddbde1348a9485fa7f06225 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/TimePickerAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerAccessibilityTextTest() { + + describe('TimePickerAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TimePicker组件AccessibilityText属性为"test" + it('testTimePickerAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // TimePicker组件AccessibilityText属性为"" + it('testTimePickerAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..74a87956682e10174b3409de3d31d99aee3ead00 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleAccessibilityDescriptionTest() { + + describe('ToggleAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Toggle组件AccessibilityDescription属性为"test" + it('testToggleAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityDescriptionTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Toggle组件AccessibilityDescription属性为"" + it('testToggleAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityDescriptionNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..701ed638771380be7fad6124dd767ebc5ae4e002 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleAccessibilityGroupTest() { + + describe('ToggleAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Toggle组件AccessibilityGroup属性为true + it('testToggleAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityGroupTrueTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Toggle组件AccessibilityGroup属性为false + it('testToggleAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityGroupFalseTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b38a2300952bab6c6b35de4add5427678fb3f5e7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityLevelTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleAccessibilityLevelTest() { + + describe('ToggleAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Toggle组件AccessibilityLevel属性为AUTO + it('testToggleAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityLevelAutoTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Toggle组件AccessibilityLevel属性为ENABLED + it('testToggleAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityLevelEnabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Toggle组件AccessibilityLevel属性为DISABLED + it('testToggleAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityLevelDisabledTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Toggle组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testToggleAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Toggle组件AccessibilityLevel属性为-10 + it('testToggleAccessibilityLevel005', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityLevelLowerAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Toggle组件AccessibilityLevel属性为10 + it('testToggleAccessibilityLevel006', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityLevelUpperAbnormalTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..de3d685f251d50ef8ea252fb19f5ac41e9eef922 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/accessibility/ToggleAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleAccessibilityTextTest() { + + describe('ToggleAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Toggle组件AccessibilityText属性为"test" + it('testToggleAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityTextTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + + // Toggle组件AccessibilityText属性为"" + it('testToggleAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleAccessibilityTextNullTest'; + await Utils.pushPage(`accessibility/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d69186f18ecbcc960a6f09cb19681c0537fe079 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonBackgroundColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function buttonBackgroundColorTest() { + + describe('ButtonBackgroundColorTest', () => { + + let PAGE_TAG = 'ButtonBackgroundColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`button/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件backgroundColor参数设置为0xFFFF0000、0xFFFFFFFF、0x00000000时的显示效果测试 + it('testButtonBackgroundColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonFontColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonFontColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f5c1917a45a1a258a93cc3b3a8b1137632a93d95 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonFontColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function buttonFontColorTest() { + + describe('ButtonFontColorTest', () => { + + let PAGE_TAG = 'ButtonFontColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`button/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件fontColor参数分别设置为0xFFFF0000、0xFFFFFFFF、0x00000000时的显示效果测试 + it('testButtonFontColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonFontSizeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonFontSizeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bca9355d9bcbdb2688dcbdd7da975bf7ab6ded0e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonFontSizeTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function buttonFontSizeTest() { + + describe('ButtonFontSizeTest', () => { + + let PAGE_TAG = 'ButtonFontSizeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`button/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件fontSize参数分别设置为16、72、8、-10时的显示效果测试 + it('testButtonFontSize001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonFontWeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonFontWeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bcf7888f1431a5fc9a4daefde0c5d18dcadb99a7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonFontWeightTest.test.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function buttonFontWeightTest() { + + describe('ButtonFontWeightTest', () => { + + let PAGE_TAG = 'ButtonFontWeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`button/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* Button组件fontWeight参数分别设置为 + * ARKUI_FONT_WEIGHT_W100, + * ARKUI_FONT_WEIGHT_W200, + * ARKUI_FONT_WEIGHT_W300, + * ARKUI_FONT_WEIGHT_W400, + * ARKUI_FONT_WEIGHT_W500, + * ARKUI_FONT_WEIGHT_W600, + * ARKUI_FONT_WEIGHT_W700, + * ARKUI_FONT_WEIGHT_W800, + * ARKUI_FONT_WEIGHT_W900, + * ARKUI_FONT_WEIGHT_BOLD, + * ARKUI_FONT_WEIGHT_NORMAL, + * ARKUI_FONT_WEIGHT_BOLDER, + * ARKUI_FONT_WEIGHT_LIGHTER, + * ARKUI_FONT_WEIGHT_MEDIUM, + * ARKUI_FONT_WEIGHT_REGULAR, + * -10 + * 时的显示效果测试 + */ + it('testButtonFontWeight001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonOnClickTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonOnClickTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f641caa941b16e4ec3fc0f30a63db2f574ecc071 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/button/ButtonOnClickTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function buttonOnClickTest() { + + describe('ButtonOnClickTest', () => { + + let PAGE_TAG = 'ButtonOnClickTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`button/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Button组件调用capi设置enabled为true,通用事件onClick正常触发的场景 + it('testButtonOnClick001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickTestButton') + await Utils.sleep(2000) + done() + }) + + //Button组件调用capi设置enabled为false,通用事件onClick无法触发的场景 + it('testButtonOnClick002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickTestButtonDisable') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerEdgeAlignTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerEdgeAlignTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb16741ff65b0f6480fc5a4903570c621b0142d8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerEdgeAlignTest.test.ets @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function calendarPickerEdgeAlignTest() { + + describe('CalendarPickerEdgeAlignTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // CalendarPicker组件参数设置edgeAlign {.i32 = ARKUI_CALENDAR_ALIGNMENT_START}, {.f32 = -50}, {.f32 = 50}时的显示效果测试 + it('testCalendarPickerEdgeAlign001', 0, async (done: Function) => { + let PAGE_TAG = 'CalendarPickerEdgeAlignStartTest'; + await Utils.pushPage(`calendarpicker/${PAGE_TAG}`); + await Utils.clickComponent('OnClick') + await Utils.sleep(1000) + done() + }) + + // CalendarPicker组件参数设置edgeAlign {.i32 = ARKUI_CALENDAR_ALIGNMENT_CENTER}, {.f32 = 0}, {.f32 = 0}时的显示效果测试 + it('testCalendarPickerEdgeAlign002', 0, async (done: Function) => { + let PAGE_TAG = 'CalendarPickerEdgeAlignCenterTest'; + await Utils.pushPage(`calendarpicker/${PAGE_TAG}`); + await Utils.clickComponent('OnClick') + await Utils.sleep(1000) + done() + }) + + // CalendarPicker组件参数设置edgeAlign {.i32 = ARKUI_CALENDAR_ALIGNMENT_END}, {.f32 = 50}, {.f32 = -500}时的显示效果测试 + it('testCalendarPickerEdgeAlign003', 0, async (done: Function) => { + let PAGE_TAG = 'CalendarPickerEdgeAlignEndTest'; + await Utils.pushPage(`calendarpicker/${PAGE_TAG}`); + await Utils.clickComponent('OnClick') + await Utils.sleep(1000) + done() + }) + + // CalendarPicker组件参数设置edgeAlign -1 时的显示效果测试 + it('testCalendarPickerEdgeAlign004', 0, async (done: Function) => { + let PAGE_TAG = 'CalendarPickerEdgeAlignDefaultTest'; + await Utils.pushPage(`calendarpicker/${PAGE_TAG}`); + await Utils.clickComponent('OnClick') + await Utils.sleep(1000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerEnabledTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerEnabledTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c868fa0f089af03698c1f3471093c3f6c8bd462 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerEnabledTest.test.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { beforeAll, afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function calendarPickerEnabledTest() { + + describe('CalendarPickerEnabledTest', () => { + + let PAGE_TAG = 'CalendarPickerEnabledTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`calendarpicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //CalendarPicker组件enabled参数设置为1时的显示效果测试 + it('testCalendarPickerEnabled001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickEnabledCalendarPicker') + await Utils.sleep(1000) + + await Utils.clickComponent('TextClick') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurEnabledCalendarPicker') + await Utils.sleep(1000) + + focusControl.requestFocus('EnabledCalendarPicker') + await Utils.sleep(1000) + + done(); + }) + + //CalendarPicker组件enabled参数设置为0时的显示效果测试 + it('testCalendarPickerEnabled002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickDisabledCalendarPicker') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurDisabledCalendarPicker') + await Utils.sleep(1000) + + focusControl.requestFocus('DisabledCalendarPicker') + await Utils.sleep(1000) + + done(); + }) + + //CalendarPicker组件enabled参数设置为-1时的显示效果测试 + it('testCalendarPickerEnabled003', 0, async (done: Function) => { + await Utils.clickComponent('OnClickAbnormalCalendarPicker') + await Utils.sleep(1000) + + await Utils.clickComponent('TextClick') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurAbnormalCalendarPicker') + await Utils.sleep(1000) + + focusControl.requestFocus('AbnormalCalendarPicker') + await Utils.sleep(1000) + + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerOnChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerOnChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..636f280548f144481d659f185bec67b8fd9cf309 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerOnChangeTest.test.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function calendarPickerOnChangeTest() { + + describe('CalendarPickerOnChangeTest', () => { + + let PAGE_TAG = 'CalendarPickerOnChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`calendarpicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // CalendarPicker组件调用capi设置enabled为true,onChange正常触发的场景 + it('testCalendarPickerOnChange001', 0, async (done: Function) => { + await Utils.clickComponent('calendarPickerOnChangeTest') + await Utils.clickComponent('calendarPickerOnChangeTest') + await Utils.sleep(2000) + done() + }) + // CalendarPicker组件调用capi设置enabled为false,onChange无法触发的场景 + it('testCalendarPickerOnChange002', 0, async (done: Function) => { + await Utils.clickComponent('calendarPickerOnChangeTestDisable') + await Utils.clickComponent('calendarPickerOnChangeTestDisable') + await Utils.sleep(2000) + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerTextStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerTextStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d84eb7cdec5848b66c5d41b181a00c1b8e42b1c7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerTextStyleTest.test.ets @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function calendarPickerTextStyleTest() { + + describe('CalendarPickerTextStyleTest', () => { + + let PAGE_TAG = 'CalendarPickerTextStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`calendarpicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * CalendarPicker组件参数设置textStyle (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W100) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W200) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W300) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W400) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W500) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W600) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W700) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W800) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W900) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_BOLD) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_NORMAL) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_BOLDER) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_LIGHTER) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_MEDIUM) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_REGULAR) + * (nodeAPI, 1234, -1, ENUM_ABNORMAL_VALUE)时的显示效果测试 + */ + + it('testCalendarPickerTextStyle001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce8079d68e0edfe81a5ca3126b55072a41eac53f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/calendarpicker/CalendarPickerWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function calendarpickerWidthTest() { + + describe('CalendarPickerWidthTest', () => { + + let PAGE_TAG = 'CalendarPickerWidthTest'; + let PAGE_TAG_LARGE = 'CalendarPickerWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //CalendarPicker组件width参数分别设置为300、-100时的显示效果测试 + it('testCalendarPickerWidth001', 0, async (done: Function) => { + await Utils.pushPage(`calendarpicker/${PAGE_TAG}`, done); + }) + + //CalendarPicker组件width参数设置为500,超出父控件时的显示效果测试 + it('testCalendarPickerWidth002', 0, async (done: Function) => { + await Utils.pushPage(`calendarpicker/${PAGE_TAG_LARGE}`, done); + }); + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxEnabledTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxEnabledTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5476f6fc17e4837bd0057408f01557e4930e9c5f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxEnabledTest.test.ets @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxEnabledTest() { + + describe('CheckboxEnabledTest', () => { + + let PAGE_TAG = 'CheckboxEnabledTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Checkbox组件enabled参数设置为1时的显示效果测试 + it('testCheckboxEnabled001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickEnabledCheckbox') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurEnabledCheckbox') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusEnabledCheckbox') + await Utils.sleep(1000) + + done(); + }) + + //Checkbox组件enabled参数设置为0时的显示效果测试 + it('testCheckboxEnabled002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickDisabledCheckbox') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurDisabledCheckbox') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusDisabledCheckbox') + await Utils.sleep(1000) + + done(); + }) + + //Checkbox组件enabled参数设置为-1时的显示效果测试 + it('testCheckboxEnabled003', 0, async (done: Function) => { + await Utils.clickComponent('OnClickAbnormalCheckbox') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurAbnormalCheckbox') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusAbnormalCheckbox') + await Utils.sleep(1000) + + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b549d1034040f33314c639f964b31d82ae49182d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxHeightTest() { + + describe('CheckboxHeightTest', () => { + + let PAGE_TAG = 'CheckboxHeightTest'; + let PAGE_TAG_LARGE = 'CheckboxHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Checkbox组件height参数分别设置为200、-50时的显示效果测试 + it('testCheckboxHeight001', 0, async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG}`, done); + }) + + //Checkbox组件height参数设置为500,超出父控件时的显示效果测试 + it('testCheckboxHeight002', 0, async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxMarkTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxMarkTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..dbf03258b743624d1a38cf130d82e16dd283626e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxMarkTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxMarkTest() { + + describe('CheckboxMarkTest', () => { + + let PAGE_TAG = 'CheckboxMarkTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + * Checkbox组件调用capi设置mark为 + * 0xFFFF0000, 50, 10 + * 0xFFFF0000,-50, 10 + * 0xFFFF0000, 50,-10 + * 默认值 + * 0xFFFF0000 + * 0xFFFF0000, 50 + * 的显示效果测试 + */ + it('testCheckboxMark001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxOnChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxOnChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3173218c9c96ffdc2d076f86fa6ba1d766d1ce9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxOnChangeTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxOnChangeTest() { + + describe('CheckboxOnChangeTest', () => { + + let PAGE_TAG = 'CheckboxOnChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + * Checkbox组件调用capi设置select为true,onChange正常触发的场景 + * Checkbox组件调用capi设置select为false,onChange正常触发的场景 + */ + it('testCheckboxOnChange001', 0, async (done: Function) => { + await Utils.clickComponent('OnChangeTestCheckBox') + await Utils.sleep(2000) + await Utils.clickComponent('OnChangeTestCheckBoxSelected') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxSelectTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxSelectTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f20342b630985b0f4fa5fd314927e0986d07ba4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxSelectTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxSelectTest() { + + describe('CheckboxSelectTest', () => { + + let PAGE_TAG = 'CheckboxSelectTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Checkbox组件调用capi设置select为true、false、默认值false的显示效果测试 + it('testCheckboxSelect001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxSelectedColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxSelectedColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..282f1cfbf3601000571fb4c39c9c6d253fd3e109 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxSelectedColorTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxSelectedColorTest() { + + describe('CheckboxSelectedColorTest', () => { + + let PAGE_TAG = 'CheckboxSelectedColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + * Checkbox组件调用capi设置selectedColor和select分别为 + * 0xFFFF0000,true 0xFFFF0000,false + * 0xFFFFFFFF,true 0xFFFFFFFF,false + * 0x00000000,true 0x00000000,false + * 默认色,true 默认色,false + * 的显示效果测试 + */ + it('testCheckboxSelectedColor001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxShapeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxShapeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4086081a63472aa32e61a5858540aa1e5341b57e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxShapeTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxShapeTest() { + + describe('CheckboxShapeTest', () => { + + let PAGE_TAG = 'CheckboxShapeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + * Checkbox组件调用capi设置shape为 + * ArkUI_CHECKBOX_SHAPE_ROUNDED_SQUARE + * ArkUI_CHECKBOX_SHAPE_CIRCLE + * 默认值 + * 的显示效果测试 + */ + it('testCheckboxShape001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxUnselectedColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxUnselectedColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..973e378a0dbe2e7e40e0c2c9e8be058073a51b84 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxUnselectedColorTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxUnselectedColorTest() { + + describe('CheckboxUnselectedColorTest', () => { + + let PAGE_TAG = 'CheckboxUnselectedColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + * Checkbox组件调用capi设置unselectedColor和select分别为 + * 0xFFFF0000,true 0xFFFF0000,false + * 0xFFFFFFFF,true 0xFFFFFFFF,false + * 0x00000000,true 0x00000000,false + * 默认色,true 默认色,false + * 的显示效果测试 + */ + it('testCheckboxUnselectedColor001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb0fbbe29e0c606a0e8a604d074e489496fd2636 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/checkbox/CheckboxWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function checkboxWidthTest() { + + describe('CheckboxWidthTest', () => { + + let PAGE_TAG = 'CheckboxWidthTest'; + let PAGE_TAG_LARGE = 'CheckboxWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Checkbox组件width参数分别设置为300、-100时的显示效果测试 + it('testCheckboxWidth001', 0, async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG}`, done); + }) + + //Checkbox组件width参数设置为500,超出父控件时的显示效果测试 + it('testCheckboxWidth002', 0, async (done: Function) => { + await Utils.pushPage(`checkbox/${PAGE_TAG_LARGE}`, done); + }); + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnForegroundBlurStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnForegroundBlurStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5feeb88f524f820b903d6ef44e98b6eb549b3b5f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnForegroundBlurStyleTest.test.ets @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function columnForegroundBlurStyleTest() { + + describe('ColumnForegroundBlurStyleTest', () => { + + let PAGE_TAG = 'ColumnForegroundBlurStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`column/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + Column组件参数设置foregroundBlurStyle + value[0] = ARKUI_BLUR_STYLE_THIN; + value[0] = ARKUI_BLUR_STYLE_REGULAR; + value[0] = ARKUI_BLUR_STYLE_THICK; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_THIN; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_REGULAR; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_THICK; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK; + value[0] = ARKUI_BLUR_STYLE_NONE; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_THIN; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_REGULAR; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_THICK; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK; + value[0] = 500; + value[1] = ARKUI_COLOR_MODE_SYSTEM; + value[1] = ARKUI_COLOR_MODE_LIGHT; + value[1] = ARKUI_COLOR_MODE_DARK; + value[1] = 500; + value[2] = ARKUI_ADAPTIVE_COLOR_DEFAULT; + value[2] = ARKUI_ADAPTIVE_COLOR_AVERAGE; + value[2] = 500; + value[4] = -1; + value[4] = 0; + value[4] = 20; + value[4] = 127; + value[4] = 200; + value[5] = -1; + value[5] = 0; + value[5] = 20; + value[5] = 127; + value[5] = 200; + {{.i32 = ARKUI_BLUR_STYLE_THIN}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_AVERAGE}, + {.f32 = 0.5}, + {.f32 = 20}, + {.f32 = 20}} + 时的显示效果测试 + */ + it('testColumnForegroundBlurStyle001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f749f1dc4a727578340545799f469df4cad98cc6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function columnHeightTest() { + + describe('ColumnHeightTest', () => { + + let PAGE_TAG = 'ColumnHeightTest'; + let PAGE_TAG_LARGE = 'ColumnHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Column组件height参数分别设置为200、-50时的显示效果测试 + it('testColumnHeight001', 0, async (done: Function) => { + await Utils.pushPage(`column/${PAGE_TAG}`, done); + }); + + //Column组件height参数设置为500,超出父控件时的显示效果测试 + it('testColumnHeight002', 0, async (done: Function) => { + await Utils.pushPage(`column/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnPaddingTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnPaddingTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..be0bb7394964a110b6a06f5d77b095afee74869a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnPaddingTest.test.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function columnPaddingTest() { + + describe('ColumnPaddingTest', () => { + + let PAGE_TAG = 'ColumnPaddingTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Column组件padding参数分别设置为10,-10,{10,10,50,50},{-10,-10,-50,-50}时的显示效果测试 + it('testColumnPadding001', 0, async (done: Function) => { + await Utils.pushPage(`column/${PAGE_TAG}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9db2c08eb45300d8098fb75c286f511c8dc0c75b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/column/ColumnWidthTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function columnWidthTest() { + + describe('ColumnWidthTest', () => { + + let PAGE_TAG = 'ColumnWidthTest'; + let PAGE_TAG_LARGE = 'ColumnWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Column组件width参数分别设置为300、-100时的显示效果测试 + it('testColumnWidth001', 0, async (done: Function) => { + await Utils.pushPage(`column/${PAGE_TAG}`, done); + }); + + //Column组件width参数设置为500,超出父控件时的显示效果测试 + it('testColumnWidth002', 0, async (done: Function) => { + await Utils.pushPage(`column/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Interfaces.d.ts b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Interfaces.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d2e942f4a238e9c6cce0f4b752699a8c622663e3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Interfaces.d.ts @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2024 Huawei Device 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. + */ + +export class ComponentInfo { + $type: string; + $rect: Object[]; +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Settings.ts b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Settings.ts new file mode 100644 index 0000000000000000000000000000000000000000..edc67813ecd8d37f072bd739c577b4d61ea3ded0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Settings.ts @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2024 Huawei Device 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 screen from '@ohos.screen'; +import window from '@ohos.window'; + +const TAG: string = '[SettingsCApiDemo]' + +class Settings { + sleep(time) { + return new Promise((resolve) => { + setTimeout(resolve, time) + }); + } + + windowClass: window.Window = null + + //为悬浮窗设置位置 + changeWindowPosition(windowClass, X, Y) { + windowClass.moveWindowTo(X, Y, (err) => { + if (err.code) { + console.error(`${TAG}, Fail to move the window. Cause: ${JSON.stringify(err)}`); + return; + } + }) + } + + //为悬浮窗设置大小 + changeWindowSize(windowClass, width, height) { + windowClass.resize(width, height, (err) => { + if (err.code) { + console.error(`${TAG}, Fail to change the window size. Cause: ${JSON.stringify(err)}`); + return; + } + }) + } + + loadContent(windowClass, pageURI) { + //为悬浮窗加载对应的目标页面 + windowClass.setUIContent(pageURI, (err) => { + if (err.code) { + console.error(`${TAG}, Fail to load the content. Cause: ${JSON.stringify(err)}`); + return; + } + console.info(`${TAG}, Succeeded in loading the content.`); + + //显示悬浮窗 + windowClass.showWindow((err) => { + if (err.code) { + console.error(`${TAG}, Fail to show the window. Cause: ${JSON.stringify(err)}`); + return; + } + console.info(`${TAG}, Succeeded in showing the window.`); + }) + + }) + } + + changeDpi(dpi) { + let screenClass = null; + screen.getAllScreens((err, data) => { + if (err.code) { + console.error(`${TAG}, Fail to get all screens. Cause: ${JSON.stringify(err)}`); + return; + } + console.info(`${TAG}, Succeeded in geting all screens.`); + + screenClass = data[0]; + //设置设备dpi + screenClass.setDensityDpi(dpi, (err, data) => { + if (err.code) { + console.error(`${TAG}, Fail to set the piexl density. Cause: ${JSON.stringify(err)}`); + return; + } + console.info(`${TAG}, Succeeded in seting the piexl density.`) + }) + }) + } + + destroyWindow() { + //销毁窗口 + let windowClass = null; + try { + windowClass = window.findWindow('floatWindow'); + console.info(`${TAG}, find window success.`) + } catch (exception) { + console.error(`${TAG}, Fail to find the window. Cause: ${JSON.stringify(exception)}`); + } + windowClass.destroyWindow((err) => { + if (err.code) { + console.error(`${TAG}, Fail to destroy the window. Cause: ${JSON.stringify(err)}`); + return; + } + console.info(`${TAG}, Succeeded in destroying the window.`) + }) + } + + createWindow(pageURI: String, {X=0,Y=0,width=1344,height=2560,dpi=400}={}) { + console.info(`${TAG}, params, pageURI=${pageURI}}, X=${X}, Y=${Y}, width=${width}, height=${height}, dpi=${dpi}`) + + this.changeDpi(dpi); + this.sleep(1000); + let windowClass = null; + let config = { + name: 'floatWindow', windowType: window.WindowType.TYPE_FLOAT, ctx: globalThis.context + } + window.createWindow(config, (err, data) => { + if (err.code) { + console.error(`${TAG}, Fail to create the floatWindow. Cause: ${JSON.stringify(err)}`); + return; + } + console.info(`${TAG}, Succeeded in creating the floatWindow.`) + windowClass = data; + this.windowClass = data; + + this.changeWindowPosition(windowClass, X, Y) + this.changeWindowSize(windowClass, width, height) + this.loadContent(windowClass, pageURI) + }) + } +} + +export default new Settings() \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Snap.ts b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Snap.ts new file mode 100644 index 0000000000000000000000000000000000000000..a7d416ebbd81242f08af3bc6dbede20cde5f735e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Snap.ts @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Huawei Device 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 window from '@ohos.window'; +import image from '@ohos.multimedia.image'; +import fs from '@ohos.file.fs'; +import { Driver, Rect } from '@ohos.UiTest'; + +const TAG: string = '[WindowSnap]' +const INFO = { + 'img': { + prefix: 'IMG_', + suffix: '.webp' + }, + 'txt': { + prefix: 'TXT_', + suffix: '.txt' + } +} + +class WindowSnap { + async sleep(time) { + return new Promise((resolve) => { + setTimeout(resolve, time) + }); + } + + createFile(context: any, type, page) { + console.info(`${TAG}, createFile start`) + let pathDir = context.filesDir; + console.info(`${TAG}, createFile pathDir = ${pathDir}`) + let name = page + let info = INFO[type] + let displayName = `${info.prefix}${name}${info.suffix}` + let filePath = pathDir + '/' + displayName + console.info(`${TAG}, createFile filePath = ${filePath}`) + let exists = fs.accessSync(filePath) + console.info(`${TAG}, oldFile exists = ${exists}`) + if (exists) { + fs.unlinkSync(filePath) + console.info(`${TAG}, remove file succeed`) + } + return fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE) + } + + async save(data: image.PixelMap, context: any, page) { + console.info(`${TAG}, start save image`) + let packOpts: image.PackingOption = { + format: 'image/webp', quality: 100 + } + let imagePackerApi = image.createImagePacker() + let arrayBuffer = await imagePackerApi.packing(data, packOpts) + let file = null + while (file == null) { + file = this.createFile(context, 'img', page) + } + let exists = fs.accessSync(file.path) + console.info(`${TAG}, createFile exists = ${exists}`) + let fd = file.fd + console.info(`${TAG}, createFile fd = ${fd}`) + imagePackerApi.release() + try { + fs.writeSync(fd, arrayBuffer) + } catch (err) { + console.error(`${TAG}, write failed, code is ${err.code}, message is ${err.message}}`) + } + fs.closeSync(file) + console.info(`${TAG}, write picture done`) + } + + /** + * 获取窗口截图&文件保存 + * 入参必须为ability的context + * + * save:设备保存路径:/data/app/el2/100/base/{bundle_name}/haps/entry_test/files/IMG_test.webp + */ + async snapShot(context, page, done?) { + console.info(`${TAG}, start snapshot`) + await this.sleep(2000); + let windowClass = null + try { + windowClass = window.findWindow('floatWindow') + console.info(`${TAG}, find window success`) + } catch (exception) { + console.error(`${TAG}, Failed to find the window. Cause: ${JSON.stringify(exception)}`) + } + + windowClass.snapshot(async (err, data) => { + console.info(`${TAG}, windowClass.snapshot`) + if (err.code) { + console.error(`${TAG}, Failed to snapshot window. Cause: ${JSON.stringify(err)}`) + return + } + await this.save(data, context, page) + data.release() + if (done) { + done(); + } + }) + } + + async snapShotByDriver(context, page, done?) { + console.info(`Start snapshot by driver`) + await this.sleep(2000); + let file = null + while (file == null) { + file = this.createFile(context, 'img', page) + } + let exists = fs.accessSync(file.path) + console.info(`${TAG}, createFile exists = ${exists}`) + + try { + let windowClass = window.findWindow('floatWindow') + console.info(`${TAG}, find window success`) + let windowRect = windowClass.getWindowProperties().windowRect; + console.info(`${TAG}, windowRct is ${JSON.stringify(windowRect)}`) + let driver = Driver.create(); + await driver.screenCapture(file.path, { + left: windowRect.left, + top: windowRect.top, + right: windowRect.width, + bottom: windowRect.height + }); + } catch (exception) { + console.error(`${TAG}, Failed to snap shot. Cause: ${JSON.stringify(exception)}`) + } + + if (done) { + done(); + } + } +} + +export default new WindowSnap() \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Utils.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..56f3b006bb11bda63680ecb0a925ffcd01346e19 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/common/Utils.ets @@ -0,0 +1,261 @@ +/* + * Copyright (c) 2024 Huawei Device 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 events_emitter from '@ohos.events.emitter'; +import { Driver, ON, PointerMatrix, Rect } from '@ohos.UiTest'; +import { ComponentInfo } from './Interfaces'; +import systemDateTime from '@ohos.systemDateTime'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry' +import fs from '@ohos.file.fs'; +import router from '@ohos.router'; + +export default class Utils { + static sleep(time: number) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve("ok") + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getSystemTime() { + return systemDateTime.getTime(true) / 1000 + } + + static getSandboxFileDir() { + let sandboxFileDir = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext().filesDir + "/" + console.log(`[getSandboxFileDir] return ${sandboxFileDir}`); + return sandboxFileDir; + } + + static deleteFile(filePath: string) { + console.info("[deleteFile] filePath:" + filePath); + try { + fs.unlinkSync(filePath) + } catch (error) { + console.info("[deleteFile] error:" + error); + } + } + + static isFileExist(filePath: string): boolean { + console.info("[isFileExist] filePath:" + filePath); + try { + let fileExist = fs.accessSync(filePath) + console.info("[isFileExist] return:" + fileExist); + return fileExist + } catch (error) { + console.info("[isFileExist] error:" + error); + return false + } + } + + static async flingComponent(key: string, isHorizontal: boolean, isForward: boolean) { + let driver = Driver.create(); + let rect = Utils.getComponentRect(key); + let centerX = Utils.getRectHorizontalCenterX(rect) + let centerY = Utils.getRectVerticalCenterY(rect) + let X1 = centerX - 100; + let X2 = centerX + 100; + let Y1 = centerY - 100; + let Y2 = centerY + 100; + let stepLen = 20; + let speed = 10000; + if (isHorizontal) { + if (isForward) { + await driver.fling({ + x: X2, y: centerY + }, { + x: X1, y: centerY + }, stepLen, speed); + } else { + await driver.fling({ + x: X1, y: centerY + }, { + x: X2, y: centerY + }, stepLen, speed); + } + } else { + if (isForward) { + await driver.fling({ + x: centerX, y: Y2 + }, { + x: centerX, y: Y1 + }, stepLen, speed); + } else { + await driver.fling({ + x: centerX, y: Y1 + }, { + x: centerX, y: Y2 + }, stepLen, speed); + } + } + } + + static async clickComponent(id: string) { + let driver = Driver.create(); + let component = await driver.findComponent(ON.id(id)); + await component.click(); + } + + static async doubleClickComponent(id: string) { + let driver = Driver.create(); + let component = await driver.findComponent(ON.id(id)); + await component.click(); + await component.click(); + } + + static async clickLocation(X: number, Y: number) { + let driver = Driver.create(); + await driver.click(X, Y); + } + + static async triggerKey(id: number) { + let driver = Driver.create(); + await driver.triggerKey(id); + } + + static async longClickComponent(id: string) { + let driver = Driver.create(); + let component = await driver.findComponent(ON.id(id)); + await component.longClick(); + } + + static async clickComponentByText(text: string) { + let driver = Driver.create(); + let component = await driver.findComponent(ON.text(text)); + await component.click(); + } + + static async fingerZoom(key: string, isOut: boolean) { + let rect = Utils.getComponentRect(key); + let centerX = Utils.getRectHorizontalCenterX(rect) + let centerY = Utils.getRectVerticalCenterY(rect) + let fingerUpCenterY = centerY - 100; + let fingerDownCenterY = centerY + 100; + let driver: Driver = Driver.create(); + let pointers: PointerMatrix = PointerMatrix.create(2, 3); + pointers.setPoint(0, 0, { + x: centerX, y: fingerUpCenterY - (isOut ? 40 : 120) + }); + pointers.setPoint(0, 1, { + x: centerX, y: fingerUpCenterY - 80 + }); + pointers.setPoint(0, 2, { + x: centerX, y: fingerUpCenterY - (isOut ? 120 : 40) + }); + pointers.setPoint(1, 0, { + x: centerX, y: fingerDownCenterY + (isOut ? 40 : 120) + }); + pointers.setPoint(1, 1, { + x: centerX, y: fingerDownCenterY + 80 + }); + pointers.setPoint(1, 2, { + x: centerX, y: fingerDownCenterY + (isOut ? 120 : 40) + }); + await driver.injectMultiPointerAction(pointers); + } + + static registerEvent(pageTag: string, eventId: number, callBack: Function) { + events_emitter.on({ + eventId: eventId, + priority: events_emitter.EventPriority.LOW + }, (eventData: events_emitter.EventData) => { + console.info("Value Change CallBack"); + if (eventData != null && eventData.data != null) { + if (pageTag == eventData.data.PAGE_TAG) { + console.info("CallBack value:" + JSON.stringify(eventData)); + callBack(eventData.data.VALUE); + } + } + }) + } + + static emitEvent(pageTag: string, emitValue: number | string | object, eventId: number) { + try { + let backData: events_emitter.EventData = { + data: { + "PAGE_TAG": pageTag, + "VALUE": emitValue + } + } + let backEvent: events_emitter.InnerEvent = { + eventId: eventId, + priority: events_emitter.EventPriority.LOW + } + console.info("start to emit page state"); + events_emitter.emit(backEvent, backData); + } catch (err) { + console.info("emit page state err: " + JSON.stringify(err)); + } + } + + static async pushPage(pageTag: string, done?: Function) { + let options: router.RouterOptions = { + url: `MainAbility/pages/${pageTag}`, + } + try { + router.clear(); + let pages = router.getState(); + console.info(`get ${pageTag} state success ` + JSON.stringify(pages)); + if (pageTag.indexOf(pages.name) < 0) { + console.info(`get ${pageTag} state success ` + JSON.stringify(pages.name)); + let result = await router.pushUrl(options); + await Utils.sleep(2000); + console.info(`push ${pageTag} page success ` + JSON.stringify(result)); + } + } catch (err) { + console.error(`push ${pageTag} page error: ` + err); + } + if (done) { + done(); + } + } + + static getComponentRect(key: string): Rect { + let strJson = getInspectorByKey(key); + let obj: ComponentInfo = JSON.parse(strJson); + console.info('[getInspectorByKey] key is: ' + key); + return Utils.getComponentRectByObj(obj); + } + + static getComponentRectByObj(obj: ComponentInfo): Rect { + console.info('[getInspectorByKey] current component is: ' + obj.$type); + let rectInfo: Object[] = JSON.parse('[' + obj.$rect + ']'); + let rect_value: Rect = { + left: JSON.parse('[' + rectInfo[0] + ']')[0], + top: JSON.parse('[' + rectInfo[0] + ']')[1], + right: JSON.parse('[' + rectInfo[1] + ']')[0], + bottom: JSON.parse('[' + rectInfo[1] + ']')[1] + }; + console.info(JSON.stringify(rect_value)); + return rect_value; + } + + static getRectHorizontalCenterX(rect: Rect): number { + return Number.parseInt(Number((rect.right - rect.left) / 2 + rect.left).toFixed(0)); + } + + static getRectVerticalCenterY(rect: Rect): number { + return Number.parseInt(Number((rect.bottom - rect.top) / 2 + rect.top).toFixed(0)); + } + + static async mouseMoveTo(X: number, Y: number) { + let driver = Driver.create(); + await driver.mouseMoveTo({ + x: X, y: Y + }); + } +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignContentTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignContentTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a753b098cc7f0a086ad1dee811a4a1a23ef2d079 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignContentTest.test.ets @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +async function doIt(pageTag: string, testType: number, done?: Function) { + Utils.emitEvent(pageTag, testType, 7777) +} + +export default function commonAttrsAlignContentTest() { + + describe('CommonAttrsAlignContentTest', () => { + + let PAGE_TAG = 'CommonAttrsAlignContentTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件在stack容器设置alignContent属性值为ARKUI_ALIGNMENT_TOP_START时的显示效果测试 + it('testCommonAttrsAlignContent001', 0, async (done: Function) => { + doIt(PAGE_TAG, 1); + done(); + }) + + // Button组件在stack容器设置alignContent属性值为ARKUI_ALIGNMENT_TOP时的显示效果测试 + it('testCommonAttrsAlignContent002', 0, async (done: Function) => { + doIt(PAGE_TAG, 2); + done(); + }) + + // Button组件在stack容器设置alignContent属性值为ARKUI_ALIGNMENT_TOP_END时的显示效果测试 + it('testCommonAttrsAlignContent003', 0, async (done: Function) => { + doIt(PAGE_TAG, 3); + done(); + }) + + // Button组件在stack容器设置alignContent属性值为ARKUI_ALIGNMENT_START时的显示效果测试 + it('testCommonAttrsAlignContent004', 0, async (done: Function) => { + doIt(PAGE_TAG, 4); + done(); + }) + + // Button组件在stack容器设置alignContent属性值为ARKUI_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsAlignContent005', 0, async (done: Function) => { + doIt(PAGE_TAG, 5); + done(); + }) + + // Button组件在stack容器设置alignContent属性值为ARKUI_ALIGNMENT_END时的显示效果测试 + it('testCommonAttrsAlignContent006', 0, async (done: Function) => { + doIt(PAGE_TAG, 6); + done(); + }) + + // Button组件在stack容器设置alignContent属性值为ARKUI_ALIGNMENT_BOTTOM_START时的显示效果测试 + it('testCommonAttrsAlignContent007', 0, async (done: Function) => { + doIt(PAGE_TAG, 7); + done(); + }) + + // Button组件在stack容器设置alignContent属性值为ARKUI_ALIGNMENT_BOTTOM时的显示效果测试 + it('testCommonAttrsAlignContent008', 0, async (done: Function) => { + doIt(PAGE_TAG, 8); + done(); + }) + + // Button组件在stack容器设置alignContent属性值为ARKUI_ALIGNMENT_BOTTOM_END时的显示效果测试 + it('testCommonAttrsAlignContent009', 0, async (done: Function) => { + doIt(PAGE_TAG, 9); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignItemsTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignItemsTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0334937479bed4db93c0a7f69990099e04c72436 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignItemsTest.test.ets @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +async function doIt(pageTag: string, testType: number, done?: Function) { + Utils.emitEvent(pageTag, testType, 9999) +} + +export default function commonAttrsAlignItemsTest() { + + describe('CommonAttrsAlignItemsTest', () => { + + let PAGE_TAG = 'CommonAttrsAlignItemsTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件在row容器设置alignItems属性值为ARKUI_VERTICAL_ALIGNMENT_TOP时的显示效果测试 + it('testCommonAttrsAlignItems001', 0, async (done: Function) => { + doIt(PAGE_TAG, 1); + done(); + }) + + // Button组件在row容器设置alignItems属性值为ARKUI_VERTICAL_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsAlignItems002', 0, async (done: Function) => { + doIt(PAGE_TAG, 2); + done(); + }) + + // Button组件在row容器设置alignItems属性值为ARKUI_VERTICAL_ALIGNMENT_BOTTOM时的显示效果测试 + it('testCommonAttrsAlignItems003', 0, async (done: Function) => { + doIt(PAGE_TAG, 3); + done(); + }) + + // Button组件在column容器设置alignItems属性值为ARKUI_HORIZONTAL_ALIGNMENT_START时的显示效果测试 + it('testCommonAttrsAlignItems004', 0, async (done: Function) => { + doIt(PAGE_TAG, 4); + done(); + }) + + // Button组件在column容器设置alignItems属性值为ARKUI_HORIZONTAL_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsAlignItems005', 0, async (done: Function) => { + doIt(PAGE_TAG, 5); + done(); + }) + + // Button组件在column容器设置alignItems属性值为ARKUI_HORIZONTAL_ALIGNMENT_END时的显示效果测试 + it('testCommonAttrsAlignItems006', 0, async (done: Function) => { + doIt(PAGE_TAG, 6); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignSelfTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignSelfTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4bea30c687f92c110eb2fe31da7f8420dba3701f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignSelfTest.test.ets @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; +import { Router } from '@ohos.arkui.UIContext'; +import router from '@ohos.router'; +import { Driver } from '@ohos.UiTest'; + +async function doIt(pageTag: string, testType: number, done?: Function) { + Utils.emitEvent(pageTag, testType, 6666) +} + +export default function commonAttrsAlignSelfTest() { + + describe('CommonAttrsAlignSelfTest', () => { + + let PAGE_TAG = 'CommonAttrsAlignSelfTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCommonAttrsAlignSelf001', 0, async (done: Function) => { + doIt(PAGE_TAG, 1); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCommonAttrsAlignSelf002', 0, async (done: Function) => { + doIt(PAGE_TAG, 2); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCommonAttrsAlignSelf003', 0, async (done: Function) => { + doIt(PAGE_TAG, 3); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCommonAttrsAlignSelf004', 0, async (done: Function) => { + doIt(PAGE_TAG, 4); + done(); + }) + + // 当父容器为Row时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCommonAttrsAlignSelf005', 0, async (done: Function) => { + doIt(PAGE_TAG, 5); + done(); + }) + + // 当父容器为Column时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCommonAttrsAlignSelf006', 0, async (done: Function) => { + doIt(PAGE_TAG, 6); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCommonAttrsAlignSelf007', 0, async (done: Function) => { + doIt(PAGE_TAG, 7); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCommonAttrsAlignSelf008', 0, async (done: Function) => { + doIt(PAGE_TAG, 8); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCommonAttrsAlignSelf009', 0, async (done: Function) => { + doIt(PAGE_TAG, 9); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCommonAttrsAlignSelf010', 0, async (done: Function) => { + doIt(PAGE_TAG, 10); + done(); + }) + + // 当父容器为Row时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCommonAttrsAlignSelf011', 0, async (done: Function) => { + doIt(PAGE_TAG, 11); + done(); + }) + + // 当父容器为Column时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCommonAttrsAlignSelf012', 0, async (done: Function) => { + doIt(PAGE_TAG, 12); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsAlignSelf013', 0, async (done: Function) => { + doIt(PAGE_TAG, 13); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsAlignSelf014', 0, async (done: Function) => { + doIt(PAGE_TAG, 14); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsAlignSelf015', 0, async (done: Function) => { + doIt(PAGE_TAG, 15); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsAlignSelf016', 0, async (done: Function) => { + doIt(PAGE_TAG, 16); + done(); + }) + + // 当父容器为Row时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsAlignSelf017', 0, async (done: Function) => { + doIt(PAGE_TAG, 17); + done(); + }) + + // 当父容器为Column时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsAlignSelf018', 0, async (done: Function) => { + doIt(PAGE_TAG, 18); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCommonAttrsAlignSelf019', 0, async (done: Function) => { + doIt(PAGE_TAG, 19); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCommonAttrsAlignSelf020', 0, async (done: Function) => { + doIt(PAGE_TAG, 20); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCommonAttrsAlignSelf021', 0, async (done: Function) => { + doIt(PAGE_TAG, 21); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCommonAttrsAlignSelf022', 0, async (done: Function) => { + doIt(PAGE_TAG, 22); + done(); + }) + + // 当父容器为Row时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCommonAttrsAlignSelf023', 0, async (done: Function) => { + doIt(PAGE_TAG, 23); + done(); + }) + + // 当父容器为Column时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCommonAttrsAlignSelf024', 0, async (done: Function) => { + doIt(PAGE_TAG, 24); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCommonAttrsAlignSelf025', 0, async (done: Function) => { + doIt(PAGE_TAG, 25); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCommonAttrsAlignSelf026', 0, async (done: Function) => { + doIt(PAGE_TAG, 26); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCommonAttrsAlignSelf027', 0, async (done: Function) => { + doIt(PAGE_TAG, 27); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCommonAttrsAlignSelf028', 0, async (done: Function) => { + doIt(PAGE_TAG, 28); + done(); + }) + + // 当父容器为Row时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCommonAttrsAlignSelf029', 0, async (done: Function) => { + doIt(PAGE_TAG, 29); + done(); + }) + + // 当父容器为Column时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCommonAttrsAlignSelf030', 0, async (done: Function) => { + doIt(PAGE_TAG, 30); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCommonAttrsAlignSelf031', 0, async (done: Function) => { + doIt(PAGE_TAG, 31); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCommonAttrsAlignSelf032', 0, async (done: Function) => { + doIt(PAGE_TAG, 32); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCommonAttrsAlignSelf033', 0, async (done: Function) => { + doIt(PAGE_TAG, 33); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCommonAttrsAlignSelf034', 0, async (done: Function) => { + doIt(PAGE_TAG, 34); + done(); + }) + + // 当父容器为Row时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCommonAttrsAlignSelf035', 0, async (done: Function) => { + doIt(PAGE_TAG, 35); + done(); + }) + + // 当父容器为Column时,Button组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCommonAttrsAlignSelf036', 0, async (done: Function) => { + doIt(PAGE_TAG, 36); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..161726d367bfb5c08ab14b1ff1876351debe0b00 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsAlignTest.test.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsAlignTest() { + + describe('CommonAttrsAlignTest', () => { + + let PAGE_TAG = 'CommonAttrsAlignTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + * Button组件调用capi设置align为 + * ARKUI_ALIGNMENT_TOP_START + * ARKUI_ALIGNMENT_TOP + * ARKUI_ALIGNMENT_TOP_END + * ARKUI_ALIGNMENT_START + * ARKUI_ALIGNMENT_CENTER + * ARKUI_ALIGNMENT_END + * ARKUI_ALIGNMENT_BOTTOM_START + * ARKUI_ALIGNMENT_BOTTOM + * ARKUI_ALIGNMENT_BOTTOM_END + * 默认值 + * 枚举异常值(500) + * 的显示效果测试 + */ + it('testCommonAttrsAlign001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b7988735939a53d40953ab5eadcccae604e6641c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBackgroundColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsBackgroundColorTest() { + + describe('CommonAttrsBackgroundColorTest', () => { + + let PAGE_TAG = 'CommonAttrsBackgroundColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Flex组件backgroundColor参数设置为0xFFFF0000、0xFFFFFFFF、0x00000000时的显示效果测试 + it('testCommonAttrsBackgroundColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBlendModeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBlendModeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b3d9bd89b91980af503698a0b62b7fc0afc209f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBlendModeTest.test.ets @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsBlendModeTest() { + + describe('CommonAttrsBlendModeTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * column组件blendMode参数为 + * 1.{ARKUI_BLEND_MODE_NONE,BLEND_APPLY_TYPE_FAST} + * 2.{ARKUI_BLEND_MODE_NONE,BLEND_APPLY_TYPE_OFFSCREEN} + * 3.{ARKUI_BLEND_MODE_CLEAR,BLEND_APPLY_TYPE_FAST} + * 4.{ARKUI_BLEND_MODE_CLEAR,BLEND_APPLY_TYPE_OFFSCREEN} + * 5.{ARKUI_BLEND_MODE_SRC,BLEND_APPLY_TYPE_FAST} + * 6.{ARKUI_BLEND_MODE_SRC,BLEND_APPLY_TYPE_OFFSCREEN} + * 7.{ARKUI_BLEND_MODE_DST,BLEND_APPLY_TYPE_FAST} + * 8.{ARKUI_BLEND_MODE_DST,BLEND_APPLY_TYPE_OFFSCREEN} + * 9.{ARKUI_BLEND_MODE_SRC_OVER,BLEND_APPLY_TYPE_FAST} + * 10.{ARKUI_BLEND_MODE_SRC_OVER,BLEND_APPLY_TYPE_OFFSCREEN} + * 11.{ARKUI_BLEND_MODE_DST_OVER,BLEND_APPLY_TYPE_FAST} + * 12.{ARKUI_BLEND_MODE_DST_OVER,BLEND_APPLY_TYPE_OFFSCREEN} + * 13.{ARKUI_BLEND_MODE_SRC_IN,BLEND_APPLY_TYPE_FAST} + * 14.{ARKUI_BLEND_MODE_SRC_IN,BLEND_APPLY_TYPE_OFFSCREEN} + * 15.{ARKUI_BLEND_MODE_DST_IN,BLEND_APPLY_TYPE_FAST} + * 16.{ARKUI_BLEND_MODE_DST_IN,BLEND_APPLY_TYPE_OFFSCREEN} + * 17.{ARKUI_BLEND_MODE_SRC_OUT,BLEND_APPLY_TYPE_FAST} + * 18.{ARKUI_BLEND_MODE_SRC_OUT,BLEND_APPLY_TYPE_OFFSCREEN} + * 19.{ARKUI_BLEND_MODE_DST_OUT,BLEND_APPLY_TYPE_FAST} + * 20.{ARKUI_BLEND_MODE_DST_OUT,BLEND_APPLY_TYPE_OFFSCREEN} + * 21.{ARKUI_BLEND_MODE_SRC_ATOP,BLEND_APPLY_TYPE_FAST} + * 22.{ARKUI_BLEND_MODE_SRC_ATOP,BLEND_APPLY_TYPE_OFFSCREEN} + * 23.{ARKUI_BLEND_MODE_DST_ATOP,BLEND_APPLY_TYPE_FAST} + * 24.{ARKUI_BLEND_MODE_DST_ATOP,BLEND_APPLY_TYPE_OFFSCREEN} + * 25.{ARKUI_BLEND_MODE_XOR,BLEND_APPLY_TYPE_FAST} + * 26.{ARKUI_BLEND_MODE_XOR,BLEND_APPLY_TYPE_OFFSCREEN} + * 27.{ARKUI_BLEND_MODE_PLUS,BLEND_APPLY_TYPE_FAST} + * 28.{ARKUI_BLEND_MODE_PLUS,BLEND_APPLY_TYPE_OFFSCREEN} + * 29.{ARKUI_BLEND_MODE_MODULATE,BLEND_APPLY_TYPE_FAST} + * 30.{ARKUI_BLEND_MODE_MODULATE,BLEND_APPLY_TYPE_OFFSCREEN} + * 31.{ARKUI_BLEND_MODE_SCREEN,BLEND_APPLY_TYPE_FAST} + * 32.{ARKUI_BLEND_MODE_SCREEN,BLEND_APPLY_TYPE_OFFSCREEN} + * 33.{ARKUI_BLEND_MODE_OVERLAY,BLEND_APPLY_TYPE_FAST} + * 34.{ARKUI_BLEND_MODE_OVERLAY,BLEND_APPLY_TYPE_OFFSCREEN} + * 35.{ARKUI_BLEND_MODE_DARKEN,BLEND_APPLY_TYPE_FAST} + * 36.{ARKUI_BLEND_MODE_DARKEN,BLEND_APPLY_TYPE_OFFSCREEN} + * 37.{ARKUI_BLEND_MODE_LIGHTEN,BLEND_APPLY_TYPE_FAST} + * 38.{ARKUI_BLEND_MODE_LIGHTEN,BLEND_APPLY_TYPE_OFFSCREEN} + * 39.{ARKUI_BLEND_MODE_COLOR_DODGE,BLEND_APPLY_TYPE_FAST} + * 40.{ARKUI_BLEND_MODE_COLOR_DODGE,BLEND_APPLY_TYPE_OFFSCREEN} + * 41.{ARKUI_BLEND_MODE_HARD_LIGHT,BLEND_APPLY_TYPE_FAST} + * 42.{ARKUI_BLEND_MODE_HARD_LIGHT,BLEND_APPLY_TYPE_OFFSCREEN} + * 43.{ARKUI_BLEND_MODE_SOFT_LIGHT,BLEND_APPLY_TYPE_FAST} + * 44.{ARKUI_BLEND_MODE_SOFT_LIGHT,BLEND_APPLY_TYPE_OFFSCREEN} + * 45.{ARKUI_BLEND_MODE_DIFFERENCE,BLEND_APPLY_TYPE_FAST} + * 46.{ARKUI_BLEND_MODE_DIFFERENCE,BLEND_APPLY_TYPE_OFFSCREEN} + * 47.{ARKUI_BLEND_MODE_EXCLUSION,BLEND_APPLY_TYPE_FAST} + * 48.{ARKUI_BLEND_MODE_EXCLUSION,BLEND_APPLY_TYPE_OFFSCREEN} + * 49.{ARKUI_BLEND_MODE_MULTIPLY,BLEND_APPLY_TYPE_FAST} + * 50.{ARKUI_BLEND_MODE_MULTIPLY,BLEND_APPLY_TYPE_OFFSCREEN} + * 51.{ARKUI_BLEND_MODE_HUE,BLEND_APPLY_TYPE_FAST} + * 52.{ARKUI_BLEND_MODE_HUE,BLEND_APPLY_TYPE_OFFSCREEN} + * 53.{ARKUI_BLEND_MODE_SATURATION,BLEND_APPLY_TYPE_FAST} + * 54.{ARKUI_BLEND_MODE_SATURATION,BLEND_APPLY_TYPE_OFFSCREEN} + * 55.{ARKUI_BLEND_MODE_COLOR,BLEND_APPLY_TYPE_FAST} + * 56.{ARKUI_BLEND_MODE_COLOR,BLEND_APPLY_TYPE_OFFSCREEN} + * 57.{ARKUI_BLEND_MODE_LUMINOSITY,BLEND_APPLY_TYPE_FAST} + * 58.{ARKUI_BLEND_MODE_LUMINOSITY,BLEND_APPLY_TYPE_OFFSCREEN} + * 59.{ARKUI_BLEND_MODE_COLOR_BURN,BLEND_APPLY_TYPE_FAST} + * 60.{ARKUI_BLEND_MODE_COLOR_BURN,BLEND_APPLY_TYPE_OFFSCREEN} + * 共60种显示效果测试*/ + it('testCommonAttrsBlendMode001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsBlendModeTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..435ac98e5cf4d45324e71c202aeea9d527753e10 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderColorTest.test.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsBorderColorTest() {commonAttrsBorderColorTest + describe('CommonAttrsBorderColorTest', () => { + + let PAGE_TAG = 'CommonAttrsBorderColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Row组件borderColor参数分别设置为0xFF00FF00、(0xFF0000FF, 0xFF0000FF, 0xFF0000FF, 0xFF0000FF)时的显示效果测试 + it('testCommonAttrsBorderColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderRadiusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderRadiusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..779cf0f3037b52024f384f31637f74c7435dc8dd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderRadiusTest.test.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsBorderRadiusTest() {commonAttrsBorderRadiusTest + describe('CommonAttrsBorderRadiusTest', () => { + + let PAGE_TAG = 'CommonAttrsBorderRadiusTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Row组件borderRadius参数分别设置为5、(5,5,5,5)、25、(150,150,150,150)、-5、(-5,-5,-5,-5)时的显示效果测试 + it('testCommonAttrsBorderRadius001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..54f850d687fbc96f54e4d1ca0a159ae193ad3c05 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderStyleTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsBorderStyleTest() {commonAttrsBorderStyleTest + describe('CommonAttrsBorderStyleTest', () => { + + let PAGE_TAG = 'CommonAttrsBorderStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* Row组件borderStyle参数分别设置为ARKUI_BORDER_STYLE_SOLID、ARKUI_BORDER_STYLE_DASHED、ARKUI_BORDER_STYLE_DOTTED、 + * (ARKUI_BORDER_STYLE_SOLID,ARKUI_BORDER_STYLE_SOLID,ARKUI_BORDER_STYLE_SOLID,ARKUI_BORDER_STYLE_SOLID)、 + * (ARKUI_BORDER_STYLE_DASHED,ARKUI_BORDER_STYLE_DASHED,ARKUI_BORDER_STYLE_DASHED,ARKUI_BORDER_STYLE_DASHED)、 + * (ARKUI_BORDER_STYLE_DOTTED,ARKUI_BORDER_STYLE_DOTTED,ARKUI_BORDER_STYLE_DOTTED,ARKUI_BORDER_STYLE_DOTTED)时的显示 + * 效果测试 + */ + it('testCommonAttrsBorderStyle001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..be4f7e076c58bbbb93456b15b5dcb5ccf13890ea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsBorderWidthTest.test.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsBorderWidthTest() {commonAttrsBorderWidthTest + describe('CommonAttrsBorderWidthTest', () => { + + let PAGE_TAG = 'CommonAttrsBorderWidthTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Row组件borderWidth参数分别设置为5、(5,5,5,5)、-5、(-5,-5,-5,-5)时的显示效果测试 + it('testCommonAttrsBorderWidth001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsClipTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsClipTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d8c855485047fcd4bc3c8a9b36ec183bec61ba1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsClipTest.test.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsClipTest() { + + describe('CommonAttrsClipTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //矩形 + it('testCommonAttrsClip001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsClipRectangleTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //圆形 + it('testCommonAttrsClip002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsClipCircleTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //椭圆形 + it('testCommonAttrsClip003', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsClipEllipseTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //路径 + it('testCommonAttrsClip004', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsClipPathTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsConstraintSizeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsConstraintSizeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5adeb5086e1711de103d26bda5f401f2ef60098 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsConstraintSizeTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsConstraintSizeTest() { + + describe('CommonAttrsConstraintSizeTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //最大值大于设定值大于最小值 + it('testCommonAttrsConstraintSize001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsConstraintSizeMaxSetMinTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //最大值大于最小值大于设定值 + it('testCommonAttrsConstraintSize002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsConstraintSizeMaxMinSetTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //设定值大于最大值大于最小值 + it('testCommonAttrsConstraintSize003', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsConstraintSizeSetMaxMinTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //最小值大于设定值大于最大值 + it('testCommonAttrsConstraintSize004', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsConstraintSizeMinSetMaxTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //最小值大于最大值大于设定值 + it('testCommonAttrsConstraintSize005', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsConstraintSizeMinMaxSetTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //设定值大于最小值大于最大值 + it('testCommonAttrsConstraintSize006', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsConstraintSizeSetMinMaxTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsContrastTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsContrastTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7073519061a4f618be5639b15bd2d697decd76fb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsContrastTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsContrastTest() { + + describe('CommonAttrsContrastTest', () => { + + let PAGE_TAG = 'CommonAttrsContrastTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * CommonAttrs组件contrast参数设置为0时的显示效果测试 + * CommonAttrs组件contrast参数设置为1时的显示效果测试 + * CommonAttrs组件contrast参数设置为5时的显示效果测试 + * CommonAttrs组件contrast参数设置为10时的显示效果测试 + * CommonAttrs组件contrast参数设置为-1时的显示效果测试 + * CommonAttrs组件contrast参数设置为11时的显示效果测试 + */ + it('testCommonAttrsContrast001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsDirectionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsDirectionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0137e0adc5498acb7b0c71145a7ecda095b91506 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsDirectionTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsDirectionTest() { + + describe('CommonAttrsDirectionTest', () => { + + let PAGE_TAG = 'CommonAttrsDirectionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + * Row组件调用capi设置direction为 + * ARKUI_DIRECTION_LTR + * ARKUI_DIRECTION_RTL + * ARKUI_DIRECTION_AUTO + * 默认值 + * 枚举异常值(500) + * 的显示效果测试 + */ + it('testCommonAttrsDirection001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsEnabledTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsEnabledTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..07838e24415a36ad32eadea1fc4ac821b39236b6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsEnabledTest.test.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsEnabledTest() { + + describe('CommonAttrsEnabledTest', () => { + + let PAGE_TAG = 'CommonAttrsEnabledTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Button组件调用capi设置enabled为true,点击事件、焦点事件正常触发的场景 + it('testCommonAttrsEnabled001', 0, async (done: Function) => { + await Utils.clickComponent('EnabledTestButton') + await Utils.sleep(2000) + + focusControl.requestFocus('EnabledTestButton') + await Utils.sleep(2000) + focusControl.requestFocus('EnabledTestButtonCompare') + await Utils.sleep(2000) + + focusControl.requestFocus('EnabledTestButtonCompareBlur') + await Utils.sleep(2000) + focusControl.requestFocus('EnabledTestButtonCompare') + await Utils.sleep(2000) + + done() + }) + + //Button组件调用capi设置enabled为false,点击事件、焦点事件无法触发的场景 + it('testCommonAttrsEnabled002', 0, async (done: Function) => { + await Utils.clickComponent('EnabledTestButtonDisable') + await Utils.sleep(2000) + + focusControl.requestFocus('EnabledTestButton') + await Utils.sleep(2000) + focusControl.requestFocus('EnabledTestButtonDisable') + await Utils.sleep(2000) + + focusControl.requestFocus('EnabledTestButton') + await Utils.sleep(2000) + + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFlexBasisTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFlexBasisTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2774ef6c609065651898b3a2a929a28aa2425738 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFlexBasisTest.test.ets @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsFlexBasisTest() { + + describe('CommonAttrsFlexBasisTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Button组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCommonAttrsFlexBasis001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexBasisFlexRowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Button组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCommonAttrsFlexBasis002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexBasisFlexColumnTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + await Utils.sleep(1000); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Button组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCommonAttrsFlexBasis003', 0, async (done: Function) => { + await Utils.sleep(1000); + let PAGE_TAG = 'CommonAttrsFlexBasisFlexRowReverseTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Button组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCommonAttrsFlexBasis004', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexBasisFlexColumnReverseTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Row时,Button组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCommonAttrsFlexBasis005', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexBasisRowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Column时,Button组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCommonAttrsFlexBasis006', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexBasisColumnTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFlexGrowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFlexGrowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d4d832da59cbdb5ff042d593182c140857a45094 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFlexGrowTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsFlexGrowTest() { + + describe('CommonAttrsFlexGrowTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Button组件设置flexgrow属性值为3时的显示效果测试 + it('testCommonAttrsFlexGrow001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexGrowFlexRowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Button组件设置flexgrow属性值为3时的显示效果测试 + it('testCommonAttrsFlexGrow002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexGrowFlexColumnTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Button组件设置flexgrow属性值为3时的显示效果测试 + it('testCommonAttrsFlexGrow003', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexGrowFlexRowReverseTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Button组件设置flexgrow属性值为3时的显示效果测试 + it('testCommonAttrsFlexGrow004', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexGrowFlexColumnReverseTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Row时,Button组件设置flexgrow属性值为3时的显示效果测试 + it('testCommonAttrsFlexGrow005', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexGrowRowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Column时,Button组件设置flexgrow属性值为3时的显示效果测试 + it('testCommonAttrsFlexGrow006', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexGrowColumnTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFlexShrinkTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFlexShrinkTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..92a963c776fb2e1afee2909b7a3ece59a472dfec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFlexShrinkTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsFlexShrinkTest() { + + describe('CommonAttrsFlexShrinkTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Button组件设置flexshrink属性值为3时的显示效果测试 + it('testCommonAttrsFlexShrink001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexShrinkFlexRowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Button组件设置flexshrink属性值为3时的显示效果测试 + it('testCommonAttrsFlexShrink002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexShrinkFlexColumnTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Button组件设置flexshrink属性值为3时的显示效果测试 + it('testCommonAttrsFlexShrink003', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexShrinkFlexRowReverseTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Button组件设置flexshrink属性值为3时的显示效果测试 + it('testCommonAttrsFlexShrink004', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexShrinkFlexColumnReverseTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Row时,Button组件设置flexshrink属性值为3时的显示效果测试 + it('testCommonAttrsFlexShrink005', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexShrinkRowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Column时,Button组件设置flexshrink属性值为3时的显示效果测试 + it('testCommonAttrsFlexShrink006', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFlexShrinkColumnTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFocusableTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFocusableTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..35ec55ba237b5e9326de96a677cbdcd525a9eaff --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsFocusableTest.test.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsFocusableTest() { + + describe('CommonAttrsFocusableTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Button组件调用capi设置focusable为true,通用事件onFocus正常触发的场景 + it('testCommonAttrsFocusable001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFocusableTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + focusControl.requestFocus('FocusableTestButtonCompare') + await Utils.sleep(2000) + focusControl.requestFocus('FocusableTestButton') + await Utils.sleep(2000) + + done() + }) + + //Button组件调用capi设置focusable为false,通用事件onFocus无法触发的场景 + it('testCommonAttrsFocusable002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFocusableTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + focusControl.requestFocus('FocusableTestButton') + await Utils.sleep(2000) + focusControl.requestFocus('FocusableTestButtonDisable') + await Utils.sleep(2000) + + done() + }) + + //Button组件调用capi设置focusable和defaultFocus结合的场景 + it('testCommonAttrsFocusable003', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsFocusableCombineTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`); + focusControl.requestFocus('FocusableTestButtonTrue') + await Utils.sleep(2000) + focusControl.requestFocus('FocusableTestButtonTrueFalse') + await Utils.sleep(2000) + focusControl.requestFocus('FocusableTestButtonFalseTrue') + await Utils.sleep(2000) + focusControl.requestFocus('FocusableTestButtonFalse') + await Utils.sleep(2000) + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsForegroundBlurStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsForegroundBlurStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..73578a82d02af811a6cbb865fe1726de201ed9b4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsForegroundBlurStyleTest.test.ets @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsForegroundBlurStyleTest() { + + describe('CommonAttrsForegroundBlurStyleTest', () => { + + let PAGE_TAG = 'CommonAttrsForegroundBlurStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + Stack组件参数设置foregroundBlurStyle + value[0] = ARKUI_BLUR_STYLE_THIN; + value[0] = ARKUI_BLUR_STYLE_REGULAR; + value[0] = ARKUI_BLUR_STYLE_THICK; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_THIN; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_REGULAR; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_THICK; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK; + value[0] = ARKUI_BLUR_STYLE_NONE; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_THIN; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_REGULAR; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_THICK; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK; + value[0] = 500; + value[1] = ARKUI_COLOR_MODE_SYSTEM; + value[1] = ARKUI_COLOR_MODE_LIGHT; + value[1] = ARKUI_COLOR_MODE_DARK; + value[1] = 500; + value[2] = ARKUI_ADAPTIVE_COLOR_DEFAULT; + value[2] = ARKUI_ADAPTIVE_COLOR_AVERAGE; + value[2] = 500; + value[4] = -1; + value[4] = 0; + value[4] = 20; + value[4] = 127; + value[4] = 200; + value[4] = -1; + value[4] = 0; + value[4] = 20; + value[4] = 127; + value[4] = 200; + {{.i32 = ARKUI_BLUR_STYLE_THIN}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_AVERAGE}, + {.f32 = 20}, + {.f32 = 20}, + {.f32 = 20}} + 时的显示效果测试 + */ + it('testCommonAttrsForegroundBlurStyle001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsGrayscaleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsGrayscaleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..04dd864a0c301e31af9bc5e06717c2eef48ba1ba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsGrayscaleTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsGrayscaleTest() { + + describe('CommonAttrsGrayscaleTest', () => { + + let PAGE_TAG = 'CommonAttrsGrayscaleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * CommonAttrs组件grayscale参数设置为0时的显示效果测试 + * CommonAttrs组件grayscale参数设置为0.5时的显示效果测试 + * CommonAttrs组件grayscale参数设置为0.8时的显示效果测试 + * CommonAttrs组件grayscale参数设置为1.0时的显示效果测试 + * CommonAttrs组件grayscale参数设置为-1.0时的显示效果测试 + * CommonAttrs组件grayscale参数设置为2.0时的显示效果测试 + */ + it('testCommonAttrsGrayscale001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d7fc06aafbfaad393de36ebd06a61036ce8f246 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsHeightTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsHeightTest() { + + describe('CommonAttrsHeightTest', () => { + + let PAGE_TAG = 'CommonAttrsHeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件height参数分别设置为50、-100、10000时的显示效果测试 + it('testCommonAttrsHeight001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsHitTestBehaviorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsHitTestBehaviorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a731104ad72520d34fac85aa1ef5e6873e191c2b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsHitTestBehaviorTest.test.ets @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsHitTestBehaviorTest() { + + describe('CommonAttrsHitTestBehaviorTest', () => { + + let PAGE_TAG = 'CommonAttrsHitTestBehaviorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * CommonAttrs组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_DEFAULT时的显示效果测试 + * CommonAttrs组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_BLOCK时的显示效果测试 + * CommonAttrs组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_TRANSPARENT时的显示效果测试 + * CommonAttrs组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_NONE时的显示效果测试 + * CommonAttrs组件hitTestBehavior参数设置为-1时的显示效果测试 + * CommonAttrs组件hitTestBehavior参数设置为4时的显示效果测试 + */ + it('testCommonAttrsHitTestBehavior001', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTestStackDefault') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackBlock') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackTransparent') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackNone') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackExceptBelow') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackExceptAbove') + await Utils.sleep(2000) + + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsIdTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsIdTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e9ccb2943a9936a39fa0d074966dc11d1894afc5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsIdTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsIdTest() { + + describe('CommonAttrsIdTest', () => { + + let PAGE_TAG = 'CommonAttrsIdTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * CommonAttrs组件Id参数设置为CommonAttrsRed时的显示效果测试 + * CommonAttrs组件Id参数设置为CommonAttrsGreen时的显示效果测试 + */ + it('testCommonAttrsId001', 0, async (done: Function) => { + await Utils.clickComponent('onTouchFirst') + await Utils.sleep(1000) + await Utils.clickComponent('onTouchSecond') + await Utils.sleep(1000) + + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsInvertTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsInvertTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2a4cc930e3ec1d4ed2b3477f2370ad2b7c22238f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsInvertTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsInvertTest() { + + describe('CommonAttrsInvertTest', () => { + + let PAGE_TAG = 'CommonAttrsInvertTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * CommonAttrs组件invert参数设置为0时的显示效果测试 + * CommonAttrs组件invert参数设置为0.5时的显示效果测试 + * CommonAttrs组件invert参数设置为0.8时的显示效果测试 + * CommonAttrs组件invert参数设置为1时的显示效果测试 + * CommonAttrs组件invert参数设置为-1时的显示效果测试 + * CommonAttrs组件invert参数设置为2时的显示效果测试 + */ + it('testCommonAttrsInvert001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsJustifyContentTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsJustifyContentTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..23f01355109424b77248f6767a87bcec0eb1b826 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsJustifyContentTest.test.ets @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +async function doIt(pageTag: string, testType: number, done?: Function) { + Utils.emitEvent(pageTag, testType, 8888) +} + +export default function commonAttrsJustifyContentTest() { + + describe('CommonAttrsJustifyContentTest', () => { + + let PAGE_TAG = 'CommonAttrsJustifyContentTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件在row容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_START时的显示效果测试 + it('testCommonAttrsJustifyContent001', 0, async (done: Function) => { + doIt(PAGE_TAG, 1); + done(); + }) + + // Button组件在row容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsJustifyContent002', 0, async (done: Function) => { + doIt(PAGE_TAG, 2); + done(); + }) + + // Button组件在row容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_END时的显示效果测试 + it('testCommonAttrsJustifyContent003', 0, async (done: Function) => { + doIt(PAGE_TAG, 3); + done(); + }) + + // Button组件在row容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN时的显示效果测试 + it('testCommonAttrsJustifyContent004', 0, async (done: Function) => { + doIt(PAGE_TAG, 4); + done(); + }) + + // Button组件在row容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_SPACE_AROUND时的显示效果测试 + it('testCommonAttrsJustifyContent005', 0, async (done: Function) => { + doIt(PAGE_TAG, 5); + done(); + }) + + // Button组件在row容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_SPACE_EVENLY时的显示效果测试 + it('testCommonAttrsJustifyContent006', 0, async (done: Function) => { + doIt(PAGE_TAG, 6); + done(); + }) + + // Button组件在column容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_START时的显示效果测试 + it('testCommonAttrsJustifyContent007', 0, async (done: Function) => { + doIt(PAGE_TAG, 7); + done(); + }) + + // Button组件在column容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_CENTER时的显示效果测试 + it('testCommonAttrsJustifyContent008', 0, async (done: Function) => { + doIt(PAGE_TAG, 8); + done(); + }) + + // Button组件在column容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_END时的显示效果测试 + it('testCommonAttrsJustifyContent009', 0, async (done: Function) => { + doIt(PAGE_TAG, 9); + done(); + }) + + // Button组件在column容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_SPACE_BETWEEN时的显示效果测试 + it('testCommonAttrsJustifyContent010', 0, async (done: Function) => { + doIt(PAGE_TAG, 10); + done(); + }) + + // Button组件在column容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_SPACE_AROUND时的显示效果测试 + it('testCommonAttrsJustifyContent011', 0, async (done: Function) => { + doIt(PAGE_TAG, 11); + done(); + }) + + // Button组件在column容器设置justifyContent属性值为ARKUI_FLEX_ALIGNMENT_SPACE_EVENLY时的显示效果测试 + it('testCommonAttrsJustifyContent012', 0, async (done: Function) => { + doIt(PAGE_TAG, 12); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsLinearGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsLinearGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..92fb92f3f3007206ece1df7dfa5acd41bf21afae --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsLinearGradientTest.test.ets @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsLinearGradientTest() { + + describe('CommonAttrsLinearGradientTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //向左渐变 + it('testCommonAttrsLinearGradient001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientLeftTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //向上渐变 + it('testCommonAttrsLinearGradient002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientTopTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //向右渐变 + it('testCommonAttrsLinearGradient003', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientRightTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //向下渐变 + it('testCommonAttrsLinearGradient004', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientBottomTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //向左上渐变 + it('testCommonAttrsLinearGradient005', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientLeftTopTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //向左下渐变 + it('testCommonAttrsLinearGradient006', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientLeftBottomTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //向右上渐变 + it('testCommonAttrsLinearGradient007', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientRightTopTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //向右下渐变 + it('testCommonAttrsLinearGradient008', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientRightBottomTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //不渐变 + it('testCommonAttrsLinearGradient009', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientNoneTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //自定义渐变方向 + it('testCommonAttrsLinearGradient010', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientCustomTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testCommonAttrsLinearGradient011', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientLowerBoundAbnormalTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //非法颜色 + it('testCommonAttrsLinearGradient012', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsLinearGradientIllegalColorAbnormalTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsMarginTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsMarginTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..47d89e663515464d985cf88955cac384153e2404 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsMarginTest.test.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsMarginTest() { + + describe('CommonAttrsMarginTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //统一设置 + it('testCommonAttrsMargin001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsMarginUnifiedTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //分别设置 + it('testCommonAttrsMargin002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsMarginRespectivelyTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //统一设置负数 + it('testCommonAttrsMargin003', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsMarginUnifiedNegativeTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //分别设置负数 + it('testCommonAttrsMargin004', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsMarginRespectivelyNegativeTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsMaskTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsMaskTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecaff8fa9f483be1389ddbbeae1ae97c0e52c08a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsMaskTest.test.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsMaskTest() { + + describe('CommonAttrsMaskTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* image组件mask参数为 + * 1. + * 0xFFFF0000, 0xFF000000, 2, ARKUI_MASK_TYPE_RECTANGLE, 100, 100, 10, 10 + * 2. + * 0xFFFF0000, 0xFF000000, 5, ARKUI_MASK_TYPE_CIRCLE, 100, 100 + * 3. + * 0xFFFF3333, 0xFF000000, 10, ARKUI_MASK_TYPE_ELLIPSE, 100, 50 + * 4. + * 0xFFFF3333, 0xFF000000, 10, ARKUI_MASK_TYPE_PATH, 50, 50 + * 5. + * ARKUI_MASK_TYPE_PROGRESS, 50, 100, 0xFF00FF00 + * 的正常显示效果测试*/ + it('testCommonAttrsMask001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsMaskTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done(); + }) + + /* image组件mask参数为 + * 1. + * 0xFFFF3333, 0xFF000000, -10, ARKUI_MASK_TYPE_RECTANGLE, -100, -100, -10, -10 + * 2. + * 0xFFFF3333, + * 0xFF000000, -10, ARKUI_MASK_TYPE_CIRCLE, -100, -100 + * 3. + * 0xFFFF3333, 0xFF000000, -10, ARKUI_MASK_TYPE_ELLIPSE, -100, -50 + * 4. + * 0xFFFF3333, 0xFF000000, -10, ARKUI_MASK_TYPE_PATH, -100, -100 + * 5. + * ARKUI_MASK_TYPE_PROGRESS, -50, 100, 0xFF00FF00 + * 的异常显示效果测试*/ + it('testCommonAttrsMask002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsMaskAbnormalTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done(); + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsOpacityTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsOpacityTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..af99ff48841f3524ee8b0304905f7ad2e856c3d3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsOpacityTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsOpacityTest() { + + describe('CommonAttrsOpacityTest', () => { + + let PAGE_TAG = 'CommonAttrsOpacityTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * CommonAttrs组件opacity参数设置为0时的显示效果测试 + * CommonAttrs组件opacity参数设置为0.5时的显示效果测试 + * CommonAttrs组件opacity参数设置为0.8时的显示效果测试 + * CommonAttrs组件opacity参数设置为1时的显示效果测试 + * CommonAttrs组件opacity参数设置为-1时的显示效果测试 + * CommonAttrs组件opacity参数设置为2时的显示效果测试 + */ + it('testCommonAttrsOpacity001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsPositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsPositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5aa8f8401c58553da744b2abc116af5bc96b92ce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsPositionTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsPositionTest() { + + describe('CommonAttrsPositionTest', () => { + + let PAGE_TAG = 'CommonAttrsPositionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Flex组件position参数分别设置为{50,50},{-50,-50}时的显示效果测试 + it('testCommonAttrsPosition001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsRadialGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsRadialGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..329487c226f215d1d67113456e6a168779c42084 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsRadialGradientTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsRadialGradientTest() { + + describe('CommonAttrsRadialGradientTest', () => { + + let PAGE_TAG = 'CommonAttrsRadialGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * row组件参数设置radialGradient {.value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF,0xFF000000} stops:{0.2,0.5, 1}size:3} + * {.value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * .value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:0 colors:{1234, 1234} stops:{0.3, 1}size:2} + * {.value[0].f32:-25 .value[1].f32:-25 .value[2].f32:-25 .value[3].i32:-1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2}时的显示效果测试 + */ + it('testCommonAttrsRadialGradient001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsScaleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsScaleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..67420f980e1632a05975ed4a5e8758b2d8d02857 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsScaleTest.test.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsScaleTest() { + + describe('CommonAttrsScaleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //X轴Y轴同时缩小 + it('testCommonAttrsScale001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsScaleReduceXYTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //单独缩小X轴 + it('testCommonAttrsScale002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsScaleReduceXTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //X轴Y轴同时放大 + it('testCommonAttrsScale003', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsScaleEnlargeXYTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //单独放大X轴 + it('testCommonAttrsScale004', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsScaleEnlargeXTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //下界异常场景 + it('testCommonAttrsScale005', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsScaleAbnormalTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsSepiaTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsSepiaTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a375d1310d8a060ca8cfd0f91bb3446d70a363c3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsSepiaTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsSepiaTest() { + + describe('CommonAttrsSepiaTest', () => { + + let PAGE_TAG = 'CommonAttrsSepiaTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * CommonAttrs组件sepia参数设置为0时的显示效果测试 + * CommonAttrs组件sepia参数设置为0.5时的显示效果测试 + * CommonAttrs组件sepia参数设置为0.8时的显示效果测试 + * CommonAttrs组件sepia参数设置为1时的显示效果测试 + * CommonAttrs组件sepia参数设置为-1时的显示效果测试 + * CommonAttrs组件sepia参数设置为2时的显示效果测试 + */ + it('testCommonAttrsSepia001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsShadowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsShadowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c60ca8dca1860e3df7e553c71142d033b0a81ffe --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsShadowTest.test.ets @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsShadowTest() { + + describe('CommonAttrsShadowTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //超小阴影 + it('testCommonAttrsShadow001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsShadowUltraSmallShadowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //小阴影 + it('testCommonAttrsShadow002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsShadowSmallShadowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //中阴影 + it('testCommonAttrsShadow003', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsShadowMiddleShadowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //大阴影 + it('testCommonAttrsShadow004', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsShadowLargeShadowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //浮动中阴影 + it('testCommonAttrsShadow005', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsShadowFloatingShadowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //浮动小阴影 + it('testCommonAttrsShadow006', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsShadowFloatingSmallShadowTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testCommonAttrsShadow007', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsShadowLowerBoundAbnormalTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testCommonAttrsShadow008', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsShadowUpperBoundAbnormalTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsSweepGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsSweepGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f358ef37beece72c1c98176d406588ce08cf2ad6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsSweepGradientTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsSweepGradientTest() { + + describe('CommonAttrsSweepGradientTest', () => { + + let PAGE_TAG = 'CommonAttrsSweepGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * row组件参数设置sweepGradient {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF, 0xFF000000} stops:{0.2, 0.5, 1}size:3} + * {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:0 colors:{1234, 1234} stops:{0.3, 1}size:2} + * {.value[0].f32:-50 .value[1].f32:-50 .value[2].f32:-1 .value[3].f32:-180 .value[4].f32:-90 .value[5].i32:-1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2}时的显示效果测试\ + */ + it('testCommonAttrsSweepGradient001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsTransformTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsTransformTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ff051d5ad3ed569810ce122f8a357003fea01db --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsTransformTest.test.ets @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsTransformTest() { + + describe('CommonAttrsTransformTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* column组件transform参数为 + * 1. + * [1, 0, 0, 0] + * [0, 1, 0, 0] + * [0, 0, 1, 0] + * [0, -20 ,0 ,1] + * 2. + * [static_cast(cos(30)), static_cast(-sin(30)), 0, 0] + * [static_cast(sin(30)), static_cast(cos(30)), 0, 0] + * [0, 0, 1, 0] + * [0, 0, 0, 1] + * 3. + * [0.5, 0, 0, 0] + * [0, 0.5, 0, 0] + * [0, 0, 0.5, 0] + * [0, 0, 0, 1] + * 的正常显示效果测试*/ + it('testCommonAttrsTransform001', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsTransformTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done(); + }) + + /* column组件transform参数为 + * 1. + * [1, 0, 0, 0] + * [0, 1, 0, 0] + * [0, 0, 1, 0] + * [0, -20] + * 2. + * [0, 1, 0, 0] + * [0, 0, 1, 0] + * [0, 0, 0, 1] + * [0, 0, 0, 0] + * 3. + * [] + * 的异常显示效果测试*/ + it('testCommonAttrsTransform002', 0, async (done: Function) => { + let PAGE_TAG = 'CommonAttrsTransformAbnormalTest'; + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + done(); + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..98aa10cac0a52526b7fa5d8ad2e2c3a010c927af --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonattrs/CommonAttrsWidthTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonAttrsWidthTest() { + + describe('CommonAttrsWidthTest', () => { + + let PAGE_TAG = 'CommonAttrsWidthTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonattrs/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Button组件width参数分别设置为300、10000、-100时的显示效果测试 + it('testCommonAttrsWidth001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnAppearTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnAppearTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec742869415a3c705ccf5806d50df48a6201ee7f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnAppearTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonEventOnAppearTest() { + + describe('CommonEventOnAppearTest', () => { + + let PAGE_TAG = 'CommonEventOnAppearTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonevent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //CheckBox调用capi设置通用事件onAppear正常触发的场景 + it('testCommonEventOnAppear001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnAreaChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnAreaChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f5a5b278788ae244ca8f108a90d215dfc4ca4bf2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnAreaChangeTest.test.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonEventOnAreaChangeTest() { + + describe('CommonEventOnAreaChangeTest', () => { + + let PAGE_TAG = 'CommonEventOnAreaChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonevent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //ImageSpan组件调用capi设置通用事件onAreaChange,当修改组件大小时正常触发的场景 + it('testCommonEventOnAreaChange001', 0, async (done: Function) => { + await Utils.clickComponent('OnAreaChangeTestImageSpanSize') + await Utils.sleep(2000) + done() + }) + + //ImageSpan组件调用capi设置通用事件onAreaChange,当组件位置发生变化时正常触发的场景 + it('testCommonEventOnAreaChange002', 0, async (done: Function) => { + await Utils.clickComponent('OnAreaChangeTestImageSpanMoveCompare') + await Utils.sleep(2000) + done() + }) + + //ImageSpan组件调用capi设置通用事件onAreaChange,当组件设置offset时不会触发的场景 + it('testCommonEventOnAreaChange003', 0, async (done: Function) => { + await Utils.clickComponent('OnAreaChangeTestImageSpanOffset') + await Utils.sleep(2000) + done() + }) + + //ImageSpan组件调用capi设置通用事件onAreaChange,当组件设置translate时不会触发的场景 + it('testCommonEventOnAreaChange004', 0, async (done: Function) => { + await Utils.clickComponent('OnAreaChangeTestImageSpanTranslate') + await Utils.sleep(2000) + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnBlurTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnBlurTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1193008a883cc614afae468db6452d77fc7a568e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnBlurTest.test.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonEventOnBlurTest() { + + describe('CommonEventOnBlurTest', () => { + + let PAGE_TAG = 'CommonEventOnBlurTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonevent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Button组件调用capi设置enabled为true,通用事件onBlur正常触发的场景 + it('testCommonEventOnBlur001', 0, async (done: Function) => { + focusControl.requestFocus('OnBlurTestButtonCompare') + await Utils.sleep(2000) + focusControl.requestFocus('OnBlurTestButton') + await Utils.sleep(2000) + done() + }) + + + //Button组件调用capi设置enabled为false,通用事件onBlur无法触发的场景 + it('testCommonEventOnBlur002', 0, async (done: Function) => { + focusControl.requestFocus('OnBlurTestButtonDisable') + await Utils.sleep(2000) + focusControl.requestFocus('OnBlurTestButton') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnClickTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnClickTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..af2546a6835515b77a9ab93aa96c3128e9926224 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnClickTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonEventOnClickTest() { + + describe('CommonEventOnClickTest', () => { + + let PAGE_TAG = 'CommonEventOnClickTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonevent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Image组件调用capi设置enabled为true,通用事件onClick正常触发的场景 + it('testCommonEventOnClick001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickTestImage') + await Utils.sleep(2000) + done() + }) + + //Image组件调用capi设置enabled为false,通用事件onClick无法触发的场景 + it('testCommonEventOnClick002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickTestImageDisable') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnFocusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnFocusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1e4d5f50acae33f0b20fe16bb4cbae66a2d46918 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnFocusTest.test.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonEventOnFocusTest() { + + describe('CommonEventOnFocusTest', () => { + + let PAGE_TAG = 'CommonEventOnFocusTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonevent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Button组件调用capi设置enabled为true,通用事件onFocus正常触发的场景 + it('testCommonEventOnFocus001', 0, async (done: Function) => { + focusControl.requestFocus('OnFocusTestButtonCompare') + await Utils.sleep(2000) + focusControl.requestFocus('OnFocusTestButton') + await Utils.sleep(2000) + done() + }) + + //Button组件调用capi设置enabled为false,通用事件onFocus无法触发的场景 + it('testCommonEventOnFocus002', 0, async (done: Function) => { + focusControl.requestFocus('OnFocusTestButton') + await Utils.sleep(2000) + focusControl.requestFocus('OnFocusTestButtonDisable') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnTouchTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnTouchTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e337b8177430445c2366521c377785906cf242c6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/commonevent/CommonEventOnTouchTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function commonEventOnTouchTest() { + + describe('CommonEventOnTouchTest', () => { + + let PAGE_TAG = 'CommonEventOnTouchTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`commonevent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Image组件调用capi设置enabled为true,通用事件onTouch正常触发的场景 + it('testCommonEventOnTouch001', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTest') + await Utils.sleep(2000) + done() + }) + + //Image组件调用capi设置enabled为false,通用事件onTouch无法触发的场景 + it('testCommonEventOnTouch002', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTestDisable') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityDescriptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityDescriptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8fd8226a85b79b3080e716ab825ec1767d25720 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityDescriptionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customAccessibilityDescriptionTest() { + + describe('CustomComponentAccessibilityDescriptionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件AccessibilityDescription属性为"Text" + it('testCustomComponentAccessibilityDescription001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentAccessibilityDescriptionTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // Custom组件AccessibilityDescription属性为"" + it('testCustomComponentAccessibilityDescription002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentAccessibilityDescriptionNullTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityGroupTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityGroupTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a1801058c5b455add05444a9688dc4d048f75db --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityGroupTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customAccessibilityGroupTest() { + + describe('CustomComponentAccessibilityGroupTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件AccessibilityGroup属性为true + it('testCustomComponentAccessibilityGroup001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentAccessibilityGroupTrueTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // Custom组件AccessibilityGroup属性为false + it('testCustomComponentAccessibilityGroup002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentAccessibilityGroupFalseTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityLevelTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityLevelTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2aad84fa8c9c594a6a92769f0ab9e61177cfff7e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityLevelTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customAccessibilityLevelTest() { + + describe('CustomComponentAccessibilityLevelTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件AccessibilityLevel属性为AUTO + it('testCustomComponentAccessibilityLevel001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentAccessibilityLevelAutoTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // Custom组件AccessibilityLevel属性为ENABLED + it('testCustomComponentAccessibilityLevel002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentAccessibilityLevelEnabledTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // Custom组件AccessibilityLevel属性为DISABLED + it('testCustomComponentAccessibilityLevel003', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentAccessibilityLevelDisabledTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // Custom组件AccessibilityLevel属性为DISABLED_FOR_DESCENDANTS + it('testCustomComponentAccessibilityLevel004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentAccessibilityLevelDescendantsTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityTextTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityTextTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6b4668d0589828441aa174ef2422666f428f1d6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAccessibilityTextTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customAccessibilityTextTest() { + + describe('CustomComponentAccessibilityTextTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件AccessibilityText属性为"Text" + it('testCustomComponentAccessibilityText001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentAccessibilityTextTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // Custom组件AccessibilityText属性为"" + it('testCustomComponentAccessibilityText002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentAccessibilityTextNullTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAlignSelfTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAlignSelfTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..751dd52afdeab142c21f0c17ac5489416fbac150 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAlignSelfTest.test.ets @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +async function doIt(pageTag: string, testType: number, done?: Function) { + Utils.emitEvent(pageTag, testType, 6666) +} + +export default function customAlignSelfTest() { + + describe('CustomComponentAlignSelfTest', () => { + + let PAGE_TAG = 'CustomComponentAlignSelfTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCustomComponentAlignSelf001', 0, async (done: Function) => { + doIt(PAGE_TAG, 1); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCustomComponentAlignSelf002', 0, async (done: Function) => { + doIt(PAGE_TAG, 2); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCustomComponentAlignSelf003', 0, async (done: Function) => { + doIt(PAGE_TAG, 3); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCustomComponentAlignSelf004', 0, async (done: Function) => { + doIt(PAGE_TAG, 4); + done(); + }) + + // 当父容器为Row时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCustomComponentAlignSelf005', 0, async (done: Function) => { + doIt(PAGE_TAG, 5); + done(); + }) + + // 当父容器为Column时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_AUTO时的显示效果测试 + it('testCustomComponentAlignSelf006', 0, async (done: Function) => { + doIt(PAGE_TAG, 6); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCustomComponentAlignSelf007', 0, async (done: Function) => { + doIt(PAGE_TAG, 7); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCustomComponentAlignSelf008', 0, async (done: Function) => { + doIt(PAGE_TAG, 8); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCustomComponentAlignSelf009', 0, async (done: Function) => { + doIt(PAGE_TAG, 9); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCustomComponentAlignSelf010', 0, async (done: Function) => { + doIt(PAGE_TAG, 10); + done(); + }) + + // 当父容器为Row时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCustomComponentAlignSelf011', 0, async (done: Function) => { + doIt(PAGE_TAG, 11); + done(); + }) + + // 当父容器为Column时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_START时的显示效果测试 + it('testCustomComponentAlignSelf012', 0, async (done: Function) => { + doIt(PAGE_TAG, 12); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCustomComponentAlignSelf013', 0, async (done: Function) => { + doIt(PAGE_TAG, 13); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCustomComponentAlignSelf014', 0, async (done: Function) => { + doIt(PAGE_TAG, 14); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCustomComponentAlignSelf015', 0, async (done: Function) => { + doIt(PAGE_TAG, 15); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCustomComponentAlignSelf016', 0, async (done: Function) => { + doIt(PAGE_TAG, 16); + done(); + }) + + // 当父容器为Row时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCustomComponentAlignSelf017', 0, async (done: Function) => { + doIt(PAGE_TAG, 17); + done(); + }) + + // 当父容器为Column时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_CENTER时的显示效果测试 + it('testCustomComponentAlignSelf018', 0, async (done: Function) => { + doIt(PAGE_TAG, 18); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCustomComponentAlignSelf019', 0, async (done: Function) => { + doIt(PAGE_TAG, 19); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCustomComponentAlignSelf020', 0, async (done: Function) => { + doIt(PAGE_TAG, 20); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCustomComponentAlignSelf021', 0, async (done: Function) => { + doIt(PAGE_TAG, 21); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCustomComponentAlignSelf022', 0, async (done: Function) => { + doIt(PAGE_TAG, 22); + done(); + }) + + // 当父容器为Row时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCustomComponentAlignSelf023', 0, async (done: Function) => { + doIt(PAGE_TAG, 23); + done(); + }) + + // 当父容器为Column时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_END时的显示效果测试 + it('testCustomComponentAlignSelf024', 0, async (done: Function) => { + doIt(PAGE_TAG, 24); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCustomComponentAlignSelf025', 0, async (done: Function) => { + doIt(PAGE_TAG, 25); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCustomComponentAlignSelf026', 0, async (done: Function) => { + doIt(PAGE_TAG, 26); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCustomComponentAlignSelf027', 0, async (done: Function) => { + doIt(PAGE_TAG, 27); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCustomComponentAlignSelf028', 0, async (done: Function) => { + doIt(PAGE_TAG, 28); + done(); + }) + + // 当父容器为Row时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCustomComponentAlignSelf029', 0, async (done: Function) => { + doIt(PAGE_TAG, 29); + done(); + }) + + // 当父容器为Column时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_STRETCH时的显示效果测试 + it('testCustomComponentAlignSelf030', 0, async (done: Function) => { + doIt(PAGE_TAG, 30); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCustomComponentAlignSelf031', 0, async (done: Function) => { + doIt(PAGE_TAG, 31); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCustomComponentAlignSelf032', 0, async (done: Function) => { + doIt(PAGE_TAG, 32); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCustomComponentAlignSelf033', 0, async (done: Function) => { + doIt(PAGE_TAG, 33); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCustomComponentAlignSelf034', 0, async (done: Function) => { + doIt(PAGE_TAG, 34); + done(); + }) + + // 当父容器为Row时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCustomComponentAlignSelf035', 0, async (done: Function) => { + doIt(PAGE_TAG, 35); + done(); + }) + + // 当父容器为Column时,Custom组件设置alignSelf属性值为ARKUI_ITEM_ALIGNMENT_BASELINE时的显示效果测试 + it('testCustomComponentAlignSelf036', 0, async (done: Function) => { + doIt(PAGE_TAG, 36); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAlignTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAlignTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..73f223f157b56ee41a4659fda7eac64972c86379 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentAlignTest.test.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customAlignTest() { + + describe('CustomComponentAlignTest', () => { + + let PAGE_TAG = 'CustomComponentAlignTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + * Custom组件调用capi设置align为 + * ARKUI_ALIGNMENT_TOP_START + * ARKUI_ALIGNMENT_TOP + * ARKUI_ALIGNMENT_TOP_END + * ARKUI_ALIGNMENT_START + * ARKUI_ALIGNMENT_CENTER + * ARKUI_ALIGNMENT_END + * ARKUI_ALIGNMENT_BOTTOM_START + * ARKUI_ALIGNMENT_BOTTOM + * ARKUI_ALIGNMENT_BOTTOM_END + * 默认值 + * 枚举异常值(500)- + * 的显示效果测试 + */ + it('testCustomComponentAlign001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..dfde5ca0651d0f602ac42f7d42b92b997e9aa8aa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBackgroundColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customBackgroundColorTest() { + + describe('CustomComponentBackgroundColorTest', () => { + + let PAGE_TAG = 'CustomComponentBackgroundColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件backgroundColor参数设置为0xFFFF0000、0xFFFFFFFF、0x00000000时的显示效果测试 + it('testCustomComponentBackgroundColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBlendModeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBlendModeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d0ba197b45c9a9cd07d019f13546eb508699824f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBlendModeTest.test.ets @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customBlendModeTest() { + + describe('CustomComponentBlendModeTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Custom组件blendmode参数为 + * 1.{ARKUI_BLEND_MODE_NONE,BLEND_APPLY_TYPE_FAST} + * 2.{ARKUI_BLEND_MODE_NONE,BLEND_APPLY_TYPE_OFFSCREEN} + * 3.{ARKUI_BLEND_MODE_CLEAR,BLEND_APPLY_TYPE_FAST} + * 4.{ARKUI_BLEND_MODE_CLEAR,BLEND_APPLY_TYPE_OFFSCREEN} + * 5.{ARKUI_BLEND_MODE_SRC,BLEND_APPLY_TYPE_FAST} + * 6.{ARKUI_BLEND_MODE_SRC,BLEND_APPLY_TYPE_OFFSCREEN} + * 7.{ARKUI_BLEND_MODE_DST,BLEND_APPLY_TYPE_FAST} + * 8.{ARKUI_BLEND_MODE_DST,BLEND_APPLY_TYPE_OFFSCREEN} + * 9.{ARKUI_BLEND_MODE_SRC_OVER,BLEND_APPLY_TYPE_FAST} + * 10.{ARKUI_BLEND_MODE_SRC_OVER,BLEND_APPLY_TYPE_OFFSCREEN} + * 11.{ARKUI_BLEND_MODE_DST_OVER,BLEND_APPLY_TYPE_FAST} + * 12.{ARKUI_BLEND_MODE_DST_OVER,BLEND_APPLY_TYPE_OFFSCREEN} + * 13.{ARKUI_BLEND_MODE_SRC_IN,BLEND_APPLY_TYPE_FAST} + * 14.{ARKUI_BLEND_MODE_SRC_IN,BLEND_APPLY_TYPE_OFFSCREEN} + * 15.{ARKUI_BLEND_MODE_DST_IN,BLEND_APPLY_TYPE_FAST} + * 16.{ARKUI_BLEND_MODE_DST_IN,BLEND_APPLY_TYPE_OFFSCREEN} + * 17.{ARKUI_BLEND_MODE_SRC_OUT,BLEND_APPLY_TYPE_FAST} + * 18.{ARKUI_BLEND_MODE_SRC_OUT,BLEND_APPLY_TYPE_OFFSCREEN} + * 19.{ARKUI_BLEND_MODE_DST_OUT,BLEND_APPLY_TYPE_FAST} + * 20.{ARKUI_BLEND_MODE_DST_OUT,BLEND_APPLY_TYPE_OFFSCREEN} + * 21.{ARKUI_BLEND_MODE_SRC_ATOP,BLEND_APPLY_TYPE_FAST} + * 22.{ARKUI_BLEND_MODE_SRC_ATOP,BLEND_APPLY_TYPE_OFFSCREEN} + * 23.{ARKUI_BLEND_MODE_DST_ATOP,BLEND_APPLY_TYPE_FAST} + * 24.{ARKUI_BLEND_MODE_DST_ATOP,BLEND_APPLY_TYPE_OFFSCREEN} + * 25.{ARKUI_BLEND_MODE_XOR,BLEND_APPLY_TYPE_FAST} + * 26.{ARKUI_BLEND_MODE_XOR,BLEND_APPLY_TYPE_OFFSCREEN} + * 27.{ARKUI_BLEND_MODE_PLUS,BLEND_APPLY_TYPE_FAST} + * 28.{ARKUI_BLEND_MODE_PLUS,BLEND_APPLY_TYPE_OFFSCREEN} + * 29.{ARKUI_BLEND_MODE_MODULATE,BLEND_APPLY_TYPE_FAST} + * 30.{ARKUI_BLEND_MODE_MODULATE,BLEND_APPLY_TYPE_OFFSCREEN} + * 31.{ARKUI_BLEND_MODE_SCREEN,BLEND_APPLY_TYPE_FAST} + * 32.{ARKUI_BLEND_MODE_SCREEN,BLEND_APPLY_TYPE_OFFSCREEN} + * 33.{ARKUI_BLEND_MODE_OVERLAY,BLEND_APPLY_TYPE_FAST} + * 34.{ARKUI_BLEND_MODE_OVERLAY,BLEND_APPLY_TYPE_OFFSCREEN} + * 35.{ARKUI_BLEND_MODE_DARKEN,BLEND_APPLY_TYPE_FAST} + * 36.{ARKUI_BLEND_MODE_DARKEN,BLEND_APPLY_TYPE_OFFSCREEN} + * 37.{ARKUI_BLEND_MODE_LIGHTEN,BLEND_APPLY_TYPE_FAST} + * 38.{ARKUI_BLEND_MODE_LIGHTEN,BLEND_APPLY_TYPE_OFFSCREEN} + * 39.{ARKUI_BLEND_MODE_COLOR_DODGE,BLEND_APPLY_TYPE_FAST} + * 40.{ARKUI_BLEND_MODE_COLOR_DODGE,BLEND_APPLY_TYPE_OFFSCREEN} + * 41.{ARKUI_BLEND_MODE_HARD_LIGHT,BLEND_APPLY_TYPE_FAST} + * 42.{ARKUI_BLEND_MODE_HARD_LIGHT,BLEND_APPLY_TYPE_OFFSCREEN} + * 43.{ARKUI_BLEND_MODE_SOFT_LIGHT,BLEND_APPLY_TYPE_FAST} + * 44.{ARKUI_BLEND_MODE_SOFT_LIGHT,BLEND_APPLY_TYPE_OFFSCREEN} + * 45.{ARKUI_BLEND_MODE_DIFFERENCE,BLEND_APPLY_TYPE_FAST} + * 46.{ARKUI_BLEND_MODE_DIFFERENCE,BLEND_APPLY_TYPE_OFFSCREEN} + * 47.{ARKUI_BLEND_MODE_EXCLUSION,BLEND_APPLY_TYPE_FAST} + * 48.{ARKUI_BLEND_MODE_EXCLUSION,BLEND_APPLY_TYPE_OFFSCREEN} + * 49.{ARKUI_BLEND_MODE_MULTIPLY,BLEND_APPLY_TYPE_FAST} + * 50.{ARKUI_BLEND_MODE_MULTIPLY,BLEND_APPLY_TYPE_OFFSCREEN} + * 51.{ARKUI_BLEND_MODE_HUE,BLEND_APPLY_TYPE_FAST} + * 52.{ARKUI_BLEND_MODE_HUE,BLEND_APPLY_TYPE_OFFSCREEN} + * 53.{ARKUI_BLEND_MODE_SATURATION,BLEND_APPLY_TYPE_FAST} + * 54.{ARKUI_BLEND_MODE_SATURATION,BLEND_APPLY_TYPE_OFFSCREEN} + * 55.{ARKUI_BLEND_MODE_COLOR,BLEND_APPLY_TYPE_FAST} + * 56.{ARKUI_BLEND_MODE_COLOR,BLEND_APPLY_TYPE_OFFSCREEN} + * 57.{ARKUI_BLEND_MODE_LUMINOSITY,BLEND_APPLY_TYPE_FAST} + * 58.{ARKUI_BLEND_MODE_LUMINOSITY,BLEND_APPLY_TYPE_OFFSCREEN} + * 59.{ARKUI_BLEND_MODE_COLOR_BURN,BLEND_APPLY_TYPE_FAST} + * 60.{ARKUI_BLEND_MODE_COLOR_BURN,BLEND_APPLY_TYPE_OFFSCREEN} + * 共60种显示效果测试*/ + it('testCustomComponentBlendMode001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentBlendModeTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c581fc6db8edbc768d6bdbae3219a7c3a9c870c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderColorTest.test.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customBorderColorTest() {customBorderColorTest + describe('CustomComponentBorderColorTest', () => { + + let PAGE_TAG = 'CustomComponentBorderColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件borderColor参数分别设置为0xFF00FF00、(0xFF0000FF, 0xFF0000FF, 0xFF0000FF, 0xFF0000FF)时的显示效果测试 + it('testCustomComponentBorderColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderRadiusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderRadiusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9efa434a449a2cae74e015e8ed8951b97378c850 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderRadiusTest.test.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customBorderRadiusTest() {customBorderRadiusTest + describe('CustomComponentBorderRadiusTest', () => { + + let PAGE_TAG = 'CustomComponentBorderRadiusTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件borderRadius参数分别设置为5、(5,5,5,5)、25、(150,150,150,150)、-5、(-5,-5,-5,-5)时的显示效果测试 + it('testCustomComponentBorderRadius001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a1fca3465b6c14127193eccbd4bff88d5ed17ddb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderStyleTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customBorderStyleTest() {customBorderStyleTest + describe('CustomComponentBorderStyleTest', () => { + + let PAGE_TAG = 'CustomComponentBorderStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* Custom组件borderStyle参数分别设置为ARKUI_BORDER_STYLE_SOLID、ARKUI_BORDER_STYLE_DASHED、ARKUI_BORDER_STYLE_DOTTED、 + * (ARKUI_BORDER_STYLE_SOLID,ARKUI_BORDER_STYLE_SOLID,ARKUI_BORDER_STYLE_SOLID,ARKUI_BORDER_STYLE_SOLID)、 + * (ARKUI_BORDER_STYLE_DASHED,ARKUI_BORDER_STYLE_DASHED,ARKUI_BORDER_STYLE_DASHED,ARKUI_BORDER_STYLE_DASHED)、 + * (ARKUI_BORDER_STYLE_DOTTED,ARKUI_BORDER_STYLE_DOTTED,ARKUI_BORDER_STYLE_DOTTED,ARKUI_BORDER_STYLE_DOTTED)时的显示 + * 效果测试 + */ + it('testCustomComponentBorderStyle001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..de4a35988bd7149ad2d63f7551ec3a85164021e3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentBorderWidthTest.test.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customBorderWidthTest() {customBorderWidthTest + describe('CustomComponentBorderWidthTest', () => { + + let PAGE_TAG = 'CustomComponentBorderWidthTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件borderWidth参数分别设置为5、(5,5,5,5)、-5、(-5,-5,-5,-5)时的显示效果测试 + it('testCustomComponentBorderWidth001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentClipTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentClipTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..362dd41b53efe182af03e02f16474aa07121befb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentClipTest.test.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customClipTest() { + + describe('CustomComponentClipTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //矩形 + it('testCustomComponentClip001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentClipRectangleTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //圆形 + it('testCustomComponentClip002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentClipCircleTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //椭圆形 + it('testCustomComponentClip003', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentClipEllipseTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //路径 + it('testCustomComponentClip004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentClipPathTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentConstraintSizeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentConstraintSizeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6bc5d1c885389f714b05e2bf2350d6d2cd5ae39 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentConstraintSizeTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customConstraintSizeTest() { + + describe('CustomComponentConstraintSizeTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //最大值大于设定值大于最小值 + it('testCustomComponentConstraintSize001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentConstraintSizeMaxSetMinTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //最大值大于最小值大于设定值 + it('testCustomComponentConstraintSize002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentConstraintSizeMaxMinSetTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //设定值大于最大值大于最小值 + it('testCustomComponentConstraintSize003', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentConstraintSizeSetMaxMinTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //最小值大于设定值大于最大值 + it('testCustomComponentConstraintSize004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentConstraintSizeMinSetMaxTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //最小值大于最大值大于设定值 + it('testCustomComponentConstraintSize005', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentConstraintSizeMinMaxSetTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //设定值大于最小值大于最大值 + it('testCustomComponentConstraintSize006', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentConstraintSizeSetMinMaxTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentContrastTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentContrastTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..951882e15b4b9fc80c36a658137905c4ad2e7ce8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentContrastTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customContrastTest() { + + describe('CustomComponentContrastTest', () => { + + let PAGE_TAG = 'CustomComponentContrastTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Custom组件contrast参数设置为0时的显示效果测试 + * Custom组件contrast参数设置为1时的显示效果测试 + * Custom组件contrast参数设置为5时的显示效果测试 + * Custom组件contrast参数设置为10时的显示效果测试 + * Custom组件contrast参数设置为-1时的显示效果测试 + * Custom组件contrast参数设置为11时的显示效果测试 + */ + it('testCustomComponentContrast001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentDirectionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentDirectionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecab2426ae29098e15d54b3bd42661f15e028b02 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentDirectionTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customDirectionTest() { + + describe('CustomComponentDirectionTest', () => { + + let PAGE_TAG = 'CustomComponentDirectionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + * Custom组件调用capi设置direction为 + * ARKUI_DIRECTION_LTR + * ARKUI_DIRECTION_RTL + * ARKUI_DIRECTION_AUTO + * 默认值 + * 枚举异常值(500) + * 的显示效果测试 + */ + it('testCustomComponentDirection001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentEnabledTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentEnabledTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c44bc0bc6af8efa07aa271f54546caea0b8061b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentEnabledTest.test.ets @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customEnabledTest() { + + describe('CustomComponentEnabledTest', () => { + + let PAGE_TAG = 'CustomComponentEnabledTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Custom组件调用capi设置enabled为true,点击事件、焦点事件正常触发的场景 + it('testCustomComponentEnabled001', 0, async (done: Function) => { + await Utils.clickComponent('EnabledTestCustomComponent') + await Utils.sleep(2000) + + focusControl.requestFocus('EnabledTestCustomComponent') + await Utils.sleep(2000) + focusControl.requestFocus('EnabledTestCustomComponentCompare') + await Utils.sleep(2000) + + focusControl.requestFocus('EnabledTestCustomComponentCompareBlur') + await Utils.sleep(2000) + focusControl.requestFocus('EnabledTestCustomComponentCompare') + await Utils.sleep(2000) + + done() + }) + + //Custom组件调用capi设置enabled为false,点击事件、焦点事件无法触发的场景 + it('testCustomComponentEnabled002', 0, async (done: Function) => { + await Utils.clickComponent('EnabledTestCustomComponentDisable') + await Utils.sleep(2000) + + focusControl.requestFocus('EnabledTestCustomComponent') + await Utils.sleep(2000) + focusControl.requestFocus('EnabledTestCustomComponentDisable') + await Utils.sleep(2000) + + focusControl.requestFocus('EnabledTestCustomComponent') + await Utils.sleep(2000) + + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFlexBasisTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFlexBasisTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..788f099442d9b586c9c1abb33ddaee95874975fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFlexBasisTest.test.ets @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customFlexBasisTest() { + + describe('CustomComponentFlexBasisTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Custom组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCustomComponentFlexBasis001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexBasisFlexRowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Custom组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCustomComponentFlexBasis002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexBasisFlexColumnTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + await Utils.sleep(1000); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Custom组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCustomComponentFlexBasis003', 0, async (done: Function) => { + await Utils.sleep(1000); + let PAGE_TAG = 'CustomComponentFlexBasisFlexRowReverseTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Custom组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCustomComponentFlexBasis004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexBasisFlexColumnReverseTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Row时,Custom组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCustomComponentFlexBasis005', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexBasisRowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Column时,Custom组件设置flexbasis属性值为200vp时的显示效果测试 + it('testCustomComponentFlexBasis006', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexBasisColumnTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFlexGrowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFlexGrowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..963657928ba62197df6980425f92181c6f1bb2a7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFlexGrowTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customFlexGrowTest() { + + describe('CustomComponentFlexGrowTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Custom组件设置flexgrow属性值为3时的显示效果测试 + it('testCustomComponentFlexGrow001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexGrowFlexRowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Custom组件设置flexgrow属性值为3时的显示效果测试 + it('testCustomComponentFlexGrow002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexGrowFlexColumnTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Custom组件设置flexgrow属性值为3时的显示效果测试 + it('testCustomComponentFlexGrow003', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexGrowFlexRowReverseTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Custom组件设置flexgrow属性值为3时的显示效果测试 + it('testCustomComponentFlexGrow004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexGrowFlexColumnReverseTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Row时,Custom组件设置flexgrow属性值为3时的显示效果测试 + it('testCustomComponentFlexGrow005', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexGrowRowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Column时,Custom组件设置flexgrow属性值为3时的显示效果测试 + it('testCustomComponentFlexGrow006', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexGrowColumnTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFlexShrinkTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFlexShrinkTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..37b17ec3a1c34ef6e9a7f807f471ed921f35eab6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFlexShrinkTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customFlexShrinkTest() { + + describe('CustomComponentFlexShrinkTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW时,Custom组件设置flexshrink属性值为3时的显示效果测试 + it('testCustomComponentFlexShrink001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexShrinkFlexRowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN时,Custom组件设置flexshrink属性值为3时的显示效果测试 + it('testCustomComponentFlexShrink002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexShrinkFlexColumnTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_ROW_REVERSE时,Custom组件设置flexshrink属性值为3时的显示效果测试 + it('testCustomComponentFlexShrink003', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexShrinkFlexRowReverseTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Flex且主轴方向为ARKUI_FLEX_DIRECTION_COLUMN_REVERSE时,Custom组件设置flexshrink属性值为3时的显示效果测试 + it('testCustomComponentFlexShrink004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexShrinkFlexColumnReverseTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Row时,Custom组件设置flexshrink属性值为3时的显示效果测试 + it('testCustomComponentFlexShrink005', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexShrinkRowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + + // 当父容器为Column时,Custom组件设置flexshrink属性值为3时的显示效果测试 + it('testCustomComponentFlexShrink006', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentFlexShrinkColumnTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFocusableTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFocusableTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a34338364c7f91b02f34562504e4759828dc7149 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentFocusableTest.test.ets @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customFocusableTest() { + + describe('CustomComponentFocusableTest', () => { + + let PAGE_TAG = 'CustomComponentFocusableTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Custom组件调用capi设置focusable为true,通用事件onFocus正常触发的场景 + it('testCustomComponentFocusable001', 0, async (done: Function) => { + focusControl.requestFocus('FocusableTestCustomComponentCompare') + await Utils.sleep(2000) + focusControl.requestFocus('FocusableTestCustomComponent') + await Utils.sleep(2000) + + done() + }) + + //Custom组件调用capi设置focusable为false,通用事件onFocus无法触发的场景 + it('testCustomComponentFocusable002', 0, async (done: Function) => { + focusControl.requestFocus('FocusableTestCustomComponent') + await Utils.sleep(2000) + focusControl.requestFocus('FocusableTestCustomComponentDisable') + await Utils.sleep(2000) + + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentForegroundBlurStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentForegroundBlurStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2de7a6aa18186270f386b2188389cf2411b80521 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentForegroundBlurStyleTest.test.ets @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customComponentForegroundBlurStyleTest() { + + describe('CustomComponentForegroundBlurStyleTest', () => { + + let PAGE_TAG = 'CustomComponentForegroundBlurStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /** + Custom组件参数设置foregroundBlurStyle + value[0] = ARKUI_BLUR_STYLE_THIN; + value[0] = ARKUI_BLUR_STYLE_REGULAR; + value[0] = ARKUI_BLUR_STYLE_THICK; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_THIN; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_REGULAR; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_THICK; + value[0] = ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK; + value[0] = ARKUI_BLUR_STYLE_NONE; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_THIN; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_REGULAR; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_THICK; + value[0] = ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK; + value[0] = 500; + value[1] = ARKUI_COLOR_MODE_SYSTEM; + value[1] = ARKUI_COLOR_MODE_LIGHT; + value[1] = ARKUI_COLOR_MODE_DARK; + value[1] = 500; + value[2] = ARKUI_ADAPTIVE_COLOR_DEFAULT; + value[2] = ARKUI_ADAPTIVE_COLOR_AVERAGE; + value[2] = 500; + value[4] = -1; + value[4] = 0; + value[4] = 20; + value[4] = 127; + value[4] = 200; + value[5] = -1; + value[5] = 0; + value[5] = 20; + value[5] = 127; + value[5] = 200; + {{.i32 = ARKUI_BLUR_STYLE_THIN}, + {.i32 = ARKUI_COLOR_MODE_SYSTEM}, + {.i32 = ARKUI_ADAPTIVE_COLOR_AVERAGE}, + {.f32 = 0.5}, + {.f32 = 20}, + {.f32 = 20}} + 时的显示效果测试 + */ + it('testCustomComponentForegroundBlurStyle001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentGrayscaleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentGrayscaleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0cffc189e73b346b8715e6e6e651d1ad63e870b9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentGrayscaleTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customGrayscaleTest() { + + describe('CustomComponentGrayscaleTest', () => { + + let PAGE_TAG = 'CustomComponentGrayscaleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Custom组件grayscale参数设置为0时的显示效果测试 + * Custom组件grayscale参数设置为0.5时的显示效果测试 + * Custom组件grayscale参数设置为0.8时的显示效果测试 + * Custom组件grayscale参数设置为1.0时的显示效果测试 + * Custom组件grayscale参数设置为-1.0时的显示效果测试 + * Custom组件grayscale参数设置为2.0时的显示效果测试 + */ + it('testCustomComponentGrayscale001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f417bf6953a08a2bf157b3fe0d59cb45ac4a996c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentHeightTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customHeightTest() { + + describe('CustomComponentHeightTest', () => { + + let PAGE_TAG = 'CustomComponentHeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件height参数分别设置为50、-100、10000时的显示效果测试 + it('testCustomComponentHeight001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentHitTestBehaviorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentHitTestBehaviorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..57feebb0dae865aab1a24fd7bf6d3b9d3b0ca598 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentHitTestBehaviorTest.test.ets @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customHitTestBehaviorTest() { + + describe('CustomComponentHitTestBehaviorTest', () => { + + let PAGE_TAG = 'CustomComponentHitTestBehaviorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Custom组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_DEFAULT时的显示效果测试 + * Custom组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_BLOCK时的显示效果测试 + * Custom组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_TRANSPARENT时的显示效果测试 + * Custom组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_NONE时的显示效果测试 + * Custom组件hitTestBehavior参数设置为-1时的显示效果测试 + * Custom组件hitTestBehavior参数设置为4时的显示效果测试 + */ + it('testCustomComponentHitTestBehavior001', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTestStackDefault') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackBlock') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackTransparent') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackNone') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackExceptBelow') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackExceptAbove') + await Utils.sleep(2000) + + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentIdTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentIdTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ceac76e2279374326f2280a57fd426bfb9497858 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentIdTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customIdTest() { + + describe('CustomComponentIdTest', () => { + + let PAGE_TAG = 'CustomComponentIdTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Custom组件Id参数设置为CustomRed时的显示效果测试 + * Custom组件Id参数设置为CustomGreen时的显示效果测试 + */ + it('testCustomComponentId001', 0, async (done: Function) => { + await Utils.clickComponent('onTouchFirst') + await Utils.sleep(1000) + await Utils.clickComponent('onTouchSecond') + await Utils.sleep(1000) + + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentInvertTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentInvertTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..95f0452224be8546c468508d8fbb03ac35d8158e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentInvertTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customInvertTest() { + + describe('CustomComponentInvertTest', () => { + + let PAGE_TAG = 'CustomComponentInvertTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Custom组件invert参数设置为0时的显示效果测试 + * Custom组件invert参数设置为0.5时的显示效果测试 + * Custom组件invert参数设置为0.8时的显示效果测试 + * Custom组件invert参数设置为1时的显示效果测试 + * Custom组件invert参数设置为-1时的显示效果测试 + * Custom组件invert参数设置为2时的显示效果测试 + */ + it('testCustomComponentInvert001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentLinearGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentLinearGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..35eefc4fc1bc1d9594cc41e5b5342ada7a49575f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentLinearGradientTest.test.ets @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customLinearGradientTest() { + + describe('CustomComponentLinearGradientTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //向左渐变 + it('testCustomComponentLinearGradient001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientLeftTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //向上渐变 + it('testCustomComponentLinearGradient002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientTopTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //向右渐变 + it('testCustomComponentLinearGradient003', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientRightTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //向下渐变 + it('testCustomComponentLinearGradient004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientBottomTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //向左上渐变 + it('testCustomComponentLinearGradient005', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientLeftTopTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //向左下渐变 + it('testCustomComponentLinearGradient006', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientLeftBottomTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //向右上渐变 + it('testCustomComponentLinearGradient007', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientRightTopTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //向右下渐变 + it('testCustomComponentLinearGradient008', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientRightBottomTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //不渐变 + it('testCustomComponentLinearGradient009', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientNoneTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //自定义渐变方向 + it('testCustomComponentLinearGradient010', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientCustomTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testCustomComponentLinearGradient011', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientLowerBoundAbnormalTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //非法颜色 + it('testCustomComponentLinearGradient012', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentLinearGradientIllegalColorAbnormalTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentMarginTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentMarginTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..02bf24bbf8b0a519cad5cfd22b68148d3974d9bf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentMarginTest.test.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customMarginTest() { + + describe('CustomComponentMarginTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //统一设置 + it('testCustomComponentMargin001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentMarginUnifiedTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //分别设置 + it('testCustomComponentMargin002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentMarginRespectivelyTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //统一设置负数 + it('testCustomComponentMargin003', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentMarginUnifiedNegativeTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //分别设置负数 + it('testCustomComponentMargin004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentMarginRespectivelyNegativeTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentMaskTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentMaskTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1e45d86d7c1f833fe03a3da0caec942c32c640ab --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentMaskTest.test.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customMaskTest() { + + describe('CustomComponentMaskTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* Custom组件mask参数为 + * 1. + * 0xFFFF0000, 0xFF000000, 2, ARKUI_MASK_TYPE_RECTANGLE, 100, 100, 10, 10 + * 2. + * 0xFFFF0000, 0xFF000000, 5, ARKUI_MASK_TYPE_CIRCLE, 100, 100 + * 3. + * 0xFFFF3333, 0xFF000000, 10, ARKUI_MASK_TYPE_ELLIPSE, 100, 50 + * 4. + * 0xFFFF3333, 0xFF000000, 10, ARKUI_MASK_TYPE_PATH, 50, 50 + * 5. + * ARKUI_MASK_TYPE_PROGRESS, 50, 100, 0xFF00FF00 + * 的正常显示效果测试*/ + it('testCustomComponentMask001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentMaskTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done(); + }) + + /* Custom组件mask参数为 + * 1. + * 0xFFFF3333, 0xFF000000, -10, ARKUI_MASK_TYPE_RECTANGLE, -100, -100, -10, -10 + * 2. + * 0xFFFF3333, + * 0xFF000000, -10, ARKUI_MASK_TYPE_CIRCLE, -100, -100 + * 3. + * 0xFFFF3333, 0xFF000000, -10, ARKUI_MASK_TYPE_ELLIPSE, -100, -50 + * 4. + * 0xFFFF3333, 0xFF000000, -10, ARKUI_MASK_TYPE_PATH, -100, -100 + * 5. + * ARKUI_MASK_TYPE_PROGRESS, -50, 100, 0xFF00FF00 + * 的异常显示效果测试*/ + it('testCustomComponentMask002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentMaskAbnormalTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done(); + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnAppearTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnAppearTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ef6c658ed438792ccda5db2b192a5aad47d98bcb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnAppearTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customEventOnAppearTest() { + + describe('CustomComponentOnAppearTest', () => { + + let PAGE_TAG = 'CustomComponentOnAppearTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Custom调用capi设置通用事件onAppear正常触发的场景 + it('testCustomComponentOnAppear001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnAreaChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnAreaChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a0743d77fa329fce2a33e0c94696edb4dd179a6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnAreaChangeTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customEventOnAreaChangeTest() { + + describe('CustomComponentOnAreaChangeTest', () => { + + let PAGE_TAG = 'CustomComponentOnAreaChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Custom组件调用capi设置通用事件onAreaChange,当修改组件大小时正常触发的场景 + it('testCustomComponentOnAreaChange001', 0, async (done: Function) => { + await Utils.clickComponent('OnAreaChangeTestCustomComponentSize') + await Utils.sleep(2000) + done() + }) + + //Custom组件调用capi设置通用事件onAreaChange,当组件位置发生变化时正常触发的场景 + it('testCustomComponentOnAreaChange002', 0, async (done: Function) => { + await Utils.clickComponent('OnAreaChangeTestCustomComponentMoveCompare') + await Utils.sleep(2000) + done() + }) + + //Custom组件调用capi设置通用事件onAreaChange,当组件设置offset时不会触发的场景 + it('testCustomComponentOnAreaChange003', 0, async (done: Function) => { + await Utils.clickComponent('OnAreaChangeTestCustomComponentOffset') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnBlurTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnBlurTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b411951e53300d70b3aabe901ac475a07e97b806 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnBlurTest.test.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customEventOnBlurTest() { + + describe('CustomComponentOnBlurTest', () => { + + let PAGE_TAG = 'CustomComponentOnBlurTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Custom组件调用capi设置enabled为true,通用事件onBlur正常触发的场景 + it('testCustomComponentOnBlur001', 0, async (done: Function) => { + focusControl.requestFocus('OnBlurTestCustomComponentCompare') + await Utils.sleep(2000) + focusControl.requestFocus('OnBlurTestCustomComponent') + await Utils.sleep(2000) + done() + }) + + + //Custom组件调用capi设置enabled为false,通用事件onBlur无法触发的场景 + it('testCustomComponentOnBlur002', 0, async (done: Function) => { + focusControl.requestFocus('OnBlurTestCustomComponentDisable') + await Utils.sleep(2000) + focusControl.requestFocus('OnBlurTestCustomComponent') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnClickTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnClickTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..95f42232f7cfbb29cde8c313683e699fe409140c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnClickTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customEventOnClickTest() { + + describe('CustomComponentOnClickTest', () => { + + let PAGE_TAG = 'CustomComponentOnClickTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Custom组件调用capi设置enabled为true,通用事件onClick正常触发的场景 + it('testCustomComponentOnClick001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickTestCustomComponent') + await Utils.sleep(2000) + done() + }) + + //Custom组件调用capi设置enabled为false,通用事件onClick无法触发的场景 + it('testCustomComponentOnClick002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickTestCustomComponentDisable') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnDrawTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnDrawTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..085051e5ebc68e8419fbe8d8b33b6c50ff2df837 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnDrawTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customComponentOnDrawTest() { + + describe('CustomComponentOnDrawTest', () => { + + let PAGE_TAG = 'CustomComponentOnDrawTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 自定义组件可以在onDraw回调中绘制自定义图形的显示效果测试 + it('testCustomComponentOnDraw001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnFocusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnFocusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd04bd501a0c72fe984cb383ca8e9d445077f7a0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnFocusTest.test.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customEventOnFocusTest() { + + describe('CustomComponentOnFocusTest', () => { + + let PAGE_TAG = 'CustomComponentOnFocusTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Custom组件调用capi设置enabled为true,通用事件onFocus正常触发的场景 + it('testCustomComponentOnFocus001', 0, async (done: Function) => { + focusControl.requestFocus('OnFocusTestCustomComponentCompare') + await Utils.sleep(2000) + focusControl.requestFocus('OnFocusTestCustomComponent') + await Utils.sleep(2000) + done() + }) + + //Custom组件调用capi设置enabled为false,通用事件onFocus无法触发的场景 + it('testCustomComponentOnFocus002', 0, async (done: Function) => { + focusControl.requestFocus('OnFocusTestCustomComponent') + await Utils.sleep(2000) + focusControl.requestFocus('OnFocusTestCustomComponentDisable') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnLayoutTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnLayoutTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3596890b962376ab54d5cf30d667361ddf0fa38 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnLayoutTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customComponentOnLayoutTest() { + + describe('CustomComponentOnLayoutTest', () => { + + let PAGE_TAG = 'CustomComponentOnLayoutTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 自定义组件可以在onLayout回调中设置子组件布局位置的显示效果测试 + it('testCustomComponentOnLayout001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnMeasureTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnMeasureTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..26ff1cb1c6921281833b30b77ba39631e86a36b2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnMeasureTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customComponentOnMeasureTest() { + + describe('CustomComponentOnMeasureTest', () => { + + let PAGE_TAG = 'CustomComponentOnMeasureTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 自定义组件可以在onMeasure回调中设置自身尺寸的显示效果测试 + it('testCustomComponentOnMeasure001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnTouchTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnTouchTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..92d0d49ee95fda94e8abf1bdfb1ffcb507da1a97 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOnTouchTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customEventOnTouchTest() { + + describe('CustomComponentOnTouchTest', () => { + + let PAGE_TAG = 'CustomComponentOnTouchTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Custom组件调用capi设置enabled为true,通用事件onTouch正常触发的场景 + it('testCustomComponentOnTouch001', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTest') + await Utils.sleep(2000) + done() + }) + + //Custom组件调用capi设置enabled为false,通用事件onTouch无法触发的场景 + it('testCustomComponentOnTouch002', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTestDisable') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOpacityTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOpacityTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e586e582d980f17d67e0c2baa751d857d6281a27 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentOpacityTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customOpacityTest() { + + describe('CustomComponentOpacityTest', () => { + + let PAGE_TAG = 'CustomComponentOpacityTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Custom组件opacity参数设置为0时的显示效果测试 + * Custom组件opacity参数设置为0.5时的显示效果测试 + * Custom组件opacity参数设置为0.8时的显示效果测试 + * Custom组件opacity参数设置为1时的显示效果测试 + * Custom组件opacity参数设置为-1时的显示效果测试 + * Custom组件opacity参数设置为2时的显示效果测试 + */ + it('testCustomComponentOpacity001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentPositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentPositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c87c75f8b4720cd734d2a860c64b1e5ea7d682df --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentPositionTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customPositionTest() { + + describe('CustomComponentPositionTest', () => { + + let PAGE_TAG = 'CustomComponentPositionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件position参数分别设置为{50,50},{-50,-50}时的显示效果测试 + it('testCustomComponentPosition001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentRadialGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentRadialGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d5616e708be2845ae34ec7053154c8fb2117cde --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentRadialGradientTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customRadialGradientTest() { + + describe('CustomComponentRadialGradientTest', () => { + + let PAGE_TAG = 'CustomComponentRadialGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Custom组件参数设置radialGradient {.value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF,0xFF000000} stops:{0.2,0.5, 1}size:3} + * {.value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * .value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:0 colors:{1234, 1234} stops:{0.3, 1}size:2} + * {.value[0].f32:-25 .value[1].f32:-25 .value[2].f32:-25 .value[3].i32:-1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2}时的显示效果测试 + */ + it('testCustomComponentRadialGradient001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentScaleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentScaleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..85923720dfeeb5af7b5bdf9a0d5a954cc84cdcc2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentScaleTest.test.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customScaleTest() { + + describe('CustomComponentScaleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //X轴Y轴同时缩小 + it('testCustomComponentScale001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentScaleReduceXYTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //单独缩小X轴 + it('testCustomComponentScale002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentScaleReduceXTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //X轴Y轴同时放大 + it('testCustomComponentScale003', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentScaleEnlargeXYTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //单独放大X轴 + it('testCustomComponentScale004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentScaleEnlargeXTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //下界异常场景 + it('testCustomComponentScale005', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentScaleAbnormalTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentSepiaTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentSepiaTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..60ac8f293cc1b73738a4be895b230dce2d197565 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentSepiaTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customSepiaTest() { + + describe('CustomComponentSepiaTest', () => { + + let PAGE_TAG = 'CustomComponentSepiaTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Custom组件sepia参数设置为0时的显示效果测试 + * Custom组件sepia参数设置为0.5时的显示效果测试 + * Custom组件sepia参数设置为0.8时的显示效果测试 + * Custom组件sepia参数设置为1时的显示效果测试 + * Custom组件sepia参数设置为-1时的显示效果测试 + * Custom组件sepia参数设置为2时的显示效果测试 + */ + it('testCustomComponentSepia001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentShadowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentShadowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..902a615949dff8cbab0a7b56ca31f7c607d51971 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentShadowTest.test.ets @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customShadowTest() { + + describe('CustomComponentShadowTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //超小阴影 + it('testCustomComponentShadow001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentShadowUltraSmallShadowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //小阴影 + it('testCustomComponentShadow002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentShadowSmallShadowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //中阴影 + it('testCustomComponentShadow003', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentShadowMiddleShadowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //大阴影 + it('testCustomComponentShadow004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentShadowLargeShadowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //浮动中阴影 + it('testCustomComponentShadow005', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentShadowFloatingShadowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //浮动小阴影 + it('testCustomComponentShadow006', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentShadowFloatingSmallShadowTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testCustomComponentShadow007', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentShadowLowerBoundAbnormalTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testCustomComponentShadow008', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentShadowUpperBoundAbnormalTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentSweepGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentSweepGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..363c76abf27589874049f90c9dcbc48f981d8c9f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentSweepGradientTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customSweepGradientTest() { + + describe('CustomComponentSweepGradientTest', () => { + + let PAGE_TAG = 'CustomComponentSweepGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * custom组件参数设置sweepGradient {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF, 0xFF000000} stops:{0.2, 0.5, 1}size:3} + * {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:0 colors:{1234, 1234} stops:{0.3, 1}size:2} + * {.value[0].f32:-50 .value[1].f32:-50 .value[2].f32:-1 .value[3].f32:-180 .value[4].f32:-90 .value[5].i32:-1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2}时的显示效果测试\ + */ + it('testCustomComponentSweepGradient001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentTransformTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentTransformTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..02c084641536d3a1d5240229a4a8fbd9a366478b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentTransformTest.test.ets @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customTransformTest() { + + describe('CustomComponentTransformTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* custom组件transform参数为 + * 1. + * [1, 0, 0, 0] + * [0, 1, 0, 0] + * [0, 0, 1, 0] + * [0, -20 ,0 ,1] + * 2. + * [static_cast(cos(30)), static_cast(-sin(30)), 0, 0] + * [static_cast(sin(30)), static_cast(cos(30)), 0, 0] + * [0, 0, 1, 0] + * [0, 0, 0, 1] + * 3. + * [0.5, 0, 0, 0] + * [0, 0.5, 0, 0] + * [0, 0, 0.5, 0] + * [0, 0, 0, 1] + * 的正常显示效果测试*/ + it('testCustomComponentTransform001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentTransformTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done(); + }) + + /* custom组件transform参数为 + * 1. + * [1, 0, 0, 0] + * [0, 1, 0, 0] + * [0, 0, 1, 0] + * [0, -20] + * 2. + * [0, 1, 0, 0] + * [0, 0, 1, 0] + * [0, 0, 0, 1] + * [0, 0, 0, 0] + * 3. + * [] + * 的异常显示效果测试*/ + it('testCustomComponentTransform002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomComponentTransformAbnormalTest'; + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + done(); + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d19213c47a1bb2b0a508a3f1a90e1a72e381848 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customcomponent/CustomComponentWidthTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customWidthTest() { + + describe('CustomComponentWidthTest', () => { + + let PAGE_TAG = 'CustomComponentWidthTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Custom组件width参数分别设置为300、10000、-100时的显示效果测试 + it('testCustomComponentWidth001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogAlignmentTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogAlignmentTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1d7fd518e10c079ba9395ff4356e77e5cc2609f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogAlignmentTest.test.ets @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customDialogAlignmentTest() { + + describe('CustomDialogAlignmentTest', () => { + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // CustomDialog组件调用alignment方法的显示效果测试 + it('testCustomDialogAlignment001', 0, async (done: Function) => { + let PAGE_TAG = 'CustomDialogAlignmentTopStartTest'; + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + done() + }) + + // CustomDialog组件调用alignment方法的显示效果测试 + it('testCustomDialogAlignment002', 0, async (done: Function) => { + let PAGE_TAG = 'CustomDialogAlignmentTopTest'; + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + done() + }) + + // CustomDialog组件调用alignment方法的显示效果测试 + it('testCustomDialogAlignment003', 0, async (done: Function) => { + let PAGE_TAG = 'CustomDialogAlignmentTopEndTest'; + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + done() + }) + + // CustomDialog组件调用alignment方法的显示效果测试 + it('testCustomDialogAlignment004', 0, async (done: Function) => { + let PAGE_TAG = 'CustomDialogAlignmentStartTest'; + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + done() + }) + + // CustomDialog组件调用alignment方法的显示效果测试 + it('testCustomDialogAlignment005', 0, async (done: Function) => { + let PAGE_TAG = 'CustomDialogAlignmentCenterTest'; + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + done() + }) + + // CustomDialog组件调用alignment方法的显示效果测试 + it('testCustomDialogAlignment006', 0, async (done: Function) => { + let PAGE_TAG = 'CustomDialogAlignmentEndTest'; + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + done() + }) + + // CustomDialog组件调用alignment方法的显示效果测试 + it('testCustomDialogAlignment007', 0, async (done: Function) => { + let PAGE_TAG = 'CustomDialogAlignmentBottomStartTest'; + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + done() + }) + + // CustomDialog组件调用alignment方法的显示效果测试 + it('testCustomDialogAlignment008', 0, async (done: Function) => { + let PAGE_TAG = 'CustomDialogAlignmentBottomTest'; + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + done() + }) + + // CustomDialog组件调用alignment方法的显示效果测试 + it('testCustomDialogAlignment009', 0, async (done: Function) => { + let PAGE_TAG = 'CustomDialogAlignmentBottomEndTest'; + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + done() + }) + + // CustomDialog组件调用Alignment方法异常参数的显示效果测试 + it('testCustomDialogAlignment010', 0, async (done: Function) => { + let PAGE_TAG = 'CustomDialogAlignmentAbnormalTest'; + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogCloseTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogCloseTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1eb794541157ff08660ccf293f4b49e35908b274 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogCloseTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customDialogCloseTest() { + + describe('CustomDialogCloseTest', () => { + + let PAGE_TAG = 'CustomDialogCloseTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // CustomDialog组件调用close方法的显示效果测试 + it('testCustomDialogClose001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogCustomStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogCustomStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..88bcd9dc5c8105076a7bd59e4cec18ecb8e072b6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogCustomStyleTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customDialogCustomStyleTest() { + + describe('CustomDialogCustomStyleTest', () => { + + let PAGE_TAG = 'CustomDialogCustomStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // CustomDialog组件调用customStyle方法参数为true false时的显示效果测试 + it('testCustomDialogCustomStyle001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogMaskColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogMaskColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b974d1a9bdaee1d8d75ca8422fcb29f5d5164928 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogMaskColorTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customDialogMaskColorTest() { + + describe('CustomDialogMaskColorTest', () => { + + let PAGE_TAG = 'CustomDialogMaskColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // CustomDialog组件调用setMask方法设置maskColor为红色时的显示效果测试 + it('testCustomDialogMaskColor001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogOpenTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogOpenTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4e16e474e07ca61a1529d2d5f33b9324429d928 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/customdialog/CustomDialogOpenTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function customDialogOpenTest() { + + describe('CustomDialogOpenTest', () => { + + let PAGE_TAG = 'CustomDialogOpenTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`customdialog/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // CustomDialog组件调用open方法的显示效果测试 + it('testCustomDialogOpen001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerDisappearTextStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerDisappearTextStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2aea82112fcb23e88f615fc87b28ea125b6e1b46 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerDisappearTextStyleTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerDisappearTextStyleTest() { + + describe('DatePickerDisappearTextStyleTest', () => { + + let PAGE_TAG = 'DatePickerDisappearTextStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`datepicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件参数设置disappearTextStyle "#ff007dff;30;bold;Arial,HarmonyOS Sans;normal""abnormal"时的显示效果测试 + it('testDatePickerDisappearTextStyle001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerEnabledTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerEnabledTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c249363371b319cbe16a7150084e5a5300e29fa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerEnabledTest.test.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { beforeAll, afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerEnabledTest() { + + describe('DatePickerEnabledTest', () => { + + let PAGE_TAG = 'DatePickerEnabledTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`datepicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //DatePicker组件enabled参数设置为1时的显示效果测试 + it('testDatePickerEnabled001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickEnabledDatePicker') + await Utils.sleep(1000) + + await Utils.clickComponent('TextClick') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurEnabledDatePicker') + await Utils.sleep(1000) + + focusControl.requestFocus('EnabledDatePicker') + await Utils.sleep(1000) + + done(); + }) + + //DatePicker组件enabled参数设置为0时的显示效果测试 + it('testDatePickerEnabled002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickDisabledDatePicker') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurDisabledDatePicker') + await Utils.sleep(1000) + + focusControl.requestFocus('DisabledDatePicker') + await Utils.sleep(1000) + + done(); + }) + + //DatePicker组件enabled参数设置为-1时的显示效果测试 + it('testDatePickerEnabled003', 0, async (done: Function) => { + await Utils.clickComponent('OnClickAbnormalDatePicker') + await Utils.sleep(1000) + + await Utils.clickComponent('TextClick') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurAbnormalDatePicker') + await Utils.sleep(1000) + + focusControl.requestFocus('AbnormalDatePicker') + await Utils.sleep(1000) + + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerEndTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerEndTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e021885b0caa307b3135b646e8d2b4c0d9a568f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerEndTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerEndTest() { + + describe('DatePickerEndTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件参数设置end "2025-2-2"时的显示效果测试 + it('testDatePickerEnd001', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerEndTest'; + await Utils.pushPage(`datepicker/${PAGE_TAG}`); + done() + }) + + // DatePicker组件参数设置end "1111-1-1" "9999-1-1"时的显示效果测试 + it('testDatePickerEnd002', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerEndAbnormalTest'; + await Utils.pushPage(`datepicker/${PAGE_TAG}`); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerLunarTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerLunarTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a1aea81531bd70525da464c8080ba5ab8ca7c84 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerLunarTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerLunarTest() { + + describe('DatePickerLunarTest', () => { + + let PAGE_TAG = 'DatePickerLunarTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`datepicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件参数设置lunar true,false,-1时的显示效果测试 + it('testDatePickerLunar001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerOnDateChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerOnDateChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..11dd36ee255ff5abf1b6a44fe23a4ec6788fe038 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerOnDateChangeTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerOnDateChangeTest() { + + describe('DatePickerOnDateChangeTest', () => { + + let PAGE_TAG = 'DatePickerOnDateChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`datepicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件调用capi,onDateChange是否触发的场景 + it('testDatePickerOnDateChange001', 0, async (done: Function) => { + await Utils.flingComponent('datePickerOnDateChangeTest', false, true); + await Utils.sleep(2000) + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerSelectedTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerSelectedTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d16f650f52c33a3ab8788687bef4aad16041aa92 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerSelectedTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerSelectedTest() { + + describe('DatePickerSelectedTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件参数设置selected "2024-5-1",""时的显示效果测试 + it('testDatePickerSelected001', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerSelectedTest'; + await Utils.pushPage(`datepicker/${PAGE_TAG}`); + done() + }) + + // DatePicker组件参数设置selected "1111-1-1" "9999-1-1"时的显示效果测试 + it('testDatePickerSelected002', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerSelectedAbnormalTest'; + await Utils.pushPage(`datepicker/${PAGE_TAG}`); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerSelectedTextStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerSelectedTextStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d7a0b30960e548233e1118dbb3c331976fbda2a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerSelectedTextStyleTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerSelectedTextStyleTest() { + + describe('DatePickerSelectedTextStyleTest', () => { + + let PAGE_TAG = 'DatePickerSelectedTextStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`datepicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件参数设置selectedTextStyle "#ff182431;50;normal;Arial,HarmonyOS Sans;normal""abnormal"时的显示效果测试 + it('testDatePickerSelectedTextStyle001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerStartTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerStartTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e6127d0ca8102dd1a7c623eb68150cd7e9cf568 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerStartTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerStartTest() { + + describe('DatePickerStartTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件参数设置start "2024-1-1"时的显示效果测试 + it('testDatePickerStart001', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerStartTest'; + await Utils.pushPage(`datepicker/${PAGE_TAG}`); + done() + }) + + // DatePicker组件参数设置start "1111-1-1" "9999-1-1"时的显示效果测试 + it('testDatePickerStart002', 0, async (done: Function) => { + let PAGE_TAG = 'DatePickerStartAbnormalTest'; + await Utils.pushPage(`datepicker/${PAGE_TAG}`); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerTextStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerTextStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d3fd3f04c1e73900b248aaaaa875d495cdaa722f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerTextStyleTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerTextStyleTest() { + + describe('DatePickerTextStyleTest', () => { + + let PAGE_TAG = 'DatePickerTextStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`datepicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件参数设置textStyle "#ff007dff;30;normal;Arial,HarmonyOS Sans;normal""abnormal""时的显示效果测试 + it('testDatePickerTextStyle001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e8b479fdaa1f152323e6637176816d9e78c3adf2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/datepicker/DatePickerWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function datePickerWidthTest() { + + describe('DatePickerWidthTest', () => { + + let PAGE_TAG = 'DatePickerWidthTest'; + let PAGE_TAG_LARGE = 'DatePickerWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //DatePicker组件width参数分别设置为300、-100时的显示效果测试 + it('testDatePickerWidth001', 0, async (done: Function) => { + await Utils.pushPage(`datepicker/${PAGE_TAG}`, done); + }) + + //DatePicker组件width参数设置为500,超出父控件时的显示效果测试 + it('testDatePickerWidth002', 0, async (done: Function) => { + await Utils.pushPage(`datepicker/${PAGE_TAG_LARGE}`, done); + }); + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/flex/FlexHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/flex/FlexHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecc1d5e18674a8f1be0d9d1cc440bce6e88b2a18 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/flex/FlexHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function flexHeightTest() { + + describe('FlexHeightTest', () => { + + let PAGE_TAG = 'FlexHeightTest'; + let PAGE_TAG_LARGE = 'FlexHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Flex组件height参数分别设置为200、-50时的显示效果测试 + it('testFlexHeight001', 0, async (done: Function) => { + await Utils.pushPage(`flex/${PAGE_TAG}`, done); + }) + + //Flex组件height参数设置为500,超出父控件时的显示效果测试 + it('testFlexHeight002', 0, async (done: Function) => { + await Utils.pushPage(`flex/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/flex/FlexWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/flex/FlexWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..41eed2dcf11c286d72b6b1c17ae790dd974d4f96 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/flex/FlexWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function flexWidthTest() { + + describe('FlexWidthTest', () => { + + let PAGE_TAG = 'FlexWidthTest'; + let PAGE_TAG_LARGE = 'FlexWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Flex组件width参数分别设置为300、-100时的显示效果测试 + it('testFlexWidth001', 0, async (done: Function) => { + await Utils.pushPage(`flex/${PAGE_TAG}`, done); + }) + + //Flex组件width参数设置为500,超出父控件时的显示效果测试 + it('testFlexWidth002', 0, async (done: Function) => { + await Utils.pushPage(`flex/${PAGE_TAG_LARGE}`, done); + }); + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageAltTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageAltTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..843fadab5ba33d6963c2495f7b3c1f9d9fed4ed5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageAltTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageAltTest() { + + describe('ImageAltTest', () => { + + let PAGE_TAG = 'ImageAltTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件alt参数设置为./resources/base/media/icon.png时的显示效果测试 + * Image组件alt参数设置为./resources/base/media/src.jpg时的显示效果测试 + * Image组件alt参数设置为""时的显示效果测试 + * Image组件alt参数设置为错误路径时的显示效果测试 + * Image组件alt参数设置为https://gitee.com/openharmony/docs/raw/master/zh-cn/application-dev/ + * reference/apis-arkui/arkui-ts/figures/edgewidths.png时的显示效果测试 + */ + it('testImageAlt001', 0, async (done: Function) => { + await Utils.sleep(10000) + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageAutoResizeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageAutoResizeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7a55a5eb88aad8c75573a26f745713b5d63e620 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageAutoResizeTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageAutoResizeTest() { + + describe('ImageAutoResizeTest', () => { + + let PAGE_TAG = 'ImageAutoResizeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件autoResize参数设置为false时的显示效果测试 + * Image组件autoResize参数设置为true时的显示效果测试 + */ + it('testImageAutoResize001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..98dd9ac854b356f26d04b3a52a3085a62cdb5703 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBackgroundColorTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageBackgroundColorTest() { + + describe('ImageBackgroundColorTest', () => { + + let PAGE_TAG = 'ImageBackgroundColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件backgroundColor参数设置为0xFFFF0000时的显示效果测试 + * Image组件backgroundColor参数设置为0xFF000000时的显示效果测试 + */ + it('testImageBackgroundColor001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBlurTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBlurTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e9a6144873419834773ae52ee7001b29af1adcc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBlurTest.test.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageBlurTest() { + + describe('ImageBlurTest', () => { + + let PAGE_TAG = 'ImageBlurTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件blur参数设置为0时的显示效果测试 + * Image组件blur参数设置为30时的显示效果测试 + * Image组件blur参数设置为100时的显示效果测试 + * Image组件blur参数设置为-10时的显示效果测试 + */ + it('testImageBlur001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c82103726eae0aab713aec596d453283a38940c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderColorTest.test.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageBorderColorTest() { + + describe('ImageBorderColorTest', () => { + + let PAGE_TAG = 'ImageBorderColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件borderColor参数设置为0xFFFF11FF时的显示效果测试 + * Image组件borderColor参数设置为0xFF000000时的显示效果测试 + * Image组件borderColor参数设置为0xFF00FF00,0xFFFF0000,0xFFFFFF00,0xFFFFFFFF时的显示效果测试 + * Image组件borderColor参数设置为0xFF888888,0xFF00FF00,0xFFCCCCCC,0xFFFF00FF时的显示效果测试 + */ + it('testImageBorderColor001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderRadiusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderRadiusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e810b33b90c7c033c5ce907527c89a21c78a62b4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderRadiusTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageBorderRadiusTest() { + + describe('ImageBorderRadiusTest', () => { + + let PAGE_TAG = 'ImageBorderRadiusTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件BorderRadius参数设置为5时的显示效果测试 + * Image组件BorderRadius参数设置为15时的显示效果测试 + * Image组件BorderRadius参数设置为35时的显示效果测试 + * Image组件BorderRadius参数设置为5,8,10,12时的显示效果测试 + * Image组件BorderRadius参数设置为15,16,17,18时的显示效果测试 + * Image组件BorderRadius参数设置为35,35,35,35时的显示效果测试 + * Image组件BorderRadius参数设置为-10时的显示效果测试 + * Image组件BorderRadius参数设置为-10,-10,-10,-10时的显示效果测试 + */ + it('testImageBorderRadius001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6523d3f76cdadae7d37b7aa81e23ba8236da7fe0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderStyleTest.test.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageBorderStyleTest() { + + describe('ImageBorderStyleTest', () => { + + let PAGE_TAG = 'ImageBorderStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件borderStyle参数设置为ARKUI_BORDER_STYLE_SOLID时的显示效果测试 + * Image组件borderStyle参数设置为ARKUI_BORDER_STYLE_DASHED时的显示效果测试 + * Image组件borderStyle参数设置为ARKUI_BORDER_STYLE_DOTTED时的显示效果测试 + * Image组件borderStyle参数设置为ARKUI_BORDER_STYLE_SOLID,ARKUI_BORDER_STYLE_DASHED,ARKUI_BORDER_STYLE_SOLID, + * ARKUI_BORDER_STYLE_DOTTED时的显示效果测试 + * Image组件borderStyle参数设置为ARKUI_BORDER_STYLE_SOLID,ARKUI_BORDER_STYLE_SOLID,ARKUI_BORDER_STYLE_SOLID, + * ARKUI_BORDER_STYLE_SOLID时的显示效果测试 + * Image组件borderStyle参数设置为-1时的显示效果测试 + * Image组件borderStyle参数设置为10时的显示效果测试 + */ + it('testImageBorderStyle001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d2c91e107d46f3977eb4805594293f05d469d435 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBorderWidthTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageBorderWidthTest() { + + describe('ImageBorderWidthTest', () => { + + let PAGE_TAG = 'ImageBorderWidthTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件borderWidth参数设置为10时的显示效果测试 + * Image组件borderWidth参数设置为100时的显示效果测试 + * Image组件borderWidth参数设置为10,10,10,10时的显示效果测试 + * Image组件borderWidth参数设置为100,100,100,100时的显示效果测试 + * Image组件borderWidth参数设置为-10时的显示效果测试 + * Image组件borderWidth参数设置为-10,-10,-10,-10时的显示效果测试 + */ + it('testImageBorderWidth001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBrightnessTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBrightnessTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b879836b51a2131d6dda3b78700a7ca0e6607ae7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageBrightnessTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageBrightnessTest() { + + describe('ImageBrightnessTest', () => { + + let PAGE_TAG = 'ImageBrightnessTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件brightness参数设置为0时的显示效果测试 + * Image组件brightness参数设置为0.5时的显示效果测试 + * Image组件brightness参数设置为1时的显示效果测试 + * Image组件brightness参数设置为1.5时的显示效果测试 + * Image组件brightness参数设置为2时的显示效果测试 + * Image组件brightness参数设置为-1时的显示效果测试 + * Image组件brightness参数设置为3时的显示效果测试 + */ + it('testImageBrightness001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageClipTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageClipTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..538ba1b6c9a3ac5677dd58d8bcaebb0f16c34a0f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageClipTest.test.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageClipTest() { + + describe('ImageClipTest', () => { + + let PAGE_TAG = 'ImageClipTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件clip参数设置为ARKUI_CLIP_TYPE_RECTANGLE时的显示效果测试 + * Image组件clip参数设置为ARKUI_CLIP_TYPE_CIRCLE时的显示效果测试 + * Image组件clip参数设置为ARKUI_CLIP_TYPE_ELLIPSE时的显示效果测试 + * Image组件clip参数设置为ARKUI_CLIP_TYPE_PATH时的显示效果测试 + */ + it('testImageClip001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageColorFilterTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageColorFilterTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa4fbf601bc9863c9e77e867ab6c1736a581fb59 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageColorFilterTest.test.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageColorFilterTest() { + + describe('ImageColorFilterTest', () => { + + let PAGE_TAG = 'ImageColorFilterTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件colorFilter参数设置为{1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0}时的显示效果测试 + * Image组件colorFilter参数设置为{1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,255}时的显示效果测试 + * Image组件colorFilter参数设置为{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}时的显示效果测试 + */ + it('testImageColorFilter001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f822264ed1833ac0d56b2cd37c026c44e8e818a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageHeightTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageHeightTest() { + + describe('ImageHeightTest', () => { + + let PAGE_TAG = 'ImageHeightTest'; + let PAGE_TAG_LARGE = 'ImageHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Image组件Height参数分别设置为200、-50时的显示效果测试 + it('testImageHeight001', 0, async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + //Image组件Height参数设置为500,超出父控件时的显示效果测试 + it('testImageHeight002', 0, async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG_LARGE}`, done); + }); + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageHitTestBehaviorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageHitTestBehaviorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0ec7734406c6c6494365609492a93e85b752afc6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageHitTestBehaviorTest.test.ets @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageHitTestBehaviorTest() { + + describe('ImageHitTestBehaviorTest', () => { + + let PAGE_TAG = 'ImageHitTestBehaviorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_DEFAULT时的显示效果测试 + * Image组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_BLOCK时的显示效果测试 + * Image组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_TRANSPARENT时的显示效果测试 + * Image组件hitTestBehavior参数设置为ARKUI_HIT_TEST_MODE_NONE时的显示效果测试 + * Image组件hitTestBehavior参数设置为-1时的显示效果测试 + * Image组件hitTestBehavior参数设置为4时的显示效果测试 + */ + it('testImageHitTestBehavior001', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTestStackDefault') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackBlock') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackTransparent') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackNone') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackExceptBelow') + await Utils.sleep(1000) + await Utils.clickComponent('OnTouchTestStackExceptAbove') + await Utils.sleep(2000) + + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageIdTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageIdTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e2a2ecabd7882752b677f1f6c5c9977a994acaa3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageIdTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageIdTest() { + + describe('ImageIdTest', () => { + + let PAGE_TAG = 'ImageIdTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件Id参数设置为ImageRed时的显示效果测试 + * Image组件Id参数设置为ImageGreen时的显示效果测试 + */ + it('testImageId001', 0, async (done: Function) => { + await Utils.clickComponent('onTouchFirst') + await Utils.sleep(1000) + await Utils.clickComponent('onTouchSecond') + await Utils.sleep(1000) + + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageInterpolationTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageInterpolationTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7bdd532112937299691be92c403623d2ea0a41f8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageInterpolationTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageInterpolationTest() { + + describe('ImageInterpolationTest', () => { + + let PAGE_TAG = 'ImageInterpolationTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件interpolation参数设置为ARKUI_IMAGE_INTERPOLATION_NONE时的显示效果测试 + * Image组件interpolation参数设置为ARKUI_IMAGE_INTERPOLATION_LOW时的显示效果测试 + * Image组件interpolation参数设置为ARKUI_IMAGE_INTERPOLATION_MEDIUM时的显示效果测试 + * Image组件interpolation参数设置为ARKUI_IMAGE_INTERPOLATION_HIGH时的显示效果测试 + * Image组件interpolation参数设置为-1时的显示效果测试 + * Image组件interpolation参数设置为10时的显示效果测试 + */ + it('testImageInterpolation001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageLinearGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageLinearGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f26ddd6d4b1b5fd64f07e56b42dd718b99c76959 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageLinearGradientTest.test.ets @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageLinearGradientTest() { + + describe('ImageLinearGradientTest', () => { + + let PAGE_TAG = 'ImageLinearGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT,false时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_TOP,false时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT,false时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM,false时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP,false时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM,false时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP,false时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM,false时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_NONE,false时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM,false时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT,true时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_TOP,true时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT,true时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM,true时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP,true时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM,true时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP,true时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM,true时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_NONE,true时的显示效果测试 + * Image组件LinearGradient参数设置为180,ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM,true时的显示效果测试 + */ + it('testImageLinearGradient001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageObjectFitTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageObjectFitTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b309925039c16d9d48695c35e0aa265e989b3ad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageObjectFitTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageObjectFitTest() { + + describe('ImageObjectFitTest', () => { + + let PAGE_TAG = 'ImageObjectFitTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件objectFit参数设置为ARKUI_OBJECT_FIT_CONTAIN时的显示效果测试 + * Image组件objectFit参数设置为ARKUI_OBJECT_FIT_COVER时的显示效果测试 + * Image组件objectFit参数设置为ARKUI_OBJECT_FIT_AUTO时的显示效果测试 + * Image组件objectFit参数设置为ARKUI_OBJECT_FIT_FILL时的显示效果测试 + * Image组件objectFit参数设置为ARKUI_OBJECT_FIT_SCALE_DOWN时的显示效果测试 + * Image组件objectFit参数设置为ARKUI_OBJECT_FIT_NONE时的显示效果测试 + * Image组件objectFit参数设置为-1时的显示效果测试 + * Image组件objectFit参数设置为10时的显示效果测试 + */ + it('testImageObjectFit001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageObjectRepeatTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageObjectRepeatTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d9becb49191e1d7a81314d05ca3b0b383e36e212 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageObjectRepeatTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageObjectRepeatTest() { + + describe('ImageObjectRepeatTest', () => { + + let PAGE_TAG = 'ImageObjectRepeatTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件objectRepeat参数设置为ARKUI_IMAGE_REPEAT_NONE时的显示效果测试 + * Image组件objectRepeat参数设置为ARKUI_IMAGE_REPEAT_X时的显示效果测试 + * Image组件objectRepeat参数设置为ARKUI_IMAGE_REPEAT_Y时的显示效果测试 + * Image组件objectRepeat参数设置为ARKUI_IMAGE_REPEAT_XY时的显示效果测试 + * Image组件objectRepeat参数设置为-1时的显示效果测试 + * Image组件objectRepeat参数设置为10时的显示效果测试 + */ + it('testImageObjectRepeat001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageOnCompleteTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageOnCompleteTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad519f25940f402ab4a6451ce58467c81f29aa32 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageOnCompleteTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { beforeAll, describe, it } from '@ohos/hypium'; +import { ComponentInfo } from '../common/Interfaces'; +import Utils from '../common/Utils'; + +export default function imageOnCompleteTest() { + + describe('ImageOnCompleteTest', () => { + + let PAGE_TAG = 'ImageOnCompleteTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + /* + * @tc.number : SUB_ARKUI_CAPI_IMAGE_ONCOMPLETE_0100 + * @tc.name : testImageOnComplete001 + * @tc.desc : test image onComplete with event callback + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testImageOnComplete001', 0, async (done: Function) => { + await Utils.clickComponent('onTouchEvent') + await Utils.sleep(2000) + + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageOnErrorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageOnErrorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fff0d3c237d21016fecb5b44eea1e5fa6ef6924c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageOnErrorTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { beforeAll, describe, it } from '@ohos/hypium'; +import { ComponentInfo } from '../common/Interfaces'; +import Utils from '../common/Utils'; + +export default function imageOnErrorTest() { + + describe('ImageOnErrorTest', () => { + + let PAGE_TAG = 'ImageOnErrorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + /* + * @tc.number : SUB_ARKUI_CAPI_IMAGE_ONERROR_0100 + * @tc.name : testImageOnError001 + * @tc.desc : test image onError with event callback + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('testImageOnError001', 0, async (done: Function) => { + await Utils.clickComponent('onTouchEvent') + await Utils.sleep(2000) + + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageOpacityTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageOpacityTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..981708b40fb4a0b363ff6d574ccaf837e64df5bf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageOpacityTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageOpacityTest() { + + describe('ImageOpacityTest', () => { + + let PAGE_TAG = 'ImageOpacityTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件opacity参数设置为0时的显示效果测试 + * Image组件opacity参数设置为0.5时的显示效果测试 + * Image组件opacity参数设置为0.8时的显示效果测试 + * Image组件opacity参数设置为1时的显示效果测试 + * Image组件opacity参数设置为-1时的显示效果测试 + * Image组件opacity参数设置为2时的显示效果测试 + */ + it('testImageOpacity001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImagePositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImagePositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..937486cee38636098899450e56f70637e02978c5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImagePositionTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imagePositionTest() { + + describe('ImagePositionTest', () => { + + let PAGE_TAG = 'ImagePositionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Image组件position参数分别设置为{10,10},{-10,-10}时的显示效果测试 + it('testImagePosition001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageRadialGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageRadialGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..98f8bace3f307f9646a705f6fd53de9a3d66f25b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageRadialGradientTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageRadialGradientTest() { + + describe('ImageRadialGradientTest', () => { + + let PAGE_TAG = 'ImageRadialGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件RadialGradient参数设置为50,50,0,false时的显示效果测试 + * Image组件RadialGradient参数设置为50,50,50,false时的显示效果测试 + * Image组件RadialGradient参数设置为50,50,80,false时的显示效果测试 + * Image组件RadialGradient参数设置为50,50,50,true时的显示效果测试 + * Image组件RadialGradient参数设置为50,50,80,true时的显示效果测试 + */ + it('testImageRadialGradient001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageRotateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageRotateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c355179518a4147ce0d7e5c375fb9c4fa6a2b92 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageRotateTest.test.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageRotateTest() { + + describe('ImageRotateTest', () => { + + let PAGE_TAG = 'ImageRotateTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件rotate参数设置为0,0,0,0,0时的显示效果测试 + * Image组件rotate参数设置为0,0,1,300,0时的显示效果测试 + * Image组件rotate参数设置为1,0,1,-180,0时的显示效果测试 + * Image组件rotate参数设置为0,1,1,60,0时的显示效果测试 + */ + it('testImageRotate001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageSaturateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageSaturateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c35c9845fe641709d3ed0d82864db8e006d7e054 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageSaturateTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageSaturateTest() { + + describe('ImageSaturateTest', () => { + + let PAGE_TAG = 'ImageSaturateTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件saturate参数设置为0时的显示效果测试 + * Image组件saturate参数设置为1时的显示效果测试 + * Image组件saturate参数设置为5时的显示效果测试 + * Image组件saturate参数设置为20时的显示效果测试 + * Image组件saturate参数设置为FLT_MAX时的显示效果测试 + * Image组件saturate参数设置为-1时的显示效果测试 + * Image组件saturate参数设置为FLT_MAX + 1时的显示效果测试 + */ + it('testImageSaturate001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageScaleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageScaleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..99afab2dcc84bb3b498bbded8a4967b59ba4cce5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageScaleTest.test.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageScaleTest() { + + describe('ImageScaleTest', () => { + + let PAGE_TAG = 'ImageScaleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件scale参数设置为0.5,0.5时的显示效果测试 + * Image组件scale参数设置为1,1时的显示效果测试 + * Image组件scale参数设置为2,2时的显示效果测试 + * Image组件scale参数设置为-2,-2时的显示效果测试 + */ + it('testImageScale001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageShadowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageShadowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..acc770b17cb0313a293bc666cb0e3e5354876038 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageShadowTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageShadowTest() { + + describe('ImageShadowTest', () => { + + let PAGE_TAG = 'ImageShadowTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS时的显示效果测试 + * Image组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM时的显示效果测试 + * Image组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD时的显示效果测试 + * Image组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG时的显示效果测试 + * Image组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM时的显示效果测试 + * Image组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD时的显示效果测试 + */ + it('testImageShadow001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageSrcTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageSrcTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5113b4f34e5bace4882fbcb9407369fc646d381 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageSrcTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageSrcTest() { + + describe('ImageSrcTest', () => { + + let PAGE_TAG = 'ImageSrcTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件src参数设置为./resources/base/media/icon.png时的显示效果测试 + * Image组件src参数设置为./resources/base/media/src.jpg时的显示效果测试 + * Image组件src参数设置为""时的显示效果测试 + * Image组件src参数设置为错误路径时的显示效果测试 + * Image组件src参数设置为https://gitee.com/openharmony/docs/raw/master/zh-cn/application-dev/ + * reference/apis-arkui/arkui-ts/figures/edgewidths.png时的显示效果测试 + */ + it('testImageSrc001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageSweepGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageSweepGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..45a21b214a627f008b0ec00f940f449b625160f0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageSweepGradientTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageSweepGradientTest() { + + describe('ImageSweepGradientTest', () => { + + let PAGE_TAG = 'ImageSweepGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件SweepGradient参数设置为50,50,0,0,0,false时的显示效果测试 + * Image组件SweepGradient参数设置为50,50,0,359,45,false时的显示效果测试 + * Image组件SweepGradient参数设置为50,50,0,359,45,false,0x456,0x1234时的显示效果测试 + * Image组件SweepGradient参数设置为50,50,0,0,0,true时的显示效果测试 + * Image组件SweepGradient参数设置为50,50,0,359,45,true时的显示效果测试 + * Image组件SweepGradient参数设置为50,50,0,359,45,true,0x456,0x1234时的显示效果测试 + */ + it('testImageSweepGradient001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageTransformTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageTransformTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..08481818e324c45d3dae74de77af4a712ac13249 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageTransformTest.test.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageTransformTest() { + + describe('ImageTransformTest', () => { + + let PAGE_TAG = 'ImageTransformTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + /* + *Image组件参数设置transform + *0.5, 0, 0, 0, + *0, 0.5, 0, 0, + *0, 0, 1, 0, + *100, 100, 0, 1 + * + *-1, 0, 0, 0, + *0, -1, 0, 0, + *0, 0, -1, 0, + *-100, -100, 0, 1; + * + *cos(45), -sin(45), 0, 0, + *sin(45), cos(45), 0, 0, + *0, 0, 1, 0, + *0, 0, 0, 1; + * + *1, 0, 0, 0, + *0, 1, 0, 0, + *0, 0, 1, 0, + *1000, 1000, 0, 1; + * + *0, 0, 0, 0, + *0, 0, 0, 0, + *0, 0, 0, 0, + *0, 0, 0, 0; + *时的显示效果测试 + */ + it('testImageTransform001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageTranslateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageTranslateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9a9103a7a0be405e29b45807ee2aad8859be7880 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageTranslateTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageTranslateTest() { + + describe('ImageTranslateTest', () => { + + let PAGE_TAG = 'ImageTranslateTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Image组件translate参数设置为0,0,0时的显示效果测试 + * Image组件translate参数设置为10,10,10时的显示效果测试 + * Image组件translate参数设置为10000,10000,10000时的显示效果测试 + * Image组件translate参数设置为-10,-10,-10时的显示效果测试 + * Image组件translate参数设置为-10000,-10000,-10000时的显示效果测试 + */ + it('testImageTranslate001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9062ece076b56d96bd38240f813e3e7750bde01 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/image/ImageWidthTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageWidthTest() { + + describe('ImageWidthTest', () => { + + let PAGE_TAG = 'ImageWidthTest'; + let PAGE_TAG_LARGE = 'ImageWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Image组件width参数分别设置为300、-100时的显示效果测试 + it('testImageWidth001', 0, async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG}`, done); + }); + + //Image组件width参数设置为500,超出父控件时的显示效果测试 + it('testImageWidth002', 0, async (done: Function) => { + await Utils.pushPage(`image/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..af4c2387680608bce9aa97288bb284b3aeb2563a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanHeightTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageSpanHeightTest() { + + describe('ImageSpanHeightTest', () => { + + let PAGE_TAG = 'ImageSpanHeightTest'; + let PAGE_TAG_LARGE = 'ImageSpanHeightLargeTest'; + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //ImageSpan组件height参数分别设置为200、-50时的显示效果测试 + it('testImageSpanHeight001', 0, async (done: Function) => { + await Utils.pushPage(`imagespan/${PAGE_TAG}`, done); + }); + + //ImageSpan组件height参数设置为500,超出父控件时的显示效果测试 + it('testImageSpanHeight002', 0, async (done: Function) => { + await Utils.pushPage(`imagespan/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanObjectFitTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanObjectFitTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e42b54b814d740817ce2158258c225aa79aa7cea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanObjectFitTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageSpanObjectFitTest() { + + describe('ImageSpanObjectFitTest', () => { + + let PAGE_TAG = 'ImageSpanObjectFitTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`imagespan/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*ImageSpan组件objectFit参数分别设置为 + ARKUI_OBJECT_FIT_CONTAIN, + ARKUI_OBJECT_FIT_COVER, + ARKUI_OBJECT_FIT_AUTO, + ARKUI_OBJECT_FIT_FILL, + ARKUI_OBJECT_FIT_SCALE_DOWN, + ARKUI_OBJECT_FIT_NONE, + -1时的显示效果测试 + */ + it('testImageSpanObjectFit001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanPaddingTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanPaddingTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5377bdffa2323646ff6f45eeda08bfc07f18c87b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanPaddingTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageSpanPaddingTest() { + + describe('ImageSpanPaddingTest', () => { + + let PAGE_TAG = 'ImageSpanPaddingTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`imagespan/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //ImageSpan组件padding参数分别设置为10,-10,{20,20,50,50},{-20,-20,-50,-50}时的显示效果测试 + it('testImageSpanPadding001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanVerticalAlignTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanVerticalAlignTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1f17aa048f4c468c9a4083f6016316f0b4de76d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanVerticalAlignTest.test.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageSpanVerticalAlignTest() { + + describe('ImageSpanVerticalAlignTest', () => { + + let PAGE_TAG = 'ImageSpanVerticalAlignTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`imagespan/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*ImageSpan组件verticalAlign参数分别设置为 + ARKUI_IMAGE_SPAN_ALIGNMENT_BASELINE, + ARKUI_IMAGE_SPAN_ALIGNMENT_BOTTOM, + ARKUI_IMAGE_SPAN_ALIGNMENT_CENTER, + ARKUI_IMAGE_SPAN_ALIGNMENT_TOP, + -1时的显示效果测试 + */ + it('testImageSpanVerticalAlign001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fdc5392c9c1f9a050e3644e2b7b3c44ac57ffed6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/imagespan/ImageSpanWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function imageSpanWidthTest() { + + describe('ImageSpanWidthTest', () => { + + let PAGE_TAG = 'ImageSpanWidthTest'; + let PAGE_TAG_LARGE = 'ImageSpanWidthLargeTest'; + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //ImageSpan组件width参数分别设置为300、-100时的显示效果测试 + it('testImageSpanWidth001', 0, async (done: Function) => { + await Utils.pushPage(`imagespan/${PAGE_TAG}`, done); + }); + + //ImageSpan组件width参数设置为500,超出父控件时的显示效果测试 + it('testImageSpanWidth002', 0, async (done: Function) => { + await Utils.pushPage(`imagespan/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..800378897a2c757f95abd5f4ace6d1b45c0b0b59 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBackgroundColorTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listBackgroundColorTest() { + + describe('ListBackgroundColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //List组件backgroundColor参数设置为0xFF00FF00时的显示效果测试 + it('testListBackgroundColor001', 0, async (done: Function) => { + let PAGE_TAG = 'ListBackgroundColorTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //List组件backgroundColor参数设置为napi_null时的显示效果测试 + it('testListBackgroundColor002', 0, async (done: Function) => { + let PAGE_TAG = 'ListBackgroundColorNullTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //List组件backgroundColor参数设置为napi_undefined时的显示效果测试 + it('testListBackgroundColor003', 0, async (done: Function) => { + let PAGE_TAG = 'ListBackgroundColorUndefinedTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBlurTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBlurTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..78abd030edc1478a8f4e64cdd3a4fe8167a19133 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBlurTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listBlurTest() { + + describe('ListBlurTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //模糊半径50 + it('testListBlur001', 0, async (done: Function) => { + let PAGE_TAG = 'ListBlurTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //默认值0.0 + it('testListBlur002', 0, async (done: Function) => { + let PAGE_TAG = 'ListBlurDefaultValueTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListBlur003', 0, async (done: Function) => { + let PAGE_TAG = 'ListBlurAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBorderColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBorderColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9944dce4c8b4da26cf5ed812ff73abe362c612ac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBorderColorTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listBorderColorTest() { + + describe('ListBorderColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //统一设置四条边的边框颜色 + it('testListBorderColor001', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderColorUnifiedSettingsTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //分别设置四条边的边框颜色 + it('testListBorderColor002', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderColorRespectivelySettingsTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //设置为napi_null时的显示效果测试 + it('testListBorderColor003', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderColorNullTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //设置为napi_undefined时的显示效果测试 + it('testListBorderColor004', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderColorUndefinedTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBorderRadiusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBorderRadiusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d67b7341a51c9f6b97ce112b1ef35783d03ba99 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBorderRadiusTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listBorderRadiusTest() { + + describe('ListBorderRadiusTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //统一设置四条边的边框圆角 + it('testListBorderRadius001', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderRadiusUnifiedSettingsTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //分别设置四条边的边框圆角 + it('testListBorderRadius002', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderRadiusRespectivelySettingsTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //统一设置四条边的边框圆角下界异常 + it('testListBorderRadius003', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderRadiusUnifiedSettingsLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //分别设置四条边的边框圆角下界异常 + it('testListBorderRadius004', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderRadiusRespectivelySettingsLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBorderWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBorderWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..151849476b206c53eade1e505454a510f5aaea39 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBorderWidthTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listBorderWidthTest() { + + describe('ListBorderWidthTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //统一设置四条边的边框宽度 + it('testListBorderWidth001', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderWidthUnifiedSettingsTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //分别设置四条边的边框宽度 + it('testListBorderWidth002', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderWidthRespectivelySettingsTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //统一设置四条边的边框宽度的下界异常 + it('testListBorderWidth003', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderWidthUnifiedSettingsLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //分别设置四条边的边框宽度的下界异常 + it('testListBorderWidth004', 0, async (done: Function) => { + let PAGE_TAG = 'ListBorderWidthRespectivelySettingsLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBrightnessTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBrightnessTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5dd29305a939327765ee0f5629002bd51005b982 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListBrightnessTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listBrightnessTest() { + + describe('ListBrightnessTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //推荐取值最小值 + it('testListBrightness001', 0, async (done: Function) => { + let PAGE_TAG = 'ListBrightnessMinTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //推荐取值最大值 + it('testListBrightness002', 0, async (done: Function) => { + let PAGE_TAG = 'ListBrightnessMaxTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListBrightness003', 0, async (done: Function) => { + let PAGE_TAG = 'ListBrightnessLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testListBrightness004', 0, async (done: Function) => { + let PAGE_TAG = 'ListBrightnessUpperBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListCachedCountTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListCachedCountTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..27a3c5cb470018b09c82705e459920f7e9331771 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListCachedCountTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listCachedCountTest() { + + describe('ListCachedCountTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //List组件cachedCount参数设置为10时的显示效果测试 + it('testListCachedCount001', 0, async (done: Function) => { + let PAGE_TAG = 'ListCachedCountTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //List组件cachedCount参数设置为-10时的显示效果测试 + it('testListCachedCount002', 0, async (done: Function) => { + let PAGE_TAG = 'ListCachedCountAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListClipTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListClipTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4c36b4eab55d0f3b172c8a8cd066b7af96f74b4c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListClipTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listClipTest() { + + describe('ListClipTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //裁切 + it('testListClip001', 0, async (done: Function) => { + let PAGE_TAG = 'ListClipCutTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //不裁切 + it('testListClip002', 0, async (done: Function) => { + let PAGE_TAG = 'ListClipUncutTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //矩形 + it('testListClip003', 0, async (done: Function) => { + let PAGE_TAG = 'ListClipRectangleTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //圆形 + it('testListClip004', 0, async (done: Function) => { + let PAGE_TAG = 'ListClipCircleTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //椭圆形 + it('testListClip005', 0, async (done: Function) => { + let PAGE_TAG = 'ListClipEllipseTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //路径 + it('testListClip006', 0, async (done: Function) => { + let PAGE_TAG = 'ListClipPathTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListEdgeEffectTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListEdgeEffectTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b4f7e4b455ec712e6d0aefa3688e25f43dff50a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListEdgeEffectTest.test.ets @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listEdgeEffectTest() { + + describe('ListEdgeEffectTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'list', done) + }) + + //弹性物理动效,滑动到边缘后可以根据初始速度或通过触摸事件继续滑动一段距离,松手后回弹 + it('testListEdgeEffect001', 0, async (done: Function) => { + let PAGE_TAG = 'ListEdgeEffectSpringTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + await Utils.sleep(3000) + done() + }) + + //阴影效果,滑动到边缘后会有圆弧状的阴影 + it('testListEdgeEffect002', 0, async (done: Function) => { + let PAGE_TAG = 'ListEdgeEffectFadeTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + await Utils.flingComponent('EdgeEffect', false, true); + await Utils.sleep(3000) + done() + }) + + //滑动到边缘后无效果 + it('testListEdgeEffect003', 0, async (done: Function) => { + let PAGE_TAG = 'ListEdgeEffectNoneTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + await Utils.sleep(3000) + done() + }) + + //下界异常 + it('testListEdgeEffect004', 0, async (done: Function) => { + let PAGE_TAG = 'ListEdgeEffectLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + await Utils.sleep(3000) + done() + }) + + //下界异常含有子组件 + it('testListEdgeEffect005', 0, async (done: Function) => { + let PAGE_TAG = 'ListEdgeEffectUpperBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + await Utils.sleep(3000) + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListEnableScrollInteractionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListEnableScrollInteractionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..82098da0b9ef5c4dc049bf37bf6e6052158cb4ac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListEnableScrollInteractionTest.test.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listEnableScrollInteractionTest() { + + describe('ListEnableScrollInteractionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //支持滚动手势 + it('testListEnableScrollInteraction001', 0, async (done: Function) => { + let PAGE_TAG = 'ListEnableScrollInteractionSupportedTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('EnableScrollInteraction', false, true); + await Utils.sleep(3000) + done() + }) + + //不支持滚动手势 + it('testListEnableScrollInteraction002', 0, async (done: Function) => { + let PAGE_TAG = 'ListEnableScrollInteractionNotSupportedTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('EnableScrollInteraction', false, true); + await Utils.sleep(3000) + done() + }) + + //下界异常 + it('testListEnableScrollInteraction003', 0, async (done: Function) => { + let PAGE_TAG = 'ListEnableScrollInteractionLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('EnableScrollInteraction', false, true); + await Utils.sleep(3000) + done() + }) + + //上界异常 + it('testListEnableScrollInteraction004', 0, async (done: Function) => { + let PAGE_TAG = 'ListEnableScrollInteractionUpperBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('EnableScrollInteraction', false, true); + await Utils.sleep(3000) + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListFrictionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListFrictionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e31870ac3461f777eadb7666f0991c869624b82 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListFrictionTest.test.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; +import { Driver } from '@ohos.UiTest'; + +export default function listFrictionTest() { + + describe('ListFrictionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //默认值摩擦系数0.6 + it('testListFriction001', 0, async (done: Function) => { + let PAGE_TAG = 'ListFrictionDefaultTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('Friction', false, true); + await Utils.sleep(3000) + done() + }) + + //正常值摩擦系数20.6 + it('testListFriction002', 0, async (done: Function) => { + let PAGE_TAG = 'ListFrictionNormalTest'; + let X = 0; + let Y = 0; + await Utils.pushPage(`list/${PAGE_TAG}`); + let listRect = Utils.getComponentRect('Friction'); + X = Utils.getRectHorizontalCenterX(listRect) + Y = Utils.getRectVerticalCenterY(listRect) + let driver = Driver.create(); + await driver.swipe(X, Y + 100, X, Y - 100); + await Utils.sleep(3000) + done() + }) + + //异常值摩擦系数-0.1 + it('testListFriction003', 0, async (done: Function) => { + let PAGE_TAG = 'ListFrictionAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('Friction', false, true); + await Utils.sleep(3000) + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d67a91dddd8e0d7c2af3e5095145b8c4987cebc6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListHeightTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listHeightTest() { + + describe('ListHeightTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //小于父组件 + it('testListHeight001', 0, async (done: Function) => { + let PAGE_TAG = 'ListHeightTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //超出父组件 + it('testListHeight002', 0, async (done: Function) => { + let PAGE_TAG = 'ListHeightBeyondParentComponentTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListHeight003', 0, async (done: Function) => { + let PAGE_TAG = 'ListHeightLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常含有子组件 + it('testListHeight004', 0, async (done: Function) => { + let PAGE_TAG = 'ListHeightLowerBoundAbnormalContainsSubComponentTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListHitTestBehaviorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListHitTestBehaviorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c8be5d784eae2314e4cf6bb6368e19f3d46929af --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListHitTestBehaviorTest.test.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listHitTestBehaviorTest() { + + describe('ListHitTestBehaviorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //默认触摸测试效果 + it('testListHitTestBehavior001', 0, async (done: Function) => { + let PAGE_TAG = 'ListHitTestBehaviorDefaultTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.clickComponent('OnTouchTestStackDefault') + await Utils.sleep(2000) + done() + }) + + //自身响应触摸测试 + it('testListHitTestBehavior002', 0, async (done: Function) => { + let PAGE_TAG = 'ListHitTestBehaviorBlockTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.clickComponent('OnTouchTestStackBlock') + await Utils.sleep(2000) + done() + }) + + //自身和子节点都响应触摸测试 + it('testListHitTestBehavior003', 0, async (done: Function) => { + let PAGE_TAG = 'ListHitTestBehaviorTransparentTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.clickComponent('OnTouchTestStackTransparent') + await Utils.sleep(2000) + done() + }) + + //自身不响应触摸测试 + it('testListHitTestBehavior004', 0, async (done: Function) => { + let PAGE_TAG = 'ListHitTestBehaviorNoneTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.clickComponent('OnTouchTestStackNone') + await Utils.sleep(2000) + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListLinearGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListLinearGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b313f7e6b3d3affa7cf3bd5b5d1173235423f90a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListLinearGradientTest.test.ets @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listLinearGradientTest() { + + describe('ListLinearGradientTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //向左渐变 + it('testListLinearGradient001', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientLeftTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //向上渐变 + it('testListLinearGradient002', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientTopTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //向右渐变 + it('testListLinearGradient003', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientRightTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //向下渐变 + it('testListLinearGradient004', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientBottomTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //向左上渐变 + it('testListLinearGradient005', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientLeftTopTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //向左下渐变 + it('testListLinearGradient006', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientLeftBottomTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //向右上渐变 + it('testListLinearGradient007', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientRightTopTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //向右下渐变 + it('testListLinearGradient008', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientRightBottomTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //不渐变 + it('testListLinearGradient009', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientNoneTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //自定义渐变方向 + it('testListLinearGradient010', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientCustomTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListLinearGradient011', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //非法颜色 + it('testListLinearGradient012', 0, async (done: Function) => { + let PAGE_TAG = 'ListLinearGradientIllegalColorAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListListDirectionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListListDirectionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..586c3f49f1bab471e7ba78956804e12ba812db08 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListListDirectionTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listListDirectionTest() { + + describe('ListListDirectionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //仅支持竖直方向滚动 + it('testListListDirection001', 0, async (done: Function) => { + let PAGE_TAG = 'ListListDirectionVerticalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //仅支持水平方向滚动 + it('testListListDirection002', 0, async (done: Function) => { + let PAGE_TAG = 'ListListDirectionHorizontalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListListDirection003', 0, async (done: Function) => { + let PAGE_TAG = 'ListListDirectionLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testListListDirection004', 0, async (done: Function) => { + let PAGE_TAG = 'ListListDirectionUpperBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListOpacityTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListOpacityTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3667ad08f85a8743183c5ef07312ec2244ba46ab --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListOpacityTest.test.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listOpacityTest() { + + describe('ListOpacityTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //最大值 + it('testListOpacity001', 0, async (done: Function) => { + let PAGE_TAG = 'ListOpacityMaxTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //最小值 + it('testListOpacity002', 0, async (done: Function) => { + let PAGE_TAG = 'ListOpacityMinTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //中间值 + it('testListOpacity003', 0, async (done: Function) => { + let PAGE_TAG = 'ListOpacityMiddleTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListOpacity004', 0, async (done: Function) => { + let PAGE_TAG = 'ListOpacityLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testListOpacity005', 0, async (done: Function) => { + let PAGE_TAG = 'ListOpacityUpperBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListRotateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListRotateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..321ccfc60a098307aa93f109b0518b6c97641db1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListRotateTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listRotateTest() { + + describe('ListRotateTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //同时设置x坐标,y坐标,z坐标,旋转角度,视距 + it('testListRotate001', 0, async (done: Function) => { + let PAGE_TAG = 'ListRotateTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //同时设置x坐标,y坐标,z坐标,旋转角度,视距的负数值 + it('testListRotate002', 0, async (done: Function) => { + let PAGE_TAG = 'ListRotateSetNegativeNumbersTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //同时设置x坐标,y坐标,z坐标,旋转角度,视距的默认值 + it('testListRotate003', 0, async (done: Function) => { + let PAGE_TAG = 'ListRotateDefaultValueTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //单独设置x坐标,y坐标,z坐标 + it('testListRotate004', 0, async (done: Function) => { + let PAGE_TAG = 'ListRotateSetXYZTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //单独设置旋转角度 + it('testListRotate005', 0, async (done: Function) => { + let PAGE_TAG = 'ListRotateSetRotationAngleTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //单独设置视距 + it('testListRotate006', 0, async (done: Function) => { + let PAGE_TAG = 'ListRotateSetSightDistanceTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListSaturateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListSaturateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cef484f1af2a30e5a27b64248b65074ff3d00d3f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListSaturateTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listSaturateTest() { + + describe('ListSaturateTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //推荐取值最小值 + it('testListSaturate001', 0, async (done: Function) => { + let PAGE_TAG = 'ListSaturateMinTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //推荐取值最大值 + it('testListSaturate002', 0, async (done: Function) => { + let PAGE_TAG = 'ListSaturateMaxTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListSaturate003', 0, async (done: Function) => { + let PAGE_TAG = 'ListSaturateLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testListSaturate004', 0, async (done: Function) => { + let PAGE_TAG = 'ListSaturateUpperBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListScaleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListScaleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..96ddea55066e633111b47ceeb45e73ae9b63bc25 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListScaleTest.test.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listScaleTest() { + + describe('ListScaleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //X轴Y轴同时缩小 + it('testListScale001', 0, async (done: Function) => { + let PAGE_TAG = 'ListScaleReduceXYTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //单独缩小X轴 + it('testListScale002', 0, async (done: Function) => { + let PAGE_TAG = 'ListScaleReduceXTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //X轴Y轴同时放大 + it('testListScale003', 0, async (done: Function) => { + let PAGE_TAG = 'ListScaleEnlargeXYTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //单独放大X轴 + it('testListScale004', 0, async (done: Function) => { + let PAGE_TAG = 'ListScaleEnlargeXTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常场景 + it('testListScale005', 0, async (done: Function) => { + let PAGE_TAG = 'ListScaleAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListScrollBarTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListScrollBarTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..25f91a59f6026b8aada1dd25a0501c103285ebe9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListScrollBarTest.test.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listScrollBarTest() { + + describe('ListScrollBarTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //不显示 + it('testListScrollBar001', 0, async (done: Function) => { + let PAGE_TAG = 'ListScrollBarOffTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //按需显示 + it('testListScrollBar002', 0, async (done: Function) => { + let PAGE_TAG = 'ListScrollBarAutoTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('ScrollBarAuto', false, true); + done() + }) + + //常驻显示 + it('testListScrollBar003', 0, async (done: Function) => { + let PAGE_TAG = 'ListScrollBarOnTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListScrollBar004', 0, async (done: Function) => { + let PAGE_TAG = 'ListScrollBarLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testListScrollBar005', 0, async (done: Function) => { + let PAGE_TAG = 'ListScrollBarUpperBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListShadowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListShadowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9c84acb36c8faa30aae4b7d268c722373b123c8c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListShadowTest.test.ets @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listShadowTest() { + + describe('ListShadowTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //超小阴影 + it('testListShadow001', 0, async (done: Function) => { + let PAGE_TAG = 'ListShadowUltraSmallShadowTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //小阴影 + it('testListShadow002', 0, async (done: Function) => { + let PAGE_TAG = 'ListShadowSmallShadowTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //中阴影 + it('testListShadow003', 0, async (done: Function) => { + let PAGE_TAG = 'ListShadowMiddleShadowTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //大阴影 + it('testListShadow004', 0, async (done: Function) => { + let PAGE_TAG = 'ListShadowLargeShadowTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //浮动中阴影 + it('testListShadow005', 0, async (done: Function) => { + let PAGE_TAG = 'ListShadowFloatingShadowTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //浮动小阴影 + it('testListShadow006', 0, async (done: Function) => { + let PAGE_TAG = 'ListShadowFloatingSmallShadowTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListShadow007', 0, async (done: Function) => { + let PAGE_TAG = 'ListShadowLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testListShadow008', 0, async (done: Function) => { + let PAGE_TAG = 'ListShadowUpperBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListStickyTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListStickyTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..48e5ed0e6e21324ca04887cd821c991a26a90caf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListStickyTest.test.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listStickyTest() { + + describe('ListStickyTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //ListItemGroup的header不吸顶,footer不吸底 + it('testListSticky001', 0, async (done: Function) => { + let PAGE_TAG = 'ListStickyNoneTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('Sticky', false, true); + await Utils.sleep(2000) + done() + }) + + //ListItemGroup的header吸顶,footer不吸底 + it('testListSticky002', 0, async (done: Function) => { + let PAGE_TAG = 'ListStickyHeaderTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('Sticky', false, true); + await Utils.sleep(2000) + done() + }) + + //ListItemGroup的footer吸底,header不吸顶 + it('testListSticky003', 0, async (done: Function) => { + let PAGE_TAG = 'ListStickyFooterTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('Sticky', false, true); + await Utils.sleep(2000) + done() + }) + + //ListItemGroup的footer吸底,header吸顶 + it('testListSticky004', 0, async (done: Function) => { + let PAGE_TAG = 'ListStickyBothTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('Sticky', false, true); + await Utils.sleep(2000) + done() + }) + + //下界异常 + it('testListSticky005', 0, async (done: Function) => { + let PAGE_TAG = 'ListStickyLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('Sticky', false, true); + await Utils.sleep(2000) + done() + }) + + //上界异常 + it('testListSticky006', 0, async (done: Function) => { + let PAGE_TAG = 'ListStickyUpperBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`); + await Utils.flingComponent('Sticky', false, true); + await Utils.sleep(2000) + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListTranslateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListTranslateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2b9275eb0960a68abdd41b833f4f3ae67de2465 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListTranslateTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listTranslateTest() { + + describe('ListTranslateTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //同时设置x轴、y轴、z轴为正数 + it('testListTranslate001', 0, async (done: Function) => { + let PAGE_TAG = 'ListTranslateSetXYZTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //单独设置x轴为正数 + it('testListTranslate002', 0, async (done: Function) => { + let PAGE_TAG = 'ListTranslateSetXTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //同时设置x轴为负数 + it('testListTranslate003', 0, async (done: Function) => { + let PAGE_TAG = 'ListTranslateSetXMinusTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //同时设置x轴、y轴、z轴为负数 + it('testListTranslate004', 0, async (done: Function) => { + let PAGE_TAG = 'ListTranslateSetXYZMinusTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //统一设置x轴、y轴、z轴为正数的异常场景 + it('testListTranslate005', 0, async (done: Function) => { + let PAGE_TAG = 'ListTranslateUnifiedAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //统一设置x轴、y轴、z轴为负数的异常场景 + it('testListTranslate006', 0, async (done: Function) => { + let PAGE_TAG = 'ListTranslateUnifiedMinusAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c21fecea256f14f75f5e11a4b9ac599233c7cc5e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/list/ListWidthTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listWidthTest() { + + describe('ListWidthTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //小于父组件 + it('testListWidth001', 0, async (done: Function) => { + let PAGE_TAG = 'ListWidthTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //超出父组件 + it('testListWidth002', 0, async (done: Function) => { + let PAGE_TAG = 'ListWidthBeyondParentComponentTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListWidth003', 0, async (done: Function) => { + let PAGE_TAG = 'ListWidthLowerBoundAbnormalTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + + //下界异常含有子组件 + it('testListWidth004', 0, async (done: Function) => { + let PAGE_TAG = 'ListWidthLowerBoundAbnormalContainsSubComponentTest'; + await Utils.pushPage(`list/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..56257d51e7418024abf282e0444537a565361309 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBackgroundColorTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemBackgroundColorTest() { + + describe('ListItemBackgroundColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //ListItem组件backgroundColor参数设置为0xFFFF0000时的显示效果测试 + it('testListItemBackgroundColor001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBackgroundColorTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //ListItem组件backgroundColor参数设置为napi_null时的显示效果测试 + it('testListItemBackgroundColor002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBackgroundColorNullTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //ListItem组件backgroundColor参数设置为napi_undefined时的显示效果测试 + it('testListItemBackgroundColor003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBackgroundColorUndefinedTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBlurTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBlurTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ac14a56bef31f94f06cd48dfcfd0181f01b61ea3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBlurTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemBlurTest() { + + describe('ListItemBlurTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //模糊半径50 + it('testListItemBlur001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBlurTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //默认值0.0 + it('testListItemBlur002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBlurDefaultValueTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListItemBlur003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBlurAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBorderColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBorderColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..dc8ccd36442e2ec186773b9b25f77ba23eeb9765 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBorderColorTest.test.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemBorderColorTest() { + + describe('ListItemBorderColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //统一设置四条边的边框颜色 + it('testListItemBorderColor001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderColorUnifiedSettingsTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //分别设置四条边的边框颜色 + it('testListItemBorderColor002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderColorRespectivelySettingsTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //ListItem组件borderColor参数设置为napi_null时的显示效果测试 + it('testListItemBorderColor003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderColorNullTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + + //ListItem组件borderColor参数设置为napi_undefined时的显示效果测试 + it('testListItemBorderColor004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderColorUndefinedTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBorderRadiusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBorderRadiusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a9d3ca81282cd9ff151543566565f5f971e54c8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBorderRadiusTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemBorderRadiusTest() { + + describe('ListItemBorderRadiusTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //统一设置四条边的边框圆角 + it('testListItemBorderRadius001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderRadiusUnifiedSettingsTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //分别设置四条边的边框圆角 + it('testListItemBorderRadius002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderRadiusRespectivelySettingsTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //统一设置四条边的边框圆角下界异常 + it('testListItemBorderRadius003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderRadiusUnifiedSettingsLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //分别设置四条边的边框圆角下界异常 + it('testListItemBorderRadius004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderRadiusRespectivelySettingsLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBorderWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBorderWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..521943c84186d516e3c7c9a3bfb205effacdd4d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBorderWidthTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemBorderWidthTest() { + + describe('ListItemBorderWidthTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //统一设置四条边的边框宽度 + it('testListItemBorderWidth001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderWidthUnifiedSettingsTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //分别设置四条边的边框宽度 + it('testListItemBorderWidth002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderWidthRespectivelySettingsTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //统一设置四条边的边框宽度的下界异常 + it('testListItemBorderWidth003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderWidthUnifiedSettingsLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //分别设置四条边的边框宽度的下界异常 + it('testListItemBorderWidth004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBorderWidthRespectivelySettingsLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBrightnessTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBrightnessTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3aae9ada8ef7cf47a9d3612e7e6f50800be5f21e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemBrightnessTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemBrightnessTest() { + + describe('ListItemBrightnessTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //推荐取值最小值 + it('testListItemBrightness001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBrightnessMinTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //推荐取值最大值 + it('testListItemBrightness002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBrightnessMaxTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListItemBrightness003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBrightnessLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testListItemBrightness004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemBrightnessUpperBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemClipTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemClipTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d4a5b825250de20aaced889a919f8a5563f490b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemClipTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemClipTest() { + + describe('ListItemClipTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //裁切 + it('testListItemClip001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemClipCutTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //不裁切 + it('testListItemClip002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemClipUncutTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //矩形 + it('testListItemClip003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemClipRectangleTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //圆形 + it('testListItemClip004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemClipCircleTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //椭圆形 + it('testListItemClip005', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemClipEllipseTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //路径 + it('testListItemClip006', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemClipPathTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemEdgeEffectTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemEdgeEffectTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..233c7c34b4aa8bcd1ca9baa7a67be83edad1d3b1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemEdgeEffectTest.test.ets @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemEdgeEffectTest() { + + describe('ListItemEdgeEffectTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'listitem', done) + }) + + //弹性物理动效,滑动到边缘后可以根据初始速度或通过触摸事件继续滑动一段距离,松手后回弹 + it('testListItemEdgeEffect001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemEdgeEffectSpringTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + done() + }) + + //阴影效果,滑动到边缘后会有圆弧状的阴影 + it('testListItemEdgeEffect002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemEdgeEffectFadeTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + await Utils.flingComponent('EdgeEffect', false, true); + done() + }) + + //滑动到边缘后无效果 + it('testListItemEdgeEffect003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemEdgeEffectNoneTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + done() + }) + + //下界异常 + it('testListItemEdgeEffect004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemEdgeEffectLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + done() + }) + + //下界异常含有子组件 + it('testListItemEdgeEffect005', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemEdgeEffectUpperBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e4dcdf6194cd65bc9123ecfa75a9794b21e4ca3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemHeightTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemHeightTest() { + + describe('ListItemHeightTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //小于父组件 + it('testListItemHeight001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemHeightTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //超出父组件 + it('testListItemHeight002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemHeightBeyondParentComponentTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListItemHeight003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemHeightLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常含有子组件 + it('testListItemHeight004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemHeightLowerBoundAbnormalContainsSubComponentTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemHitTestBehaviorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemHitTestBehaviorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..364ec60052835bc4468f0e0560c98254852d564b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemHitTestBehaviorTest.test.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemHitTestBehaviorTest() { + + describe('ListItemHitTestBehaviorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //默认触摸测试效果 + it('testListItemHitTestBehavior001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemHitTestBehaviorDefaultTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`); + await Utils.clickComponent('OnTouchTestStackDefault') + await Utils.sleep(2000) + done() + }) + + //自身响应触摸测试 + it('testListItemHitTestBehavior002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemHitTestBehaviorBlockTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`); + await Utils.clickComponent('OnTouchTestStackBlock') + await Utils.sleep(2000) + done() + }) + + //自身和子节点都响应触摸测试 + it('testListItemHitTestBehavior003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemHitTestBehaviorTransparentTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`); + await Utils.clickComponent('OnTouchTestStackTransparent') + await Utils.sleep(2000) + done() + }) + + //自身不响应触摸测试 + it('testListItemHitTestBehavior004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemHitTestBehaviorNoneTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`); + await Utils.clickComponent('OnTouchTestStackNone') + await Utils.sleep(2000) + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemLinearGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemLinearGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..956a6f7cb9d4b3d7fbd1c103acdf57118c01d536 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemLinearGradientTest.test.ets @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemLinearGradientTest() { + + describe('ListItemLinearGradientTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //向左渐变 + it('testListItemLinearGradient001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientLeftTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //向上渐变 + it('testListItemLinearGradient002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientTopTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //向右渐变 + it('testListItemLinearGradient003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientRightTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //向下渐变 + it('testListItemLinearGradient004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientBottomTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //向左上渐变 + it('testListItemLinearGradient005', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientLeftTopTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //向左下渐变 + it('testListItemLinearGradient006', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientLeftBottomTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //向右上渐变 + it('testListItemLinearGradient007', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientRightTopTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //向右下渐变 + it('testListItemLinearGradient008', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientRightBottomTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //不渐变 + it('testListItemLinearGradient009', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientNoneTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //自定义渐变方向 + it('testListItemLinearGradient010', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientCustomTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListItemLinearGradient011', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //非法颜色 + it('testListItemLinearGradient012', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemLinearGradientIllegalColorAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemOpacityTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemOpacityTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7fe98a6122bf7a2598e4758662f2f5b30f300ea5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemOpacityTest.test.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemOpacityTest() { + + describe('ListItemOpacityTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //最大值 + it('testListItemOpacity001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemOpacityMaxTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //最小值 + it('testListItemOpacity002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemOpacityMinTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //中间值 + it('testListItemOpacity003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemOpacityMiddleTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListItemOpacity004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemOpacityLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testListItemOpacity005', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemOpacityUpperBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemRotateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemRotateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b21c20447841086f04d7e1b9b271ffdb752313dc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemRotateTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemRotateTest() { + + describe('ListItemRotateTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //同时设置x坐标,y坐标,z坐标,旋转角度,视距 + it('testListItemRotate001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemRotateTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //同时设置x坐标,y坐标,z坐标,旋转角度,视距的负数值 + it('testListItemRotate002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemRotateSetNegativeNumbersTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //同时设置x坐标,y坐标,z坐标,旋转角度,视距的默认值 + it('testListItemRotate003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemRotateDefaultValueTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //单独设置x坐标,y坐标,z坐标 + it('testListItemRotate004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemRotateSetXYZTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //单独设置旋转角度 + it('testListItemRotate005', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemRotateSetRotationAngleTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //单独设置视距 + it('testListItemRotate006', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemRotateSetSightDistanceTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemSaturateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemSaturateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..91af08e495ed567d7a69effd0838fbf3c473cf43 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemSaturateTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemSaturateTest() { + + describe('ListItemSaturateTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //推荐取值最小值 + it('testListItemSaturate001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemSaturateMinTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //推荐取值最大值 + it('testListItemSaturate002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemSaturateMaxTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListItemSaturate003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemSaturateLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testListItemSaturate004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemSaturateUpperBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemScaleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemScaleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..334f0f621ec4217ad11f82566034f7848c42d21b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemScaleTest.test.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemScaleTest() { + + describe('ListItemScaleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //X轴Y轴同时缩小 + it('testListItemScale001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemScaleReduceXYTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //单独缩小X轴 + it('testListItemScale002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemScaleReduceXTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //X轴Y轴同时放大 + it('testListItemScale003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemScaleEnlargeXYTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //单独放大X轴 + it('testListItemScale004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemScaleEnlargeXTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常场景 + it('testListItemScale005', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemScaleAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemShadowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemShadowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5949e4c45e3215bf09d2e10e0a4aa6a2a9478609 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemShadowTest.test.ets @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemShadowTest() { + + describe('ListItemShadowTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //超小阴影 + it('testListItemShadow001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemShadowUltraSmallShadowTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //小阴影 + it('testListItemShadow002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemShadowSmallShadowTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //中阴影 + it('testListItemShadow003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemShadowMiddleShadowTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //大阴影 + it('testListItemShadow004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemShadowLargeShadowTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //浮动中阴影 + it('testListItemShadow005', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemShadowFloatingShadowTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //浮动小阴影 + it('testListItemShadow006', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemShadowFloatingSmallShadowTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListItemShadow007', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemShadowLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //上界异常 + it('testListItemShadow008', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemShadowUpperBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemTranslateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemTranslateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e72b0364349f8b649d0ef717f8c2fe70d1dbbdfc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemTranslateTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemTranslateTest() { + + describe('ListItemTranslateTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //同时设置x轴、y轴、z轴为正数 + it('testListItemTranslate001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemTranslateSetXYZTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //单独设置x轴为正数 + it('testListItemTranslate002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemTranslateSetXTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //同时设置x轴为负数 + it('testListItemTranslate003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemTranslateSetXMinusTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //同时设置x轴、y轴、z轴为负数 + it('testListItemTranslate004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemTranslateSetXYZMinusTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //统一设置x轴、y轴、z轴为正数的异常场景 + it('testListItemTranslate005', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemTranslateUnifiedAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //统一设置x轴、y轴、z轴为负数的异常场景 + it('testListItemTranslate006', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemTranslateUnifiedMinusAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c20dfb119ae727bdc482168002eec780553f966c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/listitem/ListItemWidthTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function listItemWidthTest() { + + describe('ListItemWidthTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //小于父组件 + it('testListItemWidth001', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemWidthTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //超出父组件 + it('testListItemWidth002', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemWidthBeyondParentComponentTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常 + it('testListItemWidth003', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemWidthLowerBoundAbnormalTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + + //下界异常含有子组件 + it('testListItemWidth004', 0, async (done: Function) => { + let PAGE_TAG = 'ListItemWidthLowerBoundAbnormalContainsSubComponentTest'; + await Utils.pushPage(`listitem/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/loadingprogress/LoadingProgressColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/loadingprogress/LoadingProgressColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb0876c0323fad351867d00e19716cf36ede6717 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/loadingprogress/LoadingProgressColorTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function loadingProgressColorTest() { + + describe('LoadingProgressColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // LoadingProgress组件Color参数设置为0xFFFF0000时的显示效果测试 + it('testLoadingProgressColor001', 0, async (done: Function) => { + let PAGE_TAG = 'LoadingProgressColorTest'; + await Utils.pushPage(`loadingprogress/${PAGE_TAG}`); + done(); + }) + + // LoadingProgress组件Color参数设置为黑色时的显示效果测试 + it('testLoadingProgressColor002', 0, async (done: Function) => { + let PAGE_TAG = 'LoadingProgressColorBlackTest'; + await Utils.pushPage(`loadingprogress/${PAGE_TAG}`); + done(); + }) + + // LoadingProgress组件Color参数设置为白色时的显示效果测试 + it('testLoadingProgressColor003', 0, async (done: Function) => { + let PAGE_TAG = 'LoadingProgressColorWhiteTest'; + await Utils.pushPage(`loadingprogress/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/loadingprogress/LoadingProgressEnableLoadingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/loadingprogress/LoadingProgressEnableLoadingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3f520b2f68032aaea634a95947e9a8e6d4b75d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/loadingprogress/LoadingProgressEnableLoadingTest.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function loadingProgressEnableLoadingTest() { + + describe('LoadingProgressEnableLoadingTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // LoadingProgress组件enableLoading参数设置为true时的显示效果测试 + it('testLoadingProgressEnableLoading001', 0, async (done: Function) => { + let PAGE_TAG = 'LoadingProgressEnableLoadingTrueTest'; + await Utils.pushPage(`loadingprogress/${PAGE_TAG}`); + done(); + }) + + // LoadingProgress组件enableLoading参数设置为false时的显示效果测试 + it('testLoadingProgressEnableLoading002', 0, async (done: Function) => { + let PAGE_TAG = 'LoadingProgressEnableLoadingFalseTest'; + await Utils.pushPage(`loadingprogress/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/progress/ProgressBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/progress/ProgressBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5740e14fca832ef27fa4576646dc2350cfe09d89 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/progress/ProgressBackgroundColorTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function progressBackgroundColorTest() { + + describe('ProgressBackgroundColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Progress组件backgroundColor参数设置为0xFFFF0000时的显示效果测试 + it('testProgressBackgroundColor001', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressBackgroundColorTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + + // Progress组件backgroundColor参数设置为黑色时的显示效果测试 + it('testProgressBackgroundColor002', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressBackgroundColorBlackTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + + // Progress组件backgroundColor参数设置为白色时的显示效果测试 + it('testProgressBackgroundColor003', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressBackgroundColorWhiteTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/progress/ProgressColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/progress/ProgressColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d2f988f25a63edee90ca88ac99af86833a51ca4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/progress/ProgressColorTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function progressColorTest() { + + describe('ProgressColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Progress组件Color参数设置为0xFFFF0000时的显示效果测试 + it('testProgressColor001', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressColorTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + + // Progress组件Color参数设置为黑色时的显示效果测试 + it('testProgressColor002', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressColorBlackTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + + // Progress组件Color参数设置为白色时的显示效果测试 + it('testProgressColor003', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressColorWhiteTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/progress/ProgressStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/progress/ProgressStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..c70e92525f5f481a8497db308d02eaca1f20f282 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/progress/ProgressStyleTest.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function progressStyleTest() { + + describe('ProgressStyleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Progress组件Style参数设置为Linear时的显示效果测试 + it('testProgressStyle001', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressStyleLinearTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + + // Progress组件Style参数设置为Capsule时的显示效果测试 + it('testProgressStyle002', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressStyleCapsuleTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + + // Progress组件Style参数设置为Ring时的显示效果测试 + it('testProgressStyle003', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressStyleRingTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + + // Progress组件Style参数设置为ScaleRing时的显示效果测试 + it('testProgressStyle004', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressStyleScaleRingTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + + // Progress组件Style参数设置为Eclipse时的显示效果测试 + it('testProgressStyle005', 0, async (done: Function) => { + let PAGE_TAG = 'ProgressStyleEclipseTest'; + await Utils.pushPage(`progress/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/refresh/RefreshOnRefreshingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/refresh/RefreshOnRefreshingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..58e0cbac86791c6e22a57b03d9b4e51de4dfec88 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/refresh/RefreshOnRefreshingTest.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; +import { Driver } from '@ohos.UiTest'; + +export default function refreshOnRefreshingTest() { + + describe('RefreshOnRefreshingTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Refresh组件触发NODE_REFRESH_ON_REFRESH事件的显示效果测试 + it('testRefreshOnRefreshing001', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshOnRefreshingTest'; + await Utils.pushPage(`refresh/${PAGE_TAG}`); + await Utils.sleep(2000) + let driver = Driver.create(); + await driver.swipe(200, 150, 200, 300); + await Utils.sleep(2000) + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/refresh/RefreshOnStateChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/refresh/RefreshOnStateChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..47bfed8619a7bea252b8b0405b68ba1bdc7fd4c4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/refresh/RefreshOnStateChangeTest.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; +import { Driver } from '@ohos.UiTest'; + +async function doIt(X: number, Y: number, done: Function) { + await Utils.sleep(2000) + let driver = Driver.create(); + await driver.swipe(X, Y - 50, X, Y + 50); + await Utils.sleep(2000) + done() +} + +export default function refreshOnStateChangeTest() { + + describe('RefreshOnStateChangeTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Refresh组件触发NODE_REFRESH_STATE_CHANGE事件的显示效果测试 + it('testRefreshOnStateChange001', 0, async (done: Function) => { + let PAGE_TAG = 'RefreshOnStateChangeTest'; + await Utils.pushPage(`refresh/${PAGE_TAG}`); + doIt(200,200,done); + await Utils.sleep(2000) + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/row/RowHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/row/RowHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3684d758fa475217d78fdd3074c8fce0d9cca6d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/row/RowHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function rowHeightTest() { + + describe('RowHeightTest', () => { + + let PAGE_TAG = 'RowHeightTest'; + let PAGE_TAG_LARGE = 'RowHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Row组件height参数分别设置为200、-50时的显示效果测试 + it('testRowHeight001', 0, async (done: Function) => { + await Utils.pushPage(`row/${PAGE_TAG}`, done); + }); + + //Row组件height参数设置为500,超出父控件时的显示效果测试 + it('testRowHeight002', 0, async (done: Function) => { + await Utils.pushPage(`row/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..96586245a2d939c24ffa53dedf6a2549f910a71d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBackgroundColorTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollBackgroundColorTest() { + + describe('ScrollBackgroundColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件backgroundColor参数设置为0xFFFF0000时的显示效果测试 + it('testScrollBackgroundColor001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBackgroundColorTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件backgroundColor参数设置为黑色时的显示效果测试 + it('testScrollBackgroundColor002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBackgroundColorBlackTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件backgroundColor参数设置为白色时的显示效果测试 + it('testScrollBackgroundColor003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBackgroundColorWhiteTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBlurTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBlurTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a8d6eadac8bad7a9f7860938ce9dedfce211f72 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBlurTest.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollBlurTest() { + + describe('ScrollBlurTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件blur参数设置为50时的显示效果测试 + it('testScrollBlur001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBlurTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件blur参数设置为0.0时的显示效果测试 + it('testScrollBlur002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBlurDefaultTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBorderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBorderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa873d0bd3b7f53ec5de7cb9ba5bb22a7f34bb3b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBorderColorTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollBorderColorTest() { + + describe('ScrollBorderColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件borderColor参数设置为0xFFFF0000时的显示效果测试 + it('testScrollBorderColor001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBorderColorTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + //Scroll组件borderColor参数设置为napi_null时的显示效果测试 + it('testScrollBorderColor002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBorderColorNullTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done() + }) + + //Scroll组件borderColor参数设置为napi_undefined时的显示效果测试 + it('testScrollBorderColor003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBorderColorUndefinedTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBorderRadiusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBorderRadiusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..6d93189eba77442bd98f782e89b9061bf5823b01 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBorderRadiusTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollBorderRadiusTest() { + + describe('ScrollBorderRadiusTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件borderRadius参数设置为40时的显示效果测试 + it('testScrollBorderRadius001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBorderRadiusSingleTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件borderRadius参数设置为(-10,50,10,50)时的显示效果测试 + it('testScrollBorderRadius002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBorderRadiusAbnormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件borderRadius参数设置为(10,50,10,50)时的显示效果测试 + it('testScrollBorderRadius003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBorderRadiusAllParamTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBorderWidthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBorderWidthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b23d3a5d3e7a64e223a783504ba34c9d010fb45d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBorderWidthTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollBorderWidthTest() { + + describe('ScrollBorderWidthTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件borderWidth参数设置为40时的显示效果测试 + it('testScrollBorderWidth001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBorderWidthSingleTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件borderWidth参数设置为10,50,10,50时的显示效果测试 + it('testScrollBorderWidth002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBorderWidthAbnormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件borderWidth参数设置为(-10,50,10,50)时的显示效果测试 + it('testScrollBorderWidth003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBorderWidthAllParamTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBrightnessTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBrightnessTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..de7ae35493915fcfa7e0f226889f2c4eb979756b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollBrightnessTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollBrightnessTest() { + + describe('ScrollBrightnessTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件brightness参数设置为1.0时的显示效果测试 + it('testScrollBrightness001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBrightnessTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件brightness参数设置为1000时的显示效果测试 + it('testScrollBrightness002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBrightnessAbnormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件brightness参数设置为2时的显示效果测试 + it('testScrollBrightness003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBrightnessMaxTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件brightness参数设置为1时的显示效果测试 + it('testScrollBrightness004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollBrightnessMinTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollClipTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollClipTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1b8c063cff101439efb1922cf0759d9f940ecfb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollClipTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollClipTest() { + + describe('ScrollClipTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件clip参数设置为true时的显示效果测试 + it('testScrollClip001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollClipTrueTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件clip参数设置为false时的显示效果测试 + it('testScrollClip002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollClipFalseTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件clip参数设置为1000时的显示效果测试 + it('testScrollClip003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollClipAbnormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollCurrentOffsetTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollCurrentOffsetTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d33ac4688db12805ce801cbfc34a89636b2fd5d2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollCurrentOffsetTest.test.ets @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollCurrentOffsetTest() { + + describe('ScrollCurrentOffsetTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Scroll组件设置currentOffset属性为0,10.0,64,ARKUI_CURVE_LINEAR,true的显示效果测试 + it('testScrollCurrentOffset001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetLinearTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetEaseTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetEaseInTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetEaseOutTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset005', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetEaseInOutTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset006', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetFastOutSlowInTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset007', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetLinearOutSlowInTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset008', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetFastOutLinearInTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset009', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetExtremeDecelerationTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset010', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetSharpTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset011', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetRhythmTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset012', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetSmoothTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + + //Scroll组件设置currentOffset属性为的显示效果测试 + it('testScrollCurrentOffset013', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollCurrentOffsetFrictionTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollEdgeEffectTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollEdgeEffectTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..de76ecc5286479159e8b13f7a3bd34f5e367d50b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollEdgeEffectTest.test.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollEdgeEffectTest() { + + describe('ScrollEdgeEffectTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件edgeEffect参数设置为(ARKUI_EDGE_EFFECT_NONE,1)时的显示效果测试 + it('testScrollEdgeEffect001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollEdgeEffectNoneTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + done(); + }) + + // Scroll组件edgeEffect参数设置为(ARKUI_EDGE_EFFECT_SPRING,1)时的显示效果测试 + it('testScrollEdgeEffect002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollEdgeEffectSpringTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + done(); + }) + + // Scroll组件edgeEffect参数设置为(ARKUI_EDGE_EFFECT_FADE,1)时的显示效果测试 + it('testScrollEdgeEffect003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollEdgeEffectFadeTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('EdgeEffect', false, true); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollEnableScrollInteractionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollEnableScrollInteractionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..16b26055b525376623366edc6d6d093a5ff052a5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollEnableScrollInteractionTest.ets @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollEnableScrollInteractionTest() { + + describe('ScrollEnableScrollInteractionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件enableScrollInteraction参数设置为true时的显示效果测试 + it('testScrollEnableScrollInteraction001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollEnableScrollInteractionTrueTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('EnableScrollInteraction', false, true); + await Utils.sleep(3000) + done(); + }) + + // Scroll组件enableScrollInteraction参数设置为false时的显示效果测试 + it('testScrollEnableScrollInteraction002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollEnableScrollInteractionFalseTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('EnableScrollInteraction', false, true); + await Utils.sleep(3000) + done(); + }) + + // Scroll组件enableScrollInteraction参数设置为1000时的显示效果测试 + it('testScrollEnableScrollInteraction003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollEnableScrollInteractionAbnormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('EnableScrollInteraction', false, true); + await Utils.sleep(3000) + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollFrictionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollFrictionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0e089a5071ca5d02534c8dd5eb99577630273127 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollFrictionTest.ets @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollFrictionTest() { + + describe('ScrollFrictionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件friction参数设置为0.6时的显示效果测试 + it('testScrollFriction001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollFrictionNormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('Friction', false, true); + await Utils.sleep(3000) + done(); + }) + + // Scroll组件friction参数设置为1000时的显示效果测试 + it('testScrollFriction002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollFrictionAbNormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('Friction', false, true); + await Utils.sleep(3000) + done(); + }) + + // Scroll组件friction参数设置为0.9时的显示效果测试 + it('testScrollFriction003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollFrictionDefaultTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('Friction', false, true); + await Utils.sleep(3000) + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ceea0226cf98fb3c6d4756fe0c5cd8da41e6ba62 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollHeightTest() { + + describe('ScrollHeightTest', () => { + + let PAGE_TAG = 'ScrollHeightTest'; + let PAGE_TAG_LARGE = 'ScrollHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Scroll组件height参数分别设置为200、-50时的显示效果测试 + it('testScrollHeight001', 0, async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + }); + + //Scroll组件height参数设置为10000,超出父控件时的显示效果测试 + it('testScrollHeight002', 0, async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollHitTestBehaviorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollHitTestBehaviorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6bb83d4ed2b5f5baf05801ce83dc40f656d09bc6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollHitTestBehaviorTest.test.ets @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollHitTestBehaviorTest() { + + describe('ScrollHitTestBehaviorTest', () => { + + let PAGE_TAG = 'ScrollHitTestBehaviorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // scroll组件调用capi设置hittestbehavior正常触发的场景 + it('testScrollHitTestBehavior001', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTestStackDefault') + await Utils.sleep(2000) + + await Utils.clickComponent('OnTouchTestStackBlock') + await Utils.sleep(2000) + + await Utils.clickComponent('OnTouchTestStackTransparent') + await Utils.sleep(2000) + + await Utils.clickComponent('OnTouchTestStackNone') + await Utils.sleep(1000) + + await Utils.clickComponent('OnTouchTestStackExceptBelow') + await Utils.sleep(1000) + + await Utils.clickComponent('OnTouchTestStackExceptAbove') + await Utils.sleep(2000) + + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollLinearGradientTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollLinearGradientTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ede66c000b6b177a7a96fef9ea71d5177a59eb3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollLinearGradientTest.ets @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollLinearGradientTest() { + + describe('ScrollLinearGradientTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件linearGradient参数设置为ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT时的显示效果测试 + it('testScrollLinearGradient001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollLinearGradientLeftTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件linearGradient参数设置为ARKUI_LINEAR_GRADIENT_DIRECTION_TOP时的显示效果测试 + it('testScrollLinearGradient002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollLinearGradientTopTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件linearGradient参数设置为ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT时的显示效果测试 + it('testScrollLinearGradient003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollLinearGradientRightTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件linearGradient参数设置为ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM时的显示效果测试 + it('testScrollLinearGradient004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollLinearGradientBottomTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件linearGradient参数设置为ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP时的显示效果测试 + it('testScrollLinearGradient005', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollLinearGradientLeftTopTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件linearGradient参数设置为ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM时的显示效果测试 + it('testScrollLinearGradient006', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollLinearGradientLeftBottomTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件linearGradient参数设置为ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP时的显示效果测试 + it('testScrollLinearGradient007', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollLinearGradientRightTopTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件linearGradient参数设置为ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM时的显示效果测试 + it('testScrollLinearGradient008', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollLinearGradientRightBottomTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件linearGradient参数设置为ARKUI_LINEAR_GRADIENT_DIRECTION_NONE时的显示效果测试 + it('testScrollLinearGradient009', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollLinearGradientNoneTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollNestedScrollTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollNestedScrollTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8af1eec8147356ea5783f85928bfaf699902565 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollNestedScrollTest.test.ets @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import { Driver } from '@ohos.UiTest'; +import WindowSnap from '../common/Snap'; + +async function doIt(pageTag: string, testType: number, X: number, Y: number, done: Function) { + Utils.emitEvent(pageTag, testType, 6600) + Utils.clickComponent('resetButton') + await Utils.sleep(2000) + Utils.clickComponent('clearDataButton') + await Utils.sleep(2000) + let driver = Driver.create(); + if (testType > 4) { + await driver.swipe(X, Y - 50, X, Y + 50); + } else { + await driver.swipe(X, Y + 50, X, Y - 50); + } + await Utils.sleep(2000) + Utils.clickComponent('compareButton') + await Utils.sleep(2000) + done() +} + +export default function scrollNestedScrollTest() { + + describe('ScrollNestedScrollTest', () => { + + let PAGE_TAG = 'ScrollNestedScrollTest'; + let X = 0; + let Y = 0; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + let webRect = Utils.getComponentRect('nestedScrollRoot'); + X = Utils.getRectHorizontalCenterX(webRect) + Y = Utils.getRectVerticalCenterY(webRect) + }); + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Scroll组件调用capi设置nestedScroll为scrollForward:ARKUI_SCROLL_NESTED_MODE_SELF_ONLY,向尾端滚动时仅子组件自身滚动的场景 + it('testScrollNestedScroll001', 0, async (done: Function) => { + doIt(PAGE_TAG, 1, X, Y, done) + }) + + //Scroll组件调用capi设置nestedScroll为scrollForward:ARKUI_SCROLL_NESTED_MODE_SELF_FIRST,向尾端滚动时子组件先滚动的场景 + it('testScrollNestedScroll002', 0, async (done: Function) => { + doIt(PAGE_TAG, 2, X, Y, done) + }) + + //Scroll组件调用capi设置nestedScroll为scrollForward:ARKUI_SCROLL_NESTED_MODE_PARENT_FIRST,向尾端滚动时父组件先滚动的场景 + it('testScrollNestedScroll003', 0, async (done: Function) => { + doIt(PAGE_TAG, 3, X, Y, done) + }) + + //Scroll组件调用capi设置nestedScroll为scrollForward:ARKUI_SCROLL_NESTED_MODE_PARALLEL,向尾端滚动时父子组件同时滚动的场景 + it('testScrollNestedScroll004', 0, async (done: Function) => { + doIt(PAGE_TAG, 4, X, Y, done) + }) + + //Scroll组件调用capi设置nestedScroll为scrollBackward:ARKUI_SCROLL_NESTED_MODE_SELF_ONLY,向首端滚动时仅子组件自身滚动的场景 + it('testScrollNestedScroll005', 0, async (done: Function) => { + doIt(PAGE_TAG, 5, X, Y, done) + }) + + //Scroll组件调用capi设置nestedScroll为scrollBackward:ARKUI_SCROLL_NESTED_MODE_SELF_FIRST,向首端滚动时子组件先滚动的场景 + it('testScrollNestedScroll006', 0, async (done: Function) => { + doIt(PAGE_TAG, 6, X, Y, done) + }) + + //Scroll组件调用capi设置nestedScroll为scrollBackward:ARKUI_SCROLL_NESTED_MODE_PARENT_FIRST,向首端滚动时父组件先滚动的场景 + it('testScrollNestedScroll007', 0, async (done: Function) => { + doIt(PAGE_TAG, 7, X, Y, done) + }) + + //Scroll组件调用capi设置nestedScroll为scrollBackward:ARKUI_SCROLL_NESTED_MODE_PARALLEL,向首端滚动时父子组件同时滚动的场景 + it('testScrollNestedScroll008', 0, async (done: Function) => { + doIt(PAGE_TAG, 8, X, Y, done) + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnAppearTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnAppearTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2b24da946907fd55bef2b3d56c0f10c5e69800a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnAppearTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollOnAppearTest() { + + describe('ScrollOnAppearTest', () => { + + let PAGE_TAG = 'ScrollOnAppearTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件调用capi设置onAppear正常触发的场景 + it('testScrollOnAppear001', 0, async (done: Function) => { + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollEdgeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollEdgeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d558da484a1c9d5d721504c17b9285117021588c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollEdgeTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollOnScrollEdgeTest() { + + describe('ScrollOnScrollEdgeTest', () => { + + let PAGE_TAG = 'ScrollOnScrollEdgeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件调用capi设置onScrollEdge正常触发的场景 + it('testScrollOnScrollEdge001', 0, async (done: Function) => { + await Utils.flingComponent('scrollCalled', false, true); + await Utils.sleep(2000); + done() + }) + + // Scroll组件调用capi设置onScrollEdge不触发的场景 + it('testScrollOnScrollEdge002', 0, async (done: Function) => { + await Utils.flingComponent('scrollNotCalled', true, true); + await Utils.sleep(2000); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollFrameBeginTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollFrameBeginTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..34e54b85ec285852a85bfc1943192f91460ea1d7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollFrameBeginTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollOnScrollFrameBeginTest() { + + describe('ScrollOnScrollFrameBeginTest', () => { + + let PAGE_TAG = 'ScrollOnScrollFrameBeginTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件调用capi设置onScrollFrameBegin正常触发的场景 + it('testScrollOnScrollFrameBegin001', 0, async (done: Function) => { + await Utils.flingComponent('scrollCalled', false, true); + await Utils.sleep(2000); + done() + }) + + // Scroll组件调用capi设置onScrollFrameBegin不触发的场景 + it('testScrollOnScrollFrameBegin002', 0, async (done: Function) => { + await Utils.flingComponent('scrollNotCalled', true, true); + await Utils.sleep(2000); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollStartTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollStartTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..245370668d9cc49cd41200fa369c7d11a99605ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollStartTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollOnScrollStartTest() { + + describe('ScrollOnScrollStartTest', () => { + + let PAGE_TAG = 'ScrollOnScrollStartTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件调用capi设置onScrollStart正常触发的场景 + it('testScrollOnScrollStart001', 0, async (done: Function) => { + await Utils.flingComponent('scrollCalled', false, true); + await Utils.sleep(2000); + done() + }) + + // Scroll组件调用capi设置onScrollStart不触发的场景 + it('testScrollOnScrollStart002', 0, async (done: Function) => { + await Utils.flingComponent('scrollNotCalled', true, true); + await Utils.sleep(2000); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollStopTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollStopTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed389e0b15e13ecb69710062eedd5add34b108c5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollStopTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollOnScrollStopTest() { + + describe('ScrollOnScrollStopTest', () => { + + let PAGE_TAG = 'ScrollOnScrollStopTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件调用capi设置onScrollStop正常触发的场景 + it('testScrollOnScrollStop001', 0, async (done: Function) => { + await Utils.flingComponent('scrollCalled', false, true); + await Utils.sleep(2000); + done() + }) + + // Scroll组件调用capi设置onScrollStop不触发的场景 + it('testScrollOnScrollStop002', 0, async (done: Function) => { + await Utils.flingComponent('scrollNotCalled', true, true); + await Utils.sleep(2000); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bade723657680e5d2e4bca3587f4ba4228c65ac9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOnScrollTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollOnScrollTest() { + + describe('ScrollOnScrollTest', () => { + + let PAGE_TAG = 'ScrollOnScrollTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件调用capi设置onScroll正常触发的场景 + it('testScrollOnScroll001', 0, async (done: Function) => { + await Utils.flingComponent('scrollCalled', false, true); + await Utils.sleep(2000); + done() + }) + + // Scroll组件调用capi设置onScroll不触发的场景 + it('testScrollOnScroll002', 0, async (done: Function) => { + await Utils.flingComponent('scrollNotCalled', true, true); + await Utils.sleep(2000); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOpacityTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOpacityTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..43b916769dc0aab1da88a7d5ea979d37849404e0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOpacityTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollOpacityTest() { + + describe('ScrollOpacityTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件opacity参数设置为0时的显示效果测试 + it('testScrollOpacity001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOpacityMinTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件opacity参数设置为1时的显示效果测试 + it('testScrollOpacity002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOpacityMaxTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件opacity参数设置为0.5时的显示效果测试 + it('testScrollOpacity003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOpacityMiddleTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件opacity参数设置为1000时的显示效果测试 + it('testScrollOpacity004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOpacityAbnormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOverlayTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOverlayTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..80e8e22984c775447499bc13b35102915503ee5f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollOverlayTest.test.ets @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollOverlayTest() { + + describe('ScrollOverlayTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件overlay参数设置为ARKUI_ALIGNMENT_TOP时的显示效果测试 + it('testScrollOverlay001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOverlayTopTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件overlay参数设置为ARKUI_ALIGNMENT_TOP_START时的显示效果测试 + it('testScrollOverlay002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOverlayTopStartTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件overlay参数设置为ARKUI_ALIGNMENT_START时的显示效果测试 + it('testScrollOverlay003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOverlayStartTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件overlay参数设置为ARKUI_ALIGNMENT_TOP_END时的显示效果测试 + it('testScrollOverlay004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOverlayTopEndTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件overlay参数设置为ARKUI_ALIGNMENT_CENTER时的显示效果测试 + it('testScrollOverlay005', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOverlayCenterTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件overlay参数设置为ARKUI_ALIGNMENT_END时的显示效果测试 + it('testScrollOverlay006', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOverlayEndTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件overlay参数设置为ARKUI_ALIGNMENT_BOTTOM_START时的显示效果测试 + it('testScrollOverlay007', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOverlayBottomStartTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件overlay参数设置为ARKUI_ALIGNMENT_BOTTOM时的显示效果测试 + it('testScrollOverlay008', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOverlayBottomTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件overlay参数设置为ARKUI_ALIGNMENT_BOTTOM_END时的显示效果测试 + it('testScrollOverlay009', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollOverlayBottomEndTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollPageEnableTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollPageEnableTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3cf8ac7e4a24517990d300fa4d74589bbb0416b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollPageEnableTest.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; +import { Driver } from '@ohos.UiTest'; + +export default function scrollPageEnableTest() { + + describe('ScrollPageEnableTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件pageEnable属性设置为true时的显示效果测试 + it('testScrollPageEnable001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollPageEnableTrueTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + let driver = Driver.create(); + let rect = Utils.getComponentRect('Scroll'); + let X = Utils.getRectHorizontalCenterX(rect) + let Y = Utils.getRectVerticalCenterY(rect); + driver.swipe(X, Y, X, Y - 300); + done(); + }) + + // Scroll组件pageEnable属性设置为false时的显示效果测试 + it('testScrollPageEnable002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollPageEnableFalseTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + let driver = Driver.create(); + let rect = Utils.getComponentRect('Scroll'); + let X = Utils.getRectHorizontalCenterX(rect) + let Y = Utils.getRectVerticalCenterY(rect); + driver.swipe(X, Y, X, Y - 300); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollPositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollPositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5755d7bf81c4a4e0b582633fe3e61532d4c627b3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollPositionTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollPositionTest() { + + describe('ScrollPositionTest', () => { + + let PAGE_TAG = 'ScrollPositionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Scroll组件position参数分别设置为{10,10},{-10,-10}时的显示效果测试 + it('testScrollPosition001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollRotateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollRotateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b174d35db3e048deea2481a8875908f5f82955dd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollRotateTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollRotateTest() { + + describe('ScrollRotateTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件rotate参数设置为(0,0,0,0,0)时的显示效果测试 + it('testScrollRotate001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollRotateTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件rotate参数设置为(10,10,10,10,10)时的显示效果测试 + it('testScrollRotate002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollRotateNormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件rotate参数设置为(10,0,0,-1000,0)时的显示效果测试 + it('testScrollRotate003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollRotateAbNormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollSaturateTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollSaturateTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d75771810dbbccda226977594aaa9b5d5482f4b3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollSaturateTest.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollSaturateTest() { + + describe('ScrollSaturateTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件saturate参数设置为1.0时的显示效果测试 + it('testScrollSaturate001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollSaturateDefaultTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件saturate参数设置为0时的显示效果测试 + it('testScrollSaturate002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollSaturateMinTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件saturate参数设置为FLT_MAX时的显示效果测试 + it('testScrollSaturate003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollSaturateMaxTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件saturate参数设置为3时的显示效果测试 + it('testScrollSaturate004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollSaturateNormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScaleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScaleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c0d0175b302827ea782d4c5f38561830987a2e4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScaleTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollScaleTest() { + + describe('ScrollScaleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件scale参数设置为(1, 1)时的显示效果测试 + it('testScrollScale001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScaleTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件scale参数设置为(0.5, 0.5)时的显示效果测试 + it('testScrollScale002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScaleNormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件scale参数设置为(-1, -1)时的显示效果测试 + it('testScrollScale003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScaleAbNormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollAbleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollAbleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..56fb64ef4fb75cba2320e3a11a96240fdb8a505a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollAbleTest.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollScrollAbleTest() { + + describe('ScrollScrollAbleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件scrollable参数设置为ARKUI_SCROLL_DIRECTION_VERTICAL时的显示效果测试 + it('testScrollScrollable001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollAbleTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件scrollable参数设置为1000时的显示效果测试 + it('testScrollScrollable002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollAbleAbnormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件scrollable参数设置为ARKUI_SCROLL_DIRECTION_NONE时的显示效果测试 + it('testScrollScrollable003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollAbleHorizontalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件scrollable参数设置为1000时的显示效果测试 + it('testScrollScrollable004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollAbleNoneTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollBarColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollBarColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cbd39398b17509189ed0a0c5dfb616e079ee9d94 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollBarColorTest.test.ets @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollScrollBarColorTest() { + + describe('ScrollScrollBarColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件scrollbarColor参数设置为0xff00ff00时的显示效果测试 + it('testScrollScrollBarColor001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollBarColorTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件scrollbarColor参数设置为黑色时的显示效果测试 + it('testScrollScrollBarColor002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollBarColorBlackTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.sleep(2000) + done(); + }) + + // Scroll组件scrollbarColor参数设置为白色时的显示效果测试 + it('testScrollScrollBarColor003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollBarColorWhiteTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.sleep(2000) + done(); + }) + + // Scroll组件scrollbarColor参数设置为napi_null时的显示效果测试 + it('testScrollScrollBarColor004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollBarColorNullTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done() + }) + + //Scroll组件scrollbarColor参数设置为napi_undefined时的显示效果测试 + it('testScrollScrollBarColor005', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollBarColorUndefinedTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollBarTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollBarTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a822055194c1df38668c5a7e0d5d395c305c4f14 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollBarTest.test.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollScrollBarTest() { + + describe('ScrollScrollBarTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件scrollbar参数设置为ARKUI_SCROLL_BAR_DISPLAY_MODE_ON时的显示效果测试 + it('testScrollScrollbar001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollBarOnTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件scrollbar参数设置为ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO时的显示效果测试 + it('testScrollScrollbar002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollBarAutoTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollBarAuto', false, true); + done(); + }) + + // Scroll组件scrollbar参数设置为ARKUI_SCROLL_BAR_DISPLAY_MODE_OFF时的显示效果测试 + it('testScrollScrollbar003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollBarOffTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件scrollbar参数设置为1000时的显示效果测试 + it('testScrollScrollbar004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollBarAbnormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollEdgeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollEdgeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..73c72ba9ff6a77c3c17b1f0776ba670fe64a7f28 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollEdgeTest.test.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollScrollEdgeTest() { + + describe('ScrollScrollEdgeTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件调用capi设置入参为ARKUI_SCROLL_EDGE_TOP,scrollEdge正常触发的场景 + it('testScrollScrollEdge001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollEdgeTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.clickComponent('ScrollEdgeButton'); + await Utils.sleep(2000); + done() + }) + + // Scroll组件调用capi设置入参为ARKUI_SCROLL_EDGE_BOTTOM,scrollEdge正常触发的场景 + it('testScrollScrollEdge002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollEdgeBottomTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.clickComponent('ScrollEdgeButton'); + await Utils.sleep(2000); + done() + }) + + // Scroll组件调用capi设置入参为ARKUI_SCROLL_EDGE_START,scrollEdge正常触发的场景 + it('testScrollScrollEdge003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollEdgeStartTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.clickComponent('ScrollEdgeButton'); + await Utils.sleep(2000); + done() + }) + + // Scroll组件调用capi设置入参为ARKUI_SCROLL_EDGE_END,scrollEdge正常触发的场景 + it('testScrollScrollEdge004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollEdgeEndTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.clickComponent('ScrollEdgeButton'); + await Utils.sleep(2000); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollSnapTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollSnapTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c1720827632ddf30bfcae9fe373636533ab26fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollSnapTest.test.ets @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; +import { Driver } from '@ohos.UiTest'; + +export default function scrollScrollSnapTest() { + + describe('ScrollScrollSnapTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件scrollSnap参数设置为ARKUI_SCROLL_SNAP_ALIGN_NONE时的显示效果测试 + it('testScrollScrollSnap001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollSnapNoneTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + let X = 0; + let Y = 0; + let scrollRect = Utils.getComponentRect('ScrollSnap'); + X = Utils.getRectHorizontalCenterX(scrollRect) + Y = Utils.getRectVerticalCenterY(scrollRect) + let driver = Driver.create(); + await driver.swipe(X, Y + 50, X, Y - 50); + await Utils.sleep(3000) + done(); + }) + + // Scroll组件scrollSnap参数设置为ARKUI_SCROLL_SNAP_ALIGN_START时的显示效果测试 + it('testScrollScrollSnap002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollSnapStartTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + let X = 0; + let Y = 0; + let scrollRect = Utils.getComponentRect('ScrollSnap'); + X = Utils.getRectHorizontalCenterX(scrollRect) + Y = Utils.getRectVerticalCenterY(scrollRect) + let driver = Driver.create(); + await driver.swipe(X, Y + 50, X, Y - 50); + await Utils.sleep(3000) + done(); + }) + + // Scroll组件scrollSnap参数设置为ARKUI_SCROLL_SNAP_ALIGN_CENTER时的显示效果测试 + it('testScrollScrollSnap003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollSnapCenterTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + let X = 0; + let Y = 0; + let scrollRect = Utils.getComponentRect('ScrollSnap'); + X = Utils.getRectHorizontalCenterX(scrollRect) + Y = Utils.getRectVerticalCenterY(scrollRect) + let driver = Driver.create(); + await driver.swipe(X, Y + 50, X, Y - 50); + await Utils.sleep(3000) + done(); + }) + + // Scroll组件scrollSnap参数设置为ARKUI_SCROLL_SNAP_ALIGN_END时的显示效果测试 + it('testScrollScrollSnap004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollSnapEndTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + let X = 0; + let Y = 0; + let scrollRect = Utils.getComponentRect('ScrollSnap'); + X = Utils.getRectHorizontalCenterX(scrollRect) + Y = Utils.getRectVerticalCenterY(scrollRect) + let driver = Driver.create(); + await driver.swipe(X, Y + 50, X, Y - 50); + await Utils.sleep(3000) + done(); + }) + + // Scroll组件scrollSnap参数设置为-10时的显示效果测试 + it('testScrollScrollSnap005', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollSnapLowerAbnormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + let X = 0; + let Y = 0; + let scrollRect = Utils.getComponentRect('ScrollSnap'); + X = Utils.getRectHorizontalCenterX(scrollRect) + Y = Utils.getRectVerticalCenterY(scrollRect) + let driver = Driver.create(); + await driver.swipe(X, Y + 50, X, Y - 50); + await Utils.sleep(3000) + done(); + }) + + // Scroll组件scrollSnap参数设置为10时的显示效果测试 + it('testScrollScrollSnap006', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollSnapUpperAbnormalTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + let X = 0; + let Y = 0; + let scrollRect = Utils.getComponentRect('ScrollSnap'); + X = Utils.getRectHorizontalCenterX(scrollRect) + Y = Utils.getRectVerticalCenterY(scrollRect) + let driver = Driver.create(); + await driver.swipe(X, Y + 50, X, Y - 50); + await Utils.sleep(3000) + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollToTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollToTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b955571bcc041511a90c98057e959127e6aaefb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollScrollToTest.test.ets @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollScrollToTest() { + + describe('ScrollScrollToTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_LINEAR时的显示效果测试 + it('testScrollScrollTo001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToLinearTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToLinearTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_EASE时的显示效果测试 + it('testScrollScrollTo002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToEaseTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToEaseTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_EASE_IN时的显示效果测试 + it('testScrollScrollTo003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToEaseInTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToEaseInTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_EASE_OUT时的显示效果测试 + it('testScrollScrollTo004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToEaseOutTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToEaseOutTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_EASE_IN_OUT时的显示效果测试 + it('testScrollScrollTo005', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToEaseInOutTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToEaseInOutTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_FAST_OUT_SLOW_IN时的显示效果测试 + it('testScrollScrollTo006', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToFastOutSlowInTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToFastOutSlowInTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_LINEAR_OUT_SLOW_IN时的显示效果测试 + it('testScrollScrollTo007', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToLinearOutSlowInTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToLinearOutSlowInTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_FAST_OUT_LINEAR_IN时的显示效果测试 + it('testScrollScrollTo008', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToFastOutLinearInTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToFastOutLinearInTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_EXTREME_DECELERATION时的显示效果测试 + it('testScrollScrollTo009', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToExtremeDecelerationTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToExtremeDecelerationTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_SHARP时的显示效果测试 + it('testScrollScrollTo010', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToSharpTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToSharpTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_RHYTHM时的显示效果测试 + it('testScrollScrollTo011', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToRhythmTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToRhythmTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_SMOOTH时的显示效果测试 + it('testScrollScrollTo012', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToSmoothTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToSmoothTest', false, true); + done(); + }) + + // Scroll组件scrollTo参数设置为ARKUI_CURVE_FRICTION时的显示效果测试 + it('testScrollScrollTo013', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollScrollToFrictionTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + await Utils.flingComponent('ScrollScrollToFrictionTest', false, true); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollShadowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollShadowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e8c862ae17099df9e4919160ee7384b233324cd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollShadowTest.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollShadowTest() { + + describe('ScrollShadowTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS时的显示效果测试 + it('testScrollShadow001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollShadowMinTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG时的显示效果测试 + it('testScrollShadow002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollShadowBigTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM时的显示效果测试 + it('testScrollShadow003', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollShadowLittleTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD时的显示效果测试 + it('testScrollShadow004', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollShadowMiddleTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD时的显示效果测试 + it('testScrollShadow005', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollShadowFloatMiddleTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件shadow参数设置为ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM时的显示效果测试 + it('testScrollShadow006', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollShadowFloatLittleTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollTranslateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollTranslateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fc971a8b9c39c1f212b4a6fbe2152b922f78da47 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollTranslateTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollTranslateTest() { + + describe('ScrollTranslateTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Scroll组件translate参数设置为(0,10, 10)时的显示效果测试 + it('testScrollTranslate001', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollTranslateTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + + // Scroll组件translate参数设置为(0, 0, 0)时的显示效果测试 + it('testScrollTranslate002', 0, async (done: Function) => { + let PAGE_TAG = 'ScrollTranslateDefaultTest'; + await Utils.pushPage(`scroll/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0aa6577d74f6df31216b41b777afb24ab7a22a5f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/scroll/ScrollWidthTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function scrollWidthTest() { + + describe('ScrollWidthTest', () => { + + let PAGE_TAG = 'ScrollWidthTest'; + let PAGE_TAG_LARGE = 'ScrollWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Scroll组件width参数分别设置为300、-100时的显示效果测试 + it('testScrollWidth001', 0, async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG}`, done); + }); + + //Scroll组件width参数设置为10000,超出父控件时的显示效果测试 + it('testScrollWidth002', 0, async (done: Function) => { + await Utils.pushPage(`scroll/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderBlockColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderBlockColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea0b64cf8fe0a17115996ec271c0c56dabbd5727 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderBlockColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderBlockColorTest() { + + describe('SliderBlockColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + *测试滑块颜色的三种正常场景: + *1.blockColor属性设置为红色 + *2.将blockColor属性设置为蓝色,并将滑块类型设置为图片效果 + *3.将blockColor属性设置为绿色,并将滑块类型设置为矩形*/ + it('testSliderBlockColor001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderBlockColorTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderBlockStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderBlockStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..949d4c7953b94d8eedad4c89796000b13539f64e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderBlockStyleTest.test.ets @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderBlockStyleTest() { + + describe('SliderBlockStyleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + *滑块效果的6种正常场景: + *1.默认效果 + *2.blockStyle属性设置为图片效果 + *3.blockStyle属性设置为矩形滑块效果 + *4.blockStyle属性设置为圆形滑块效果 + *5.blockStyle属性椭圆形滑块效果 + *6.blockStyle属性路径滑块效果*/ + it('testSliderBlockStyle001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderBlockStyleTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + /* + *滑块效果的5种异常场景: + *1.blockStyle属性设置为图片效果,图片路径为空 + *2.blockStyle属性矩形滑块效果,长度均为负值 + *3.blockStyle属性圆形滑块效果,长度均为负值 + *4.blockStyle属性椭圆形滑块效果,长度均为负值 + *5.blockStyle属性路径滑块效果,长度均为负值,路径命令为空*/ + it('testSliderBlockStyle002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderBlockStyleAbnormalTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderDirectionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderDirectionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6ec6fb2eb8f266d9e8f89d4a91cf567622ed60c7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderDirectionTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderDirectionTest() { + + describe('SliderDirectionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + *滑动条滑动方向的3种正常场景: + *1.direction属性设置为默认方向 + *2.direction属性设置为垂直方向 + *3.direction属性设置为水平方向*/ + it('testSliderDirection001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderDirectionTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条direction属性的异常场景 + it('testSliderDirection002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderDirectionAbnormalTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderEnabledTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderEnabledTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..11ef86e4b28f2443dfe3788ad5a3f6ae542f1900 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderEnabledTest.test.ets @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { beforeAll, describe, afterEach, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderEnabledTest() { + + describe('SliderEnabledTest', () => { + + let PAGE_TAG = 'SliderEnabledTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }) + + //Slider组件enabled参数设置为true时的显示效果测试 + it('testSliderEnabled001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickEnabledSlider') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickEnabledSlider') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickAbnormalSlider') + await Utils.sleep(1000) + done(); + }) + + //Slider组件enabled参数设置为false时的显示效果测试 + it('testSliderEnabled002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickDisabledSlider') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickDisabledSlider') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickEnabledSlider') + await Utils.sleep(1000) + done(); + }) + + //Slider组件enabled参数设置为-1时的显示效果测试 + it('testSliderEnabled003', 0, async (done: Function) => { + await Utils.clickComponent('OnClickAbnormalSlider') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickAbnormalSlider') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickEnabledSlider') + await Utils.sleep(1000) + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ca1972989beb2015e7a8c169a0d630ea9557b02 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderHeightTest() { + + describe('SliderHeightTest', () => { + + let PAGE_TAG = 'SliderHeightTest'; + let PAGE_TAG_LARGE = 'SliderHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Slider组件height参数分别设置为20、-50时的显示效果测试 + it('testSliderHeight001', 0, async (done: Function) => { + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + }); + + //Slider组件height参数设置为500,超出父控件时的显示效果测试 + it('testSliderHeight002', 0, async (done: Function) => { + await Utils.pushPage(`slider/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderMaxTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderMaxTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8bf41ffad2e5a430c6b0a3557f1718f0fd156090 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderMaxTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderMaxTest() { + + describe('SliderMaxTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 滑动条max属性的正常场景 + it('testSliderMax001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderMaxTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条max属性设为负值的异常场景 + it('testSliderMax002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderMaxAbnormalTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条max属性设为较大值的正常场景 + it('testSliderMax003', 0, async (done: Function) => { + let PAGE_TAG = 'SliderMaxLargeTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条min=max的正常场景 + it('testSliderMax004', 0, async (done: Function) => { + let PAGE_TAG = 'SliderMaxEqualMinTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderMinTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderMinTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..82977d0e1f63a62ed4144e65c5cc0f7a7a1632b0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderMinTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderMinTest() { + + describe('SliderMinTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 滑动条min属性的正常场景 + it('testSliderMin001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderMinTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条min属性设为负值异常场景 + it('testSliderMin002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderMinAbnormalTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条min属性设为较大值的正常场景 + it('testSliderMin003', 0, async (done: Function) => { + let PAGE_TAG = 'SliderMinLargeTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderOnChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderOnChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..026ea23fa7f5d594928542d7885b0ea5dbc425de --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderOnChangeTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderOnChangeTest() { + + describe('SliderOnChangeTest', () => { + + let PAGE_TAG = 'SliderOnChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }) + + // Slider组件触发onChange事件回调时的显示场景 + it('testSliderOnChange001', 0, async (done: Function) => { + await Utils.clickComponent('OnChangeSlider') + await Utils.sleep(5000); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderReverseTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderReverseTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c63dfe52d7073b25d919aa1435d334c135921d8c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderReverseTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderReverseTest() { + + describe('SliderReverseTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 滑动条reverse属性的正常场景 + it('testSliderReverse001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderReverseTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条reverse属性设为负值的异常场景 + it('testSliderReverse002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderReverseAbnormalTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条reverse属性设为超范围值的异常场景 + it('testSliderReverse003', 0, async (done: Function) => { + let PAGE_TAG = 'SliderReverseLargeTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderSelectedColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderSelectedColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d6cc07c8943c5fac1d8b7783fb36566cf7d10896 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderSelectedColorTest.test.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderSelectedColorTest() { + + describe('SliderSelectedColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 滑动条selectedColor属性的正常场景 + it('testSliderSelectedColor001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderSelectedColorTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderShowstepsTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderShowstepsTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9cc2ba24605a63392774a3c1aa50036e03d475d5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderShowstepsTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderShowStepsTest() { + + describe('SliderShowStepsTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 滑动条showSteps属性的正常场景 + it('testSliderShowSteps001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderShowStepsTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条showSteps属性的异常场景 + it('testSliderShowSteps002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderShowStepsAbnormalTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderStepTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderStepTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..22d345ef3c51d6eeac7eb1b233b919fd329d6f77 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderStepTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderStepTest() { + + describe('SliderStepTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 滑动条step属性的正常场景 + it('testSliderStep001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderStepTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条step属性设为负值和较小单位的异常场景 + it('testSliderStep002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderStepAbnormalTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条step属性超范围值的异常场景 + it('testSliderStep003', 0, async (done: Function) => { + let PAGE_TAG = 'SliderStepLargeTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条step属性30,总长范围100场景 + it('testSliderStep004', 0, async (done: Function) => { + let PAGE_TAG = 'SliderStepUnevenTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b310e73ce05f843c7a4c9ee9e221b3e3548b4f2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderStyleTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderStyleTest() { + + describe('SliderStyleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 滑动条style属性的正常场景 + it('testSliderStyle001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderStyleTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条style属性设为负值的异常场景 + it('testSliderStyle002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderStyleAbnormalTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条style属性设为超范围值的异常场景 + it('testSliderStyle003', 0, async (done: Function) => { + let PAGE_TAG = 'SliderStyleLargeTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderTrackColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderTrackColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca28170e6f09aa4bd49c445b97cbab6e199fd593 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderTrackColorTest.test.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderTrackColorTest() { + + describe('SliderTrackColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 滑动条trackColor属性的正常场景 + it('testSliderTrackColor001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderTrackColorTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderValueTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderValueTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b68b5fea0f1ad0a45d272efc008861db749017b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderValueTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderValueTest() { + + describe('SliderValueTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // 滑动条value属性的正常场景 + it('testSliderValue001', 0, async (done: Function) => { + let PAGE_TAG = 'SliderValueTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条value属性设为负值的异常场景 + it('testSliderValue002', 0, async (done: Function) => { + let PAGE_TAG = 'SliderValueAbnormalTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + + // 滑动条value属性设为超范围值的异常场景 + it('testSliderValue003', 0, async (done: Function) => { + let PAGE_TAG = 'SliderValueLargeTest'; + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d5e88440a24cf1ecac72bf6831a44e8da181613a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/slider/SliderWidthTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function sliderWidthTest() { + + describe('SliderWidthTest', () => { + + let PAGE_TAG = 'SliderWidthTest'; + let PAGE_TAG_LARGE = 'SliderWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Slider组件width参数分别设置为300、-100时的显示效果测试 + it('testSliderWidth001', 0, async (done: Function) => { + await Utils.pushPage(`slider/${PAGE_TAG}`, done); + }); + + //Slider组件width参数设置为500,超出父控件时的显示效果测试 + it('testSliderWidth002', 0, async (done: Function) => { + await Utils.pushPage(`slider/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanDecorationTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanDecorationTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd3fcbadc3d12461a4499c6a0c63f5c28c676bb4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanDecorationTest.test.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function spanDecorationTest() { + + describe('SpanDecorationTest', () => { + + let PAGE_TAG = 'SpanDecorationTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`span/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /*Span组件decoration参数分别设置为(1) + decorationType:ARKUI_TEXT_DECORATION_TYPE_NONE + color:0x00000000 + (2) + decorationType:ARKUI_TEXT_DECORATION_TYPE_UNDERLINE + color:0xFFFF0000 + (3) + decorationType:ARKUI_TEXT_DECORATION_TYPE_OVERLINE + color:0xFF000000 + (4) + decorationType:ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH + color:0xFFFFFFFF + (5) + decorationType:-1 + color:0xFF000000时的显示效果测试*/ + it('testSpanDecoration001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1de70f0c1772be03d1ccd1f956862363fa2dc5ab --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function spanFontColorTest() { + + describe('SpanFontColorTest', () => { + + let PAGE_TAG = 'SpanFontColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`span/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Span组件fontColor参数分别设置为0x0000,0xFFFF0000,0xFFFFFFFF时的显示效果测试 + it('testSpanFontColor001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontSizeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontSizeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c181f0933c4c7395a9509dfddbd5b6fceddd953e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontSizeTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function spanFontSizeTest() { + + describe('SpanFontSizeTest', () => { + + let PAGE_TAG = 'SpanFontSizeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`span/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Span组件fontSize参数分别设置为10,-1,100时的显示效果测试 + it('testSpanFontSize001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..357162490aff55cfc4574a254b632977c6ece6b5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontStyleTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function spanFontStyleTest() { + + describe('SpanFontStyleTest', () => { + + let PAGE_TAG = 'SpanFontStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`span/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Span组件fontStyle参数分别设置为ARKUI_FONT_STYLE_NORMAL,ARKUI_FONT_STYLE_ITALIC,-1时的显示效果测试 + it('testSpanFontStyle001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontWeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontWeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b6aa05c1165dc0a781c7093f63f2b8c1d971cf52 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanFontWeightTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function spanFontWeightTest() { + + describe('SpanFontWeightTest', () => { + + let PAGE_TAG = 'SpanFontWeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`span/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*ImageSpan组件fontWeight参数分别设置为 + ARKUI_FONT_WEIGHT_W100, + ARKUI_FONT_WEIGHT_W200 , + ARKUI_FONT_WEIGHT_W300, + ARKUI_FONT_WEIGHT_W400, + ARKUI_FONT_WEIGHT_W500, + ARKUI_FONT_WEIGHT_W600 , + ARKUI_FONT_WEIGHT_W700, + ARKUI_FONT_WEIGHT_W800, + ARKUI_FONT_WEIGHT_W900, + ARKUI_FONT_WEIGHT_BOLD , + ARKUI_FONT_WEIGHT_NORMAL, + ARKUI_FONT_WEIGHT_BOLDER, + ARKUI_FONT_WEIGHT_LIGHTER, + ARKUI_FONT_WEIGHT_MEDIUM , + ARKUI_FONT_WEIGHT_REGULAR, + -1时的显示效果测试 + */ + it('testSpanFontWeight001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanLetterSpacingTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanLetterSpacingTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e175903e3b67dc4c4c257f581cf2599d19ad8e7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanLetterSpacingTest.test.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function spanLetterSpacingTest() { + + describe('SpanLetterSpacingTest', () => { + + let PAGE_TAG = 'SpanLetterSpacingTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`span/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + //Span组件letterSpacing参数分别设置为3,0,-1时的显示效果测试 + it('testSpanLetterSpacing001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanLineHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanLineHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..82a9541dced3428592cfc4df4c0c5a101ea621de --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanLineHeightTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function spanLineHeightTest() { + + describe('SpanLineHeightTest', () => { + + let PAGE_TAG = 'SpanLineHeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`span/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Span组件lineHeight参数分别设置为100,0,-100时的显示效果测试 + it('testSpanLineHeight001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanTextCaseTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanTextCaseTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ac308f5f06cb9816a0518a65f17c0fdb4c3a26cf --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/span/SpanTextCaseTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function spanTextCaseTest() { + + describe('SpanTextCaseTest', () => { + + let PAGE_TAG = 'SpanTextCaseTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`span/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + /*Span组件textCase参数分别设置为ARKUI_TEXT_CASE_NORMAL、ARKUI_TEXT_CASE_LOWER、ARKUI_TEXT_CASE_UPPER、-1时 + 的显示效果测试*/ + it('testSpanTextCase001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackAlignTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackAlignTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fce3dcaf3f789b9d5c4eddae7ec104697a4a162 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackAlignTest.test.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackAlignTest() { + + describe('StackAlignTest', () => { + + let PAGE_TAG = 'StackAlignTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Stack组件align参数分别设置为 + ARKUI_ALIGNMENT_TOP_START, + ARKUI_ALIGNMENT_TOP, + ARKUI_ALIGNMENT_TOP_END, + ARKUI_ALIGNMENT_START, + ARKUI_ALIGNMENT_CENTER, + ARKUI_ALIGNMENT_END, + ARKUI_ALIGNMENT_BOTTOM_START, + ARKUI_ALIGNMENT_BOTTOM, + ARKUI_ALIGNMENT_BOTTOM_END, + -1时的显示效果测试 + */ + it('testStackAlign001', 0, async (done: Function) => { + await Utils.sleep(2000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundBlurStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundBlurStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..43f426d82ba61d1b1daa05be5702f19eedc7a075 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundBlurStyleTest.test.ets @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackBackgroundBlurStyleTest() { + + describe('StackBackgroundBlurStyleTest', () => { + + let PAGE_TAG = 'StackBackgroundBlurStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Stack组件backgroundBlurStyle参数分别设置为 + (1) + 模糊类型:ARKUI_BLUR_STYLE_THIN + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (2) + 模糊类型:ARKUI_BLUR_STYLE_REGULAR + 深浅色模式:ARKUI_COLOR_MODE_LIGHT + 取色模式:ARKUI_ADAPTIVE_COLOR_AVERAGE + 模糊效果程度:0.5 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:50 + (3) + 模糊类型:ARKUI_BLUR_STYLE_THICK + 深浅色模式:ARKUI_COLOR_MODE_DARK + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:1.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:127 + (4) + 模糊类型:ARKUI_BLUR_STYLE_BACKGROUND_THIN + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (5) + 模糊类型:ARKUI_BLUR_STYLE_BACKGROUND_REGULAR + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (6) + 模糊类型:ARKUI_BLUR_STYLE_BACKGROUND_THICK + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (7) + 模糊类型:ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (8) + 模糊类型:ARKUI_BLUR_STYLE_NONE + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (9) + 模糊类型:ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (10) + 模糊类型:ARKUI_BLUR_STYLE_COMPONENT_THIN + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (11) + 模糊类型:ARKUI_BLUR_STYLE_COMPONENT_REGULAR + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (12) + 模糊类型:ARKUI_BLUR_STYLE_COMPONENT_THICK + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (13) + 模糊类型:ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK + 深浅色模式:ARKUI_COLOR_MODE_SYSTEM + 取色模式:ARKUI_ADAPTIVE_COLOR_DEFAULT + 模糊效果程度:0.0 + 灰阶模糊起始边界:0.0 + 灰阶模糊终点边界:0.0 + (14) + 模糊类型:-1 + 深浅色模式:-1 + 取色模式:-1 + 模糊效果程度:-1 + 灰阶模糊起始边界:-1 + 灰阶模糊终点边界:128 + 时的显示效果测试 + */ + it('testStackBackgroundBlurStyle001', 0, async (done: Function) => { + await Utils.sleep(10000) + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1cc11b3f370a30c05aa3f929e4a1a627d436f6f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackBackgroundColorTest() { + + describe('StackBackgroundColorTest', () => { + + let PAGE_TAG = 'StackBackgroundColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Stack组件backgroundColor参数分别设置为0xFFFF0000、0x00000000、0xFFFFFFFF时的显示效果测试 + it('testStackBackgroundColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundImagePositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundImagePositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6fb71426ce670f2e95b5ef78ca64a77eac211f7a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundImagePositionTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackBackgroundImagePositionTest() { + + describe('StackBackgroundImagePositionTest', () => { + + let PAGE_TAG = 'StackBackgroundImagePositionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Stack组件backgroundImagePosition参数分别设置为{50,50},{-50,-50}时的显示效果测试 + it('testStackBackgroundImagePosition001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundImageSizeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundImageSizeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b4b9cfc385407ec2e347eea3b5e36a07eca86987 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundImageSizeTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackBackgroundImageSizeTest() { + + describe('StackBackgroundImageSizeTest', () => { + + let PAGE_TAG = 'StackBackgroundImageSizeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Stack组件backgroundImageSize参数分别设置为{50,50},{-50,-50},{不设置,50},{10000,10000}时的显示效果测试 + it('testStackBackgroundImageSize001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundImageTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundImageTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4215bec66169dd46f63418305a36b7b3ab97077a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBackgroundImageTest.test.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackBackgroundImageTest() { + + describe('StackBackgroundImageTest', () => { + + let PAGE_TAG = 'StackBackgroundImageTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Stack组件backgroundImage参数分别设置为 + (1) + imageUrl:"./resources/base/media/icon.png" + repeat:ARKUI_IMAGE_REPEAT_NONE + (2) + imageUrl:"./resources/base/media/icon.png" + repeat:ARKUI_IMAGE_REPEAT_X + (3) + imageUrl:"./resources/base/media/icon.png" + repeat:ARKUI_IMAGE_REPEAT_Y + (4) + imageUrl:"./resources/base/media/icon.png" + repeat:ARKUI_IMAGE_REPEAT_XY + (5) + imageUrl:"" + repeat:ARKUI_IMAGE_REPEAT_X + (6) + imageUrl:"./resources/base/media/icon.png" + repeat:-1 + (7) + imageUrl:"" + repeat:-1 + (8) + imageUrl:"./resources/base/media/icon_transparent.png" + 时的显示效果测试 + */ + it('testStackBackgroundImage001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b464d2fbeeb821191d69a88c0d1f7d24c1b7ad4 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderColorTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackBorderColorTest() { + + describe('StackBorderColorTest', () => { + + let PAGE_TAG = 'StackBorderColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /*Stack组件borderColor参数分别设置为 + {0xFFFF0000}, + {0xFFFFFFFF}, + {0x00000000}, + {0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000}, + {0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}, + {0x00000000,0x00000000,0x00000000,0x00000000}, + 时的显示效果测试*/ + it('testStackBorderColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderRadiusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderRadiusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab17d2b820622775765dc49c7cfd93873c272444 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderRadiusTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackBorderRadiusTest() { + + describe('StackBorderRadiusTest', () => { + + let PAGE_TAG = 'StackBorderRadiusTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /*Stack组件borderRadius参数分别设置为 + {10}, + {0}, + {40}, + {-1}, + {50}, + {10,11,12,13}, + {0,0,0,0}, + {40,40,40,40},时的显示效果测试*/ + it('testStackBorderRadius001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..75b7b83dadb42c0b07111ad6645ae899156a264e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderStyleTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackBorderStyleTest() { + + describe('StackBorderStyleTest', () => { + + let PAGE_TAG = 'StackBorderStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Stack组件borderStyle参数分别设置为 + ARKUI_BORDER_STYLE_SOLID, + ARKUI_BORDER_STYLE_DASHED, + ARKUI_BORDER_STYLE_DOTTED, + -1, + {ARKUI_BORDER_STYLE_SOLID, ARKUI_BORDER_STYLE_DASHED, ARKUI_BORDER_STYLE_DOTTED, ARKUI_BORDER_STYLE_SOLID}, + {-1,-1,-1,-1} + 时的显示效果测试 + */ + it('testStackBorderStyle001', 0, async (done: Function) => { + await Utils.sleep(2000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ebd14119220a23ae51f5980dc2a2f37dc5a17cda --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBorderWidthTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackBorderWidthTest() { + + describe('StackBorderWidthTest', () => { + + let PAGE_TAG = 'StackBorderWidthTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Stack组件borderWidth参数分别设置为{1},{-1},{1,2,3,4},{-1,-2,-3,-4},{10},{10,11,12,13}时的显示效果测试 + it('testStackBorderWidth001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBrightnessTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBrightnessTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8abcf20906f1689a1556b2eea9581ce866f2ad1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackBrightnessTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackBrightnessTest() { + + describe('StackBrightnessTest', () => { + + let PAGE_TAG = 'StackBrightnessTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + + }) + //Stack组件brightness参数分别设置为-1、0、0.5、1.5、2、3时的显示效果测试 + it('testStackBrightness001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackClipTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackClipTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..955521601b9b31b542ebc4c82db9ff3ab4e05fea --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackClipTest.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackClipTest() { + + describe('StackClipTest', () => { + + let PAGE_TAG = 'StackClipTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + + }) + /*Stack组件clip参数分别设置为 + NODE_CLIP_SHAPE: + (1) + 裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE + 矩形宽度:20, + 矩形高度:20, + 矩形圆角宽度:3, + 矩形圆角高度:3 + (2) + 裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE + 矩形宽度:-20, + 矩形高度:-20, + 矩形圆角宽度:-3, + 矩形圆角高度:-3 + (3) + 裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE + 矩形宽度:30000, + 矩形高度:30000, + 矩形圆角宽度:10000, + 矩形圆角高度:10000 + (4) + 裁剪类型:ARKUI_CLIP_TYPE_CIRCLE + 圆形宽度:20, + 圆形高度:20 + (5) + 裁剪类型:ARKUI_CLIP_TYPE_CIRCLE + 圆形宽度:-20, + 圆形高度:-20 + (6) + 裁剪类型:ARKUI_CLIP_TYPE_CIRCLE + 圆形宽度:10000, + 圆形高度:10000 + (7) + 裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE + 椭圆形宽度:35, + 椭圆形高度:20 + (8) + 裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE + 椭圆形宽度:-35, + 椭圆形高度:-20 + (9) + 裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE + 椭圆形宽度:20000, + 椭圆形高度:10000 + (10) + 裁剪类型:ARKUI_CLIP_TYPE_PATH + 路径宽度:35, + 路径高度:20, + 路径绘制的命令字符串:"M0 0 H20 V20 H0 Z" + (11) + 裁剪类型:ARKUI_CLIP_TYPE_PATH + 路径宽度:-35, + 路径高度:-20, + 路径绘制的命令字符串:"" + (12) + 裁剪类型:ARKUI_CLIP_TYPE_PATH + 路径宽度:10000, + 路径高度:10000, + 路径绘制的命令字符串:"M0 0 H20 V20 H0 Z" + (13) + 1 + (14) + 0 + (15) + -1 + 时的显示效果测试*/ + it('testStackClip001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1bbc663a3b257f0248c8f2b19466968766640741 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackHeightTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackHeightTest() { + + describe('StackHeightTest', () => { + + let PAGE_TAG = 'StackHeightTest'; + let PAGE_TAG_LARGE = 'StackHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Stack组件Height参数分别设置为200、-50时的显示效果测试 + it('testStackHeight001', 0, async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + //Stack组件Height参数设置为500,超出父控件时的显示效果测试 + it('testStackHeight002', 0, async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG_LARGE}`, done); + }); + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackHitTestBehaviorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackHitTestBehaviorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e52ff51fd39c609338f5ad448369802054eaf608 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackHitTestBehaviorTest.test.ets @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackHitTestBehaviorTest() { + + describe('StackHitTestBehaviorTest', () => { + + let PAGE_TAG = 'StackHitTestBehaviorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*验证Stack组件在HitTestBehavior属性为ARKUI_HIT_TEST_MODE_DEFAULT、ARKUI_HIT_TEST_MODE_BLOCK、 + ARKUI_HIT_TEST_MODE_TRANSPARENT、ARKUI_HIT_TEST_MODE_NONE、-1、4时通过onclick事件进行响应触摸测试*/ + it('testStackHitTestBehavior001', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTestStackBrotherDefault') + await Utils.sleep(1000) + + await Utils.clickComponent('OnTouchTestStackBrotherBlock') + await Utils.sleep(1000) + + await Utils.clickComponent('OnTouchTestStackBrotherTransparent') + await Utils.sleep(1000) + + await Utils.clickComponent('OnTouchTestStackBrotherNone') + await Utils.sleep(1000) + + await Utils.clickComponent('OnTouchTestStackBrotherExceptBelow') + await Utils.sleep(1000) + + await Utils.clickComponent('OnTouchTestStackBrotherExceptAbove') + await Utils.sleep(1000) + + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackIdTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackIdTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a27b78c175960c7150a88c14e5c28ab2420a0b33 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackIdTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackIdTest() { + + describe('StackIdTest', () => { + + let PAGE_TAG = 'StackIdTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Stack组件id参数分别设置为“FirstStack”,“SecondStack”时的显示效果测试 + it('testStackId001', 0, async (done: Function) => { + await Utils.clickComponent('FirstStack'); + await Utils.clickComponent('SecondStack'); + await Utils.sleep(2000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackLinearGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackLinearGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c327dd1912d52cc206f3de612bdca0f1b995ff27 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackLinearGradientTest.test.ets @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackLinearGradientTest() { + + describe('StackLinearGradientTest', () => { + + let PAGE_TAG = 'StackLinearGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Stack组件linearGradient参数分别设置为 + (1) + angle:60 + direction:ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT + repeating:false + colors:{ 0xFFFF0000,0xFF0000FF } + stops: { 0.0, 1.0 } + size:2 + (2) + angle:60 + direction:ARKUI_LINEAR_GRADIENT_DIRECTION_TOP + repeating:false + colors:{ 0xFFFF0000,0xFF0000FF } + stops: { 0.0, 1.0 } + size:2 + (3) + angle:60 + direction:ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT + repeating:false + colors:{ 0xFFFF0000,0xFF0000FF } + stops: { 0.0, 1.0 } + size:2 + (4) + angle:60 + direction:ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM + repeating:false + colors:{ 0xFFFF0000,0xFF0000FF } + stops: { 0.0, 1.0 } + size:2 + (5) + angle:60 + direction:ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP + repeating:false + colors:{ 0xFFFF0000,0xFF0000FF } + stops: { 0.0, 1.0 } + size:2 + (6) + angle:60 + direction:ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM + repeating:false + colors:{ 0xFFFF0000,0xFF0000FF } + stops: { 0.0, 1.0 } + size:2 + (7) + angle:60 + direction:ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP + repeating:false + colors:{ 0xFFFF0000,0xFF0000FF } + stops: { 0.0, 1.0 } + size:2 + (8) + angle:60 + direction:ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM + repeating:false + colors:{ 0xFFFF0000,0xFF0000FF } + stops: { 0.0, 1.0 } + size:2 + (9) + angle:60 + direction:ARKUI_LINEAR_GRADIENT_DIRECTION_NONE + repeating:false + colors:{ 0xFFFF0000,0xFF0000FF } + stops: { 0.0, 1.0 } + size:2 + (10) + angle:60 + direction:ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM + repeating:false + colors:{ 0xFFFF0000,0xFF0000FF } + stops: { 0.0, 1.0 } + size:2 + 时的显示效果测试 + */ + it('testStackLinearGradient001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackMarginTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackMarginTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..16f7b4bf1b69c573b42ce02c8c55396b20b9bc39 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackMarginTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackMarginTest() { + + describe('StackMarginTest', () => { + + let PAGE_TAG = 'StackMarginTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Stack组件margin参数分别设置为10,-10,{10,10,50,50},{-10,-10,-50,-50}时的显示效果测试 + it('testStackMargin001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackOnAreaChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackOnAreaChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba6721fbe1868d9c61cc75ff9b29544e8dd21afb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackOnAreaChangeTest.test.ets @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackOnAreaChangeTest() { + + describe('StackOnAreaChangeTest', () => { + + let PAGE_TAG = 'StackOnAreaChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Stack组件onAreaChange回调触发时的显示效果测试 + it('testStackOnAreaChange001', 0, async (done: Function) => { + await Utils.clickComponent('OnAreaChangeTestStackSize'); + await Utils.sleep(2000); + done(); + }); + + //Stack组件onAreaChange回调触发时的显示效果测试 + it('testStackOnAreaChange002', 0, async (done: Function) => { + await Utils.clickComponent('OnAreaChangeTestStackMoveCompare'); + await Utils.sleep(2000); + done(); + }); + + //Stack组件onAreaChange回调不触发时的显示效果测试 + it('testStackOnAreaChange003', 0, async (done: Function) => { + await Utils.clickComponent('OnAreaChangeTestStackOffset'); + await Utils.sleep(2000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackOnTouchTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackOnTouchTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..88a4244b84696ce6b93114fdfe2bf45796f9d73c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackOnTouchTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackOnTouchTest() { + + describe('StackOnTouchTest', () => { + + let PAGE_TAG = 'StackOnTouchTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Stack组件onTouch回调触发时的显示效果测试 + it('testStackOnTouch001', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTest'); + await Utils.sleep(10000); + done(); + }); + + //Stack组件onTouch回调不触发时的显示效果测试 + it('testStackOnTouch002', 0, async (done: Function) => { + await Utils.clickComponent('OnTouchTestDisable'); + await Utils.sleep(10000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackOpacityTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackOpacityTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..53d697c3b37b4ea429901d0149f2e858af85dba6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackOpacityTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackOpacityTest() { + + describe('StackOpacityTest', () => { + + let PAGE_TAG = 'StackOpacityTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + + }) + /*Arkts侧创建占位XCompoent,capi侧创建6个Stack组件,分别设置opacity属性为0、0.5、0.6(有设置透明度的子组件)、1、-1、2。 + 再创建一个父节点Column,并将6个Stack添加到Column中。最后将Column挂载到Xcomponet。*/ + it('testStackOpacity001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackPositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackPositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d859734a06f85cfb10d9d3e2709a06e02f3e781b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackPositionTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackPositionTest() { + + describe('StackPositionTest', () => { + + let PAGE_TAG = 'StackPositionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Stack组件position参数分别设置为{10,10},{-10,-10}时的显示效果测试 + it('testStackPosition001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackRotateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackRotateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..70439bb07fe5dc111d91da67d05bf63604c3a1c1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackRotateTest.test.ets @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackRotateTest() { + + describe('StackRotateTest', () => { + + let PAGE_TAG = 'StackRotateTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + + }) + /*Arkts侧创建占位XCompoent,capi侧创建9个Stack组件,分别设置rotate属性为(1) + x:10 + y:0 + z:0 + 旋转角度:60 + 视距:0 + (2) + x:0 + y:10 + z:0 + 旋转角度:60 + 视距:0 + (3) + x:0 + y:0 + z:10 + 旋转角度:60 + 视距:0 + (4) + x:-10 + y:0 + z:0 + 旋转角度:-60 + 视距:0 + (5) + x:0 + y:-10 + z:0 + 旋转角度:-60 + 视距:0 + (6) + x:0 + y:0 + z:-10 + 旋转角度:-60 + 视距:0 + (7) + x:0 + y:0 + z:0 + 旋转角度:0 + 视距:100 + (8) + x:0 + y:0 + z:0 + 旋转角度:0 + 视距:-100。 + 再创建一个父节点Column,并将9个Stack添加到Column中。最后将Column挂载到Xcomponet。*/ + it('testStackRotate001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackSaturateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackSaturateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d7962eb8502b6e6b909370df9c40f7a72027ade2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackSaturateTest.test.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackSaturateTest() { + + describe('StackSaturateTest', () => { + + let PAGE_TAG = 'StackSaturateTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + //Stack组件saturate参数分别设置为0、0.5、1、49、100,-1时的显示效果测试 + it('testStackSaturate001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackScaleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackScaleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3d305137b3e4f636b027e8ce9db407172a1be38 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackScaleTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackScaleTest() { + + describe('StackScaleTest', () => { + + let PAGE_TAG = 'StackScaleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + + }) + + //Stack组件scale参数分别设置为{0.5,0.5}、{2,2}、{-2,-2}时的显示效果测试 + it('testStackScale001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackShadowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackShadowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..be11d01edc641f41198ab49667c69dd50fcd036b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackShadowTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackShadowTest() { + + describe('StackShadowTest', () => { + + let PAGE_TAG = 'StackShadowTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Stack组件shadow参数分别设置为 + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS, + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM, + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD, + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG, + ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM, + ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD以及-1时的显示效果测试 + */ + it('testStackShadow001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackTransformTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackTransformTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b193f20a849c375bb041f727d7900b28131bd411 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackTransformTest.test.ets @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackTransformTest() { + + describe('StackTransformTest', () => { + + let PAGE_TAG = 'StackTransformTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Stack组件transform参数分别设置为 + [2, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1], + + [1, 0, 0, 0, + 0, 2, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1], + + [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 2, 0, + 0, 0, 0, 1], + + [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 2], + + [1.0, 0.5, 0.5, 0.5, + 0.5, 1.0, 0.5, 0.5, + 0.5, 0.5, 1.0, 0.5, + 0.5, 0.5, 0.5, 1.0], + + [-1.0, -0.5, -0.5, -0.5, + -0.5, -2.0, -0.5, -0.5, + -0.5, -0.5, -3.0, -0.5, + -0.5, -0.5, -0.5, -1.0] + + ,时的显示效果测试*/ + it('testStackTransform001', 0, async (done: Function) => { + await Utils.sleep(2000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackTransitionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackTransitionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e76dd2eb6914d92fb72df26ef898bc4d833ec679 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackTransitionTest.test.ets @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackTransitionTest() { + + describe('StackTransitionTest', () => { + + let PAGE_TAG = 'StackTransitionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + /*Stack组件transition参数分别设置为 + NODE_ROTATE_TRANSITION: + (1) + x:0 + y:0 + z:10 + angle:60 + perspective:100 + duration:3000 + curve:ARKUI_CURVE_LINEAR + delay:300 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + (2) + x:0 + y:-10 + z:0 + angle:-60 + perspective:-100 + duration:3000 + curve:ARKUI_CURVE_EASE + delay:-300 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_REVERSE + tempo:1 + (3) + x:10 + y:0 + z:0 + angle:-60 + perspective:0 + duration:3000 + curve:ARKUI_CURVE_EASE_IN + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + + NODE_OPACITY_TRANSITION: + (4) + opacity:0 + duration:3000 + curve:ARKUI_CURVE_EASE_OUT + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + (5) + opacity:1 + duration:3000 + curve:ARKUI_CURVE_EASE_IN_OUT + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + (6) + opacity:0.5 + duration:3000 + curve:ARKUI_CURVE_FAST_OUT_SLOW_IN + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + + NODE_SCALE_TRANSITION: + (7) + x:0.5 + y:0.5 + z:0.5 + duration:3000 + curve:ARKUI_CURVE_LINEAR_OUT_SLOW_IN + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + (8) + x:2 + y:2 + z:2 + duration:3000 + curve:ARKUI_CURVE_FAST_OUT_LINEAR_IN + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + (9) + x:-2 + y:-2 + z:-2 + duration:3000 + curve:ARKUI_CURVE_EXTREME_DECELERATION + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + (10) + x:-0.5 + y:-0.5 + z:-0.5 + duration:3000 + curve:ARKUI_CURVE_SHARP + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + + NODE_TRANSLATE_TRANSITION: + (11) + x:-50 + y:-50 + z:-50 + duration:3000 + curve:ARKUI_CURVE_RHYTHM + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + (12) + x:50 + y:50 + z:50 + duration:3000 + curve:ARKUI_CURVE_SMOOTH + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + (13) + x:50 + y:50 + z:50 + duration:3000 + curve:ARKUI_CURVE_FRICTION + delay:0 + iterations:1 + playMode:ARKUI_ANIMATION_PLAY_MODE_NORMAL + tempo:1 + + NODE_MOVE_TRANSITION: + (14) + ARKUI_TRANSITION_EDGE_TOP + (15) + ARKUI_TRANSITION_EDGE_BOTTOM + (16) + ARKUI_TRANSITION_EDGE_START + (17) + ARKUI_TRANSITION_EDGE_END + 时的组件内转场动画显示效果测试*/ + it('testStackTransition001', 0, async (done: Function) => { + await Utils.clickComponent('FirstRow'); + await Utils.clickComponent('SecondRow'); + await Utils.clickComponent('ThirdRow'); + await Utils.clickComponent('FourthRow'); + await Utils.clickComponent('FifthRow'); + await Utils.sleep(3000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackTranslateTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackTranslateTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e95162367795328885b5925ebb973a8e887142a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackTranslateTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackTranslateTest() { + + describe('StackTranslateTest', () => { + + let PAGE_TAG = 'StackTranslateTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + + }) + + /*Arkts侧创建占位XCompoent,capi侧创建2个Stack组件,分别设置translate属性为50、-50。 + 再创建一个父节点Column,并将2个Stack添加到Column中。最后将Column挂载到Xcomponet。*/ + it('testStackTranslate001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a2f658f1bdd5f20afc5bf1de27dea0c8c3e4343e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/stack/StackWidthTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function stackWidthTest() { + + describe('StackWidthTest', () => { + + let PAGE_TAG = 'StackWidthTest'; + let PAGE_TAG_LARGE = 'StackWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Stack组件width参数分别设置为300、-100时的显示效果测试 + it('testStackWidth001', 0, async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG}`, done); + }); + + //Stack组件width参数设置为500,超出父控件时的显示效果测试 + it('testStackWidth002', 0, async (done: Function) => { + await Utils.pushPage(`stack/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperAutoPlayTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperAutoPlayTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..975bf45750b0f4f9a80f35a47d8d6f16206061e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperAutoPlayTest.test.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperAutoPlayTest() { + + describe('SwiperAutoPlayTest', () => { + + let PAGE_TAG = 'SwiperAutoPlayTest'; + let PAGE_TO_END_TAG = 'SwiperAutoPlayToEndTest'; + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件autoPlay参数设置为1、0、-1时的显示效果测试 + it('testSwiperAutoPlay001', 0, async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`); + await Utils.sleep(10000); + done(); + }); + + //Swiper组件autoPlay参数设置为1,loop设置为false时的显示效果测试 + it('testSwiperAutoPlay002', 0, async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TO_END_TAG}`); + await Utils.sleep(10000) + done(); + }); + + //Swiper组件autoPlay参数设置为1,手势切换后不是最后一页时的显示效果测试 + it('testSwiperAutoPlay003', 0, async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TO_END_TAG}`); + await Utils.flingComponent("OnFlingSwiper", true, true); + await Utils.sleep(10000) + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..74f020e8e9fed9d58fe828db3ff0cff28f260558 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperBackgroundColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperBackgroundColorTest() { + + describe('SwiperBackgroundColorTest', () => { + + let PAGE_TAG = 'SwiperBackgroundColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件backgroundColor参数分别设置为0xFFFF0000,0xFFFFFFFF,0x00000000时的显示效果测试 + it('testSwiperBackgroundColor001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperBackgroundImageTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperBackgroundImageTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f068c6e187220ded5323f0c95d9d1394ac321a8b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperBackgroundImageTest.test.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperBackgroundImageTest() { + + describe('SwiperBackgroundImageTest', () => { + + let PAGE_TAG = 'SwiperBackgroundImageTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Swiper组件backgroundImage参数分别设置为 + (1) + imageUrl:"./resources/base/media/icon.png" + repeat:ARKUI_IMAGE_REPEAT_NONE + (2) + imageUrl:"./resources/base/media/icon.png" + repeat:ARKUI_IMAGE_REPEAT_X + (3) + imageUrl:"./resources/base/media/icon.png" + repeat:ARKUI_IMAGE_REPEAT_Y + (4) + imageUrl:"./resources/base/media/icon.png" + repeat:ARKUI_IMAGE_REPEAT_XY + (5) + imageUrl:"" + repeat:ARKUI_IMAGE_REPEAT_X + (6) + imageUrl:"./resources/base/media/icon.png" + repeat:-1 + (7) + imageUrl:"" + repeat:-1 + (8) + imageUrl:"./resources/base/media/icon_transparent.png" + 时的显示效果测试 + */ + it('testSwiperBackgroundImage001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperCachedCountTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperCachedCountTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..069d3c3e39607bca4f209179b41488ed7e378663 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperCachedCountTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperCachedCountTest() { + + describe('SwiperCachedCountTest', () => { + + let PAGE_TAG = 'SwiperCachedCountTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件cachedCount参数设置为1,2时的显示效果测试 + it('testSwiperCachedCount001', 0, async (done: Function) => { + Utils.sleep(10000) + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperClipTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperClipTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b23a4152d775bd9e5874e6c8b7ad938f7fa6125 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperClipTest.test.ets @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperClipTest() { + + describe('SwiperClipTest', () => { + + let PAGE_TAG = 'SwiperClipTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Toggle组件clip参数分别设置为 + NODE_CLIP_SHAPE: + (1) + 裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE + 矩形宽度:20, + 矩形高度:20, + 矩形圆角宽度:3, + 矩形圆角高度:3 + (2) + 裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE + 矩形宽度:-20, + 矩形高度:-20, + 矩形圆角宽度:-3, + 矩形圆角高度:-3 + (3) + 裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE + 矩形宽度:30000, + 矩形高度:30000, + 矩形圆角宽度:10000, + 矩形圆角高度:10000 + (4) + 裁剪类型:ARKUI_CLIP_TYPE_CIRCLE + 圆形宽度:20, + 圆形高度:20 + (5) + 裁剪类型:ARKUI_CLIP_TYPE_CIRCLE + 圆形宽度:-20, + 圆形高度:-20 + (6) + 裁剪类型:ARKUI_CLIP_TYPE_CIRCLE + 圆形宽度:10000, + 圆形高度:10000 + (7) + 裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE + 椭圆形宽度:35, + 椭圆形高度:20 + (8) + 裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE + 椭圆形宽度:-35, + 椭圆形高度:-20 + (9) + 裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE + 椭圆形宽度:20000, + 椭圆形高度:10000 + (10) + 裁剪类型:ARKUI_CLIP_TYPE_PATH + 路径宽度:35, + 路径高度:20, + 路径绘制的命令字符串:"M0 0 H20 V20 H0 Z" + (11) + 裁剪类型:ARKUI_CLIP_TYPE_PATH + 路径宽度:-35, + 路径高度:-20, + 路径绘制的命令字符串:"" + (12) + 裁剪类型:ARKUI_CLIP_TYPE_PATH + 路径宽度:10000, + 路径高度:10000, + 路径绘制的命令字符串:"M0 0 H20 V20 H0 Z" + (13) + 1 + (14) + 0 + (15) + -1 + 时的显示效果测试 + */ + it('testSwiperClip001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperCurveTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperCurveTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c2fac90e64a52d2616a2164b0c8de32a86594f5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperCurveTest.test.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperCurveTest() { + + describe('SwiperCurveTest', () => { + + let PAGE_TAG = 'SwiperCurveTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Swiper组件curve参数分别设置为ARKUI_CURVE_LINEAR,ARKUI_CURVE_EASE,ARKUI_CURVE_EASE_IN,ARKUI_CURVE_EASE_OUT, + ARKUI_CURVE_EASE_IN_OUT,ARKUI_CURVE_FAST_OUT_SLOW_IN,ARKUI_CURVE_LINEAR_OUT_SLOW_IN, + ARKUI_CURVE_FAST_OUT_LINEAR_IN,ARKUI_CURVE_EXTREME_DECELERATION,ARKUI_CURVE_SHARP, + ARKUI_CURVE_RHYTHM,ARKUI_CURVE_SMOOTH,ARKUI_CURVE_FRICTION,-1,以及不主动设置时的显示效果测试 + */ + it('testSwiperCurve001', 0, async (done: Function) => { + await Utils.sleep(10000) + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDisableSwipeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDisableSwipeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e72b70d74d2a64db02bfc488d4411fe8215c6c3a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDisableSwipeTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperDisableSwipeTest() { + + describe('SwiperDisableSwipeTest', () => { + + let PAGE_TAG = 'SwiperDisableSwipeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件disableSwipe参数分别设置为0,1,以及-1时的显示效果测试 + it('testSwiperDisableSwipe001', 0, async (done: Function) => { + await Utils.flingComponent("DisableSwipe_Swiper1", true, true); + await Utils.flingComponent("DisableSwipe_Swiper2", true, true); + await Utils.flingComponent("DisableSwipe_Swiper3", true, true); + await Utils.sleep(10000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDisplayArrowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDisplayArrowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e30c504bfcaf9e5d5b8376b03ccc13bd9c01b91 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDisplayArrowTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperDisplayArrowTest() { + + describe('SwiperDisplayArrowTest', () => { + + let PAGE_TAG = 'SwiperDisplayArrowTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /*Swiper组件displayArrow参数分别设置为ARKUI_SWIPER_ARROW_HIDE,ARKUI_SWIPER_ARROW_SHOW, + ARKUI_SWIPER_ARROW_SHOW_ON_HOVER,-1时的显示效果测试 + */ + it('testSwiperDisplayArrow001', 0, async (done: Function) => { + let rect = Utils.getComponentRect('OnHoverSwiper'); + let X = Utils.getRectHorizontalCenterX(rect) + let Y = Number.parseInt(Number(rect.bottom - 30).toFixed(0)) + await Utils.mouseMoveTo(X, Y); + await Utils.sleep(1000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDisplayCountTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDisplayCountTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7f3c90b17dce25303fd699830c6d7aebad05338a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDisplayCountTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperDisplayCountTest() { + + describe('SwiperDisplayCountTest', () => { + + let PAGE_TAG = 'SwiperDisplayCountTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件displayCount参数设置为3、-1、100、10000时的显示效果测试 + it('testSwiperDisplayCount001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDurationTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDurationTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..87684778dd9424766e8aae3903f016db2ab22904 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperDurationTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperDurationTest() { + + describe('SwiperDurationTest', () => { + + let PAGE_TAG = 'SwiperDurationTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件duration参数分别设置为1000,10000,不主动设置,以及-600时的显示效果测试 + it('testSwiperDuration001', 0, async (done: Function) => { + await Utils.sleep(10000) + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b619cfe3c7c89d8da97f2bc72b121758d4b75322 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperHeightTest() { + + describe('SwiperHeightTest', () => { + + let PAGE_TAG = 'SwiperHeightTest'; + let PAGE_TAG_LARGE = 'SwiperHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件height参数分别设置为200、-50时的显示效果测试 + it('testSwiperHeight001', 0, async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + //Swiper组件height参数设置为10000,超出父控件时的显示效果测试 + it('testSwiperHeight002', 0, async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperIndexTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperIndexTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..56b790022a73e6dadae610904319b48bc39dcb39 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperIndexTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperIndexTest() { + + describe('SwiperIndexTest', () => { + + let PAGE_TAG = 'SwiperIndexTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件index参数设置为2、-1、5、1时的显示效果测试 + it('testSwiperIndex001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperIndicatorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperIndicatorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8eb17fd80cc0ef02b2a0638795379e3af9ca4037 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperIndicatorTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; +import FaultLogger from '@ohos.faultLogger'; + +export default function swiperIndicatorTest() { + + describe('SwiperIndicatorTest', () => { + + let PAGE_TAG = 'SwiperIndicatorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件autoPlay参数设置为0、1、-1时的显示效果测试 + it('testSwiperIndicator001', 0, async (done: Function) => { + done(); + }); + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperIntervalTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperIntervalTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a7d4738b175ea75b4d8769777b82a1cbd8dcab3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperIntervalTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperIntervalTest() { + + describe('SwiperIntervalTest', () => { + + let PAGE_TAG = 'SwiperIntervalTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件interval参数设置为1000、10000、不设置、-600时的显示效果测试 + it('testSwiperInterval001', 0, async (done: Function) => { + await Utils.sleep(10000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperItemSpaceTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperItemSpaceTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8eae5406f86133586a59002d04d766e0c02e6c96 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperItemSpaceTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperItemSpaceTest() { + + describe('SwiperItemSpaceTest', () => { + + let PAGE_TAG = 'SwiperItemSpaceTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件itemSpace参数分别设置为5,10000,-20时的显示效果测试 + it('testSwiperItemSpace001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperLoopTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperLoopTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d4ba4032c6889c28150d43a4ac94c0dbfbb9a05 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperLoopTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; +import FaultLogger from '@ohos.faultLogger'; + +export default function swiperLoopTest() { + + describe('SwiperLoopTest', () => { + + let PAGE_TAG = 'SwiperLoopTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件loop参数设置为0、1、不设置、-1时的显示效果测试 + it('testSwiperLoop001', 0, async (done: Function) => { + await Utils.sleep(10000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperPositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperPositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b32f249c9e5e4534873afd18756c82d1469df83 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperPositionTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperPositionTest() { + + describe('SwiperPositionTest', () => { + + let PAGE_TAG = 'SwiperPositionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件position参数分别设置为{10,10},{-10,-10}时的显示效果测试 + it('testSwiperPosition001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperVerticalTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperVerticalTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd0b9744da35b384084f7f9c521f3fb61d2d1d99 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperVerticalTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperVerticalTest() { + + describe('SwiperVerticalTest', () => { + + let PAGE_TAG = 'SwiperVerticalTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件vertical参数分别设置为0,1,以及-1时的显示效果测试 + it('testSwiperVertical001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..343a08b7b7d347fdcb9792481def8520ed526222 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/swiper/SwiperWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function swiperWidthTest() { + + describe('SwiperWidthTest', () => { + + let PAGE_TAG = 'SwiperWidthTest'; + let PAGE_TAG_LARGE = 'SwiperWidthLargeTest'; + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Swiper组件width参数分别设置为300、-100时的显示效果测试 + it('testSwiperWidth001', 0, async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG}`, done); + }); + + //Swiper组件width参数设置为10000,超出父控件时的显示效果测试 + it('testSwiperWidth002', 0, async (done: Function) => { + await Utils.pushPage(`swiper/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextAlignRulesTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextAlignRulesTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..94afdc4e745f091ce256a206ae9f46ea32450f7f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextAlignRulesTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAlignRulesTest() { + + describe('TextAlignRulesTest', () => { + + let PAGE_TAG = 'TextAlignRulesTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件参数设置alignRules 对齐后的显示效果测试 + it('testTextAlignRules001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextAlignTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextAlignTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6df74ff8ce20f0285c58d1ee92a0a82512e0766 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextAlignTest.test.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAlignTest() { + + describe('TextAlignTest', () => { + + let PAGE_TAG = 'TextAlignTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置align ARKUI_ALIGNMENT_TOP_START + * ARKUI_ALIGNMENT_TOP + * ARKUI_ALIGNMENT_TOP_END + * ARKUI_ALIGNMENT_START + * ARKUI_ALIGNMENT_CENTER + * ARKUI_ALIGNMENT_END + * ARKUI_ALIGNMENT_BOTTOM_START + * ARKUI_ALIGNMENT_BOTTOM + * ARKUI_ALIGNMENT_BOTTOM_END + * 枚举异常值(-1) + * 默认值 + * 时的显示效果测试*/ + it('testTextAlign001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2fb814d4ac9b07814bd88a0e53883a520eb871a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBackgroundColorTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textBackgroundColorTest() { + + describe('TextBackgroundColorTest', () => { + + let PAGE_TAG = 'TextBackgroundColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件参数设置backgroundColor 0xFFFF0000,0xFFFFFFFF,0xFF000000时的显示效果测试 + it('testTextBackgroundColor001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBackgroundImageTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBackgroundImageTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..51d8140f234e51c80c23954ff55def3ef5a9b086 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBackgroundImageTest.test.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textBackgroundImageTest() { + + describe('TextBackgroundImageTest', () => { + + let PAGE_TAG = 'TextBackgroundImageTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置backgroundImage string:"resource://media/icon.png",{string:"resource://media/icon.png", + * i32:ARKUI_IMAGE_REPEAT_NONE},{string:"resource://media/icon.png",i32:ARKUI_IMAGE_REPEAT_X}, + * {string:"resource://media/icon.png",i32:ARKUI_IMAGE_REPEAT_Y},{string:"resource://media/icon.png", + * i32:ARKUI_IMAGE_REPEAT_XY},string:"",{string:"resource://media/icon.png",i32:-1}时的显示效果测试 + */ + it('testTextBackgroundImage001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBaselineOffsetTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBaselineOffsetTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d7df87b652fa34438dc7e6f6e7f115c3acca2698 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBaselineOffsetTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textBaselineOffsetTest() { + + describe('TextBaselineOffsetTest', () => { + + let PAGE_TAG = 'TextBaselineOffsetTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件参数设置baselineOffset 30,-30时的显示效果测试 + it('testTextBaselineOffset001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBorderColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBorderColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..31718e8e6146a16861d19c07d75def245111d631 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBorderColorTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textBorderColorTest() { + + describe('TextBorderColorTest', () => { + + let PAGE_TAG = 'TextBorderColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置borderColor 0xFF00FF00,{{.u32 = 0xFFFF0000}, {.u32 = 0xFF00FF00},{.u32 = 0xFF0000FF}, + * {.u32 = 0xFFFFFF00}},{{.u32 = 0}, {.u32 = 0xFF00FF00},{.u32 = 0xFF0000FF},{.u32 = 0xFFFFFF00}}时的显示效果测试 + */ + it('testTextBorderColor001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBorderRadiusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBorderRadiusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..10b540a2b4359d91ea8c368ffc5b5da4ee23af69 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBorderRadiusTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textBorderRadiusTest() { + + describe('TextBorderRadiusTest', () => { + + let PAGE_TAG = 'TextBorderRadiusTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件参数设置borderRadius 20,{0,20,40,200},{0,20,40,-10}时的显示效果测试 + it('testTextBorderRadius001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBorderWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBorderWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..15ed581b8683615b3998c149e41f5312af33345b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextBorderWidthTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textBorderWidthTest() { + + describe('TextBorderWidthTest', () => { + + let PAGE_TAG = 'TextBorderWidthTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * (Text组件参数设置borderWidth 0.5,{{.f32 = 0.5}, {.f32 = 2.5}, + * {.f32 = 4.5}, {.f32 = 6.5}},{{.f32 = 2}, {.f32 = 2}, {.f32 = 2}, {.f32 = -10}}时的显示效果测试 + */ + it('testTextBorderWidth001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextClipTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextClipTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..24969361ccfa6334bf4130461f90f194d683ba1d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextClipTest.test.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textClipTest() { + + describe('TextClipTest', () => { + + let PAGE_TAG = 'TextClipTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置clip 0,1,-1, + * {.i32:ARKUI_CLIP_TYPE_RECTANGLE},{.f32:40},{.f32:40},{.f32:10},{.f32:10} + * {.i32:ARKUI_CLIP_TYPE_CIRCLE},{.f32:30},{.f32:30} + * {.i32:ARKUI_CLIP_TYPE_ELLIPSE},{.f32:30},{.f32:30} + * {.i32:ARKUI_CLIP_TYPE_PATH},{.f32:40},{.f32:40},.string:""resource://media/icon.png"" + * {.i32:-1},{.f32:40},{.f32:40} + * {.i32:ARKUI_CLIP_TYPE_RECTANGLE},{.f32:-40},{.f32:-40},{.f32:-10},{.f32:-10}} + * {.i32:ARKUI_CLIP_TYPE_CIRCLE},{.f32:-30},{.f32:-30} + * {.i32:ARKUI_CLIP_TYPE_ELLIPSE},{.f32:-40},{.f32:-40} + * {.i32:ARKUI_CLIP_TYPE_PATH},{.f32:-40},{.f32:-40},.string:""resource://media/icon.png""时的显示效果测试 + */ + it('testTextClip001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextCopyOptionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextCopyOptionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2a65cbebbf70bc48edc0ebc9a81ee9339f54153 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextCopyOptionTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textCopyOptionTest() { + + describe('TextCopyOptionTest', () => { + + let PAGE_TAG = 'TextCopyOptionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置align ARKUI_COPY_OPTIONS_NONE + * ARKUI_COPY_OPTIONS_IN_APP + * ARKUI_COPY_OPTIONS_LOCAL_DEVICE + * ARKUI_COPY_OPTIONS_CROSS_DEVICE + * 枚举异常值(-1) + * 时的显示效果测试*/ + it('testTextCopyOption001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextDecorationTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextDecorationTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b13571fa21453eb48b5a52f6877fc0f15bedb1e8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextDecorationTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textDecorationTest() { + + describe('TextDecorationTest', () => { + + let PAGE_TAG = 'TextDecorationTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置decoration {ARKUI_TEXT_DECORATION_TYPE_UNDERLINE,0xFFFF0000}{ARKUI_TEXT_DECORATION_TYPE_OVERL + * INE,0xFFFF0000}{ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH,0xFFFF0000}{1234,1234}时的显示效果测试 + */ + it('testTextDecoration001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextEnabledTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextEnabledTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f0b2eaec57291129b0d7482dbe1cb0da7b56599 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextEnabledTest.test.ets @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textEnabledTest() { + + describe('TextEnabledTest', () => { + + let PAGE_TAG = 'TextEnabledTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Text组件enabled参数设置为1时的显示效果测试 + it('testTextEnabled001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickEnabledText') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurEnabledText') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusEnabledText') + await Utils.sleep(1000) + + done(); + }) + + //Text组件enabled参数设置为0时的显示效果测试 + it('testTextEnabled002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickDisabledText') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurDisabledText') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusDisabledText') + await Utils.sleep(1000) + + done(); + }) + + //Text组件enabled参数设置为-1时的显示效果测试 + it('testTextEnabled003', 0, async (done: Function) => { + await Utils.clickComponent('OnClickAbnormalText') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurAbnormalText') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusAbnormalText') + await Utils.sleep(1000) + + done(); + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb1842c1f14597fe2489977d3315412b2bdd555e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontColorTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textFontColorTest() { + + describe('TextFontColorTest', () => { + + let PAGE_TAG = 'TextFontColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件参数设置fontColor 0xFFFF0000,0xFFFFFFFF时的显示效果测试 + it('testTextFontColor001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontFamilyTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontFamilyTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c363e1d6f617e68581abfea8fd01feb8fcde8b5a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontFamilyTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textFontFamilyTest() { + + describe('TextFontFamilyTest', () => { + + let PAGE_TAG = 'TextFontFamilyTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件参数设置fontFamily HarmonyOS Sans时的显示效果测试 + it('testTextFontFamily001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontSizeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontSizeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..18fecb937013af848450978de89ed7b8fa1b2e73 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontSizeTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textFontSizeTest() { + + describe('TextFontSizeTest', () => { + + let PAGE_TAG = 'TextFontSizeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件参数设置fontSize 25,0,-1时的显示效果测试 + it('testTextFontSize001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8bdeea3d30458be7f0cf925d5aa5a8a1c3cee316 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontStyleTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textFontStyleTest() { + + describe('TextFontStyleTest', () => { + + let PAGE_TAG = 'TextFontStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件参数设置fontStyle -10,ARKUI_FONT_STYLE_NORMAL,ARKUI_FONT_STYLE_ITALIC时的显示效果测试 + it('testTextFontStyle001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..21bc0e55162489462b0d49a46fd0ce2e731a02c3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontTest.test.ets @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textFontTest() { + + describe('TextFontTest', () => { + + let PAGE_TAG = 'TextFontTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + +/* + * Text组件参数设置font + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_W100 .i32 ARKUI_FONT_STYLE_NORMAL}.string :""HarmonyOS Sans"" + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_W200 .i32 ARKUI_FONT_STYLE_ITALIC} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_W300} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_W400} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_W500} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_W600} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_W700} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_W800} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_W900} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_BOLD} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_NORMAL} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_BOLDER} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_LIGHTER} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_MEDIUM} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_REGULAR} + * {.f32:20 .i32:ARKUI_FONT_WEIGHT_W300} + * {.f32:20 .i32:-1 .i32:-1} + * .f32:20时的显示效果测试 + */ + it('testTextFont001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontWeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontWeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0c6460c18993d48909614693cdfbdd9ed1bfd974 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextFontWeightTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textFontWeightTest() { + + describe('TextFontWeightTest', () => { + + let PAGE_TAG = 'TextFontWeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置fontWeight -10,ARKUI_FONT_WEIGHT_W100,ARKUI_FONT_WEIGHT_W200,ARKUI_FONT_WEIGHT_W300, + * ARKUI_FONT_WEIGHT_W400,ARKUI_FONT_WEIGHT_W500,ARKUI_FONT_WEIGHT_W600,ARKUI_FONT_WEIGHT_W700, + * ARKUI_FONT_WEIGHT_W800,ARKUI_FONT_WEIGHT_W900,ARKUI_FONT_WEIGHT_BOLD,ARKUI_FONT_WEIGHT_NORMAL, + * ARKUI_FONT_WEIGHT_BOLDER,ARKUI_FONT_WEIGHT_LIGHTER,ARKUI_FONT_WEIGHT_MEDIUM, + * ARKUI_FONT_WEIGHT_REGULAR时的显示效果测试 + */ + it('testTextFontWeight001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextHeightAdaptivePolicyTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextHeightAdaptivePolicyTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..dc171ba3ab7bc20d6f9ab76989ea5dd37bad6f34 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextHeightAdaptivePolicyTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textHeightAdaptivePolicyTest() { + + describe('TextHeightAdaptivePolicyTest', () => { + + let PAGE_TAG = 'TextHeightAdaptivePolicyTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置textAlign -10,ARKUI_TEXT_ALIGNMENT_CENTER, + * ARKUI_TEXT_ALIGNMENT_END,ARKUI_TEXT_ALIGNMENT_JUSTIFY时的显示效果测试 + */ + it('testTextHeightAdaptivePolicy001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..af46960d9d262bbd8febbf5fff0607fe3a542770 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textHeightTest() { + + describe('TextHeightTest', () => { + + let PAGE_TAG = 'TextHeightTest'; + let PAGE_TAG_LARGE = 'TextHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件height参数分别设置为200、-50时的显示效果测试 + it('testTextHeight001', 0, async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }) + + //text组件Height参数设置为500,超出父控件时的显示效果测试 + it('testTextHeight002', 0, async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLetterSpacingTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLetterSpacingTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b6e9d00b8563af8e86be7972e4d084777f6f620 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLetterSpacingTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textLetterSpacingTest() { + + describe('TextLetterSpacingTest', () => { + + let PAGE_TAG = 'TextLetterSpacingTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件参数设置letterSpacing 0,5,-2,-100时的显示效果测试 + it('testTextLetterSpacing001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLineBreakStrategyTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLineBreakStrategyTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e703ea1d8c00c65f3ba354db1a5eb902dcbdd71 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLineBreakStrategyTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textLineBreakStrategyTest() { + + describe('TextLineBreakStrategyTest', () => { + + let PAGE_TAG = 'TextLineBreakStrategyTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置copyOption ARKUI_COPY_OPTIONS_NONE + * ARKUI_COPY_OPTIONS_IN_APP + * ARKUI_COPY_OPTIONS_LOCAL_DEVICE + * ARKUI_COPY_OPTIONS_CROSS_DEVICE + * 枚举异常值(-1) 时的显示效果测试 + */ + it('testTextLineBreakStrategy001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLineHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLineHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..35e7acddf80643d961fa2019eafe683c3af167a6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLineHeightTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textLineHeightTest() { + + describe('TextLineHeightTest', () => { + + let PAGE_TAG = 'TextLineHeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件参数设置lineHeight 100,200,0时的显示效果测试 + it('testTextLineHeight001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLinearGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLinearGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..79347ee4600a4bcf540822a58b97895661ae3c2d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextLinearGradientTest.test.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textLinearGradientTest() { + + describe('TextLinearGradientTest', () => { + + let PAGE_TAG = 'TextLinearGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置linearGradient {.value[0].f32:90 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT .value[2].i32:false colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:180 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_TOP .value[2].i32:false colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:90 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT .value[2].i32:true colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:90 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_BOTTOM .value[2].i32:false colors:{0xFFFFFFFF, 0xFF0000FF, 0xFF000000} stops:{0.2, 0.5, 1} size:3} + * {.value[0].f32:90 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_TOP .value[2].i32:false colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:90 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT_BOTTOM .value[2].i32:false colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:90 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_TOP .value[2].i32:false colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:90 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_RIGHT_BOTTOM .value[2].i32:false colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:90 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_NONE .value[2].i32:false colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:90 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM .value[2].i32:false colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:90 .value[1].i32:ARKUI_LINEAR_GRADIENT_DIRECTION_LEFT .value[2].i32:false colors:{1234,1234} stops:{0.3, 1}size:2} + * {.value[0].f32:90 .value[1].i32:-1 .value[2].i32:false colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2}时的显示效果测试 + */ + it('testTextLinearGradient001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMaskTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMaskTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd4e54a78dde56c2f11840d70926c58e9c0819f3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMaskTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textMaskTest() { + + describe('TextMaskTest', () => { + + let PAGE_TAG = 'TextMaskTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置mask {.value[0].u32:0xFF000000 .value[1].u32:0xFF000000 .value[2].f32:5 .value[3].i32:ARKUI_MASK_TYPE_RECTANGLE .value[4].f32:40 .value[5].f32:40 .value[6].f32:10 .value[7].f32:10} + * {.value[0].u32:0xFFFF0000 .value[1].u32:0xFFFF0000 .value[2].f32:5 .value[3].i32:ARKUI_MASK_TYPE_CIRCLE .value[4].f32:50 .value[5].f32:50} + * {.value[0].u32:0xFFFFFFFF .value[1].u32:0xFFFFFFFF .value[2].f32:5 .value[3].i32:ARKUI_MASK_TYPE_ELLIPSE .value[4].f32:50 .value[5].f32:20} + * {.value[0].u32:0xFF000000 .value[1].u32:0xFF000000 .value[2].f32:5 .value[3].i32:ARKUI_MASK_TYPE_PATH .value[4].f32:40 .value[5].f32:40 ,string:""M0 20 L50 50 L50 100 Z""} + * {.value[0].i32:ARKUI_MASK_TYPE_PROGRESS .value[1].f32:40 .value[2].f32:60 .value[3].u32:0xFFFF0000} + * {.value[0].u32:1234 .value[1].u32:1234 .value[2].f32:-5 .value[3].i32:-1 .value[4].f32:-40 .value[5].f32:-40}时的显示效果测试 + */ + it('testTextMask001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMaxFontSizeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMaxFontSizeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ade86c82478ccc72e2ed9e263d0f64200289931d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMaxFontSizeTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textMaxFontSizeTest() { + + describe('TextMaxFontSizeTest', () => { + + let PAGE_TAG = 'TextMaxFontSizeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置textAlign -10,ARKUI_TEXT_ALIGNMENT_CENTER, + * ARKUI_TEXT_ALIGNMENT_END,ARKUI_TEXT_ALIGNMENT_JUSTIFY时的显示效果测试 + */ + it('testTextMaxFontSize001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMaxLinesTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMaxLinesTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..118ce09c9baae9a36990173ef7ba9da6d3dba471 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMaxLinesTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textMaxLinesTest() { + + describe('TextMaxLinesTest', () => { + + let PAGE_TAG = 'TextMaxLinesTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件参数设置maxLines 1,0,-1时的显示效果测试 + it('testTextMaxLines001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMinFontSizeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMinFontSizeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fbef8ea21d869844206075ae2c6edd559f6061f1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextMinFontSizeTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textMinFontSizeTest() { + + describe('TextMinFontSizeTest', () => { + + let PAGE_TAG = 'TextMinFontSizeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件参数设置minFontSize 20,0时的显示效果测试 + it('testTextMinFontSize001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextOffsetTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextOffsetTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6db67a00e939a0100e88fd191c81076c5079dc16 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextOffsetTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textOffsetTest() { + + describe('TextOffsetTest', () => { + + let PAGE_TAG = 'TextOffsetTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件参数设置offset {50,50},{-50,-50}时的显示效果测试 + it('testTextOffset001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextOpacityTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextOpacityTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0923926ffca732ed180d2d14f6861e32997ef1da --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextOpacityTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textOpacityTest() { + + describe('TextOpacityTest', () => { + + let PAGE_TAG = 'TextOpacityTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件参数设置opacity 0.5,1,0,2时的显示效果测试 + it('testTextOpacity001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextOverlayTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextOverlayTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..352f6de12b2a1b7d2da5a3b844a35fa0b3f965f5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextOverlayTest.test.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textOverlayTest() { + + describe('TextOverlayTest', () => { + + let PAGE_TAG = 'TextOverlayTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置Overlay .string:""A"" + * .string:"A" {.i32:ARKUI_ALIGNMENT_TOP_START .f32:20 .f32:20} + * .string:"A" .i32:ARKUI_ALIGNMENT_TOP + * .string:"A" .i32:ARKUI_ALIGNMENT_TOP_END + * .string:"A" .i32:ARKUI_ALIGNMENT_START + * .string:"A" .i32:ARKUI_ALIGNMENT_CENTER + * .string:"A" .i32:ARKUI_ALIGNMENT_END + * .string:"A" .i32:ARKUI_ALIGNMENT_BOTTOM_START + * .string:"A" .i32:ARKUI_ALIGNMENT_BOTTOM + * .string:"A" .i32:ARKUI_ALIGNMENT_BOTTOM_END + * .string:"A" {.i32:ARKUI_ALIGNMENT_TOP_START .f32:1000 .f32:1000} + * .string:"A" .i32:-1时的显示效果测试 + */ + it('testTextOverlay001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextPaddingTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextPaddingTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ace56f03210cfc4ef8ed76a97584e8c90b85d96 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextPaddingTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPaddingTest() { + + describe('TextPaddingTest', () => { + + let PAGE_TAG = 'TextPaddingTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件参数设置padding 20,[10,20,30,40],-20,[-10,-10,-10,-200]时的显示效果测试 + it('testTextPadding001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextPositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextPositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d08a7a4d12bcd09573bd782d7621ba56f9819e44 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextPositionTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPositionTest() { + + describe('TextPositionTest', () => { + + let PAGE_TAG = 'TextPositionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //Text组件position参数分别设置为{10,10},{-10,-10}时的显示效果测试 + it('testTextPosition001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextRadialGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextRadialGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..92af5e8936ee396d4680a63bdf3187c4a7752def --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextRadialGradientTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textRadialGradientTest() { + + describe('TextRadialGradientTest', () => { + + let PAGE_TAG = 'TextRadialGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置radialGradient {.value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF,0xFF000000} stops:{0.2,0.5, 1}size:3} + * {.value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:25 .value[1].f32:25 .value[2].f32:25 .value[3].i32:0 colors:{1234, 1234} stops:{0.3, 1}size:2} + * .value[0].f32:-25 .value[1].f32:-25 .value[2].f32:-25 .value[3].i32:-1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2}时的显示效果测试 + */ + it('testTextRadialGradient001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextScaleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextScaleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fed7ee3d45da8ee3fbd1e4eb74cc27ad9cc61a5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextScaleTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textScaleTest() { + + describe('TextScaleTest', () => { + + let PAGE_TAG = 'TextScaleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件参数设置scale {-1,-1},{0.5,0.5},{2,2}时的显示效果测试 + it('testTextScale001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextShadowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextShadowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4c2545e9b4bba2b31ffa51b5ce91db64fca34deb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextShadowTest.test.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textShadowTest() { + + describe('TextShadowTest', () => { + + let PAGE_TAG = 'TextShadowTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置shadow ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS,ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM, + * ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD,ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG,ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM, + * ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD,-10时的显示效果测试 + */ + it('testTextShadow001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextSweepGradientTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextSweepGradientTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5cb13db3b477d50b54cbdcc4a571191437fa1fa5 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextSweepGradientTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textSweepGradientTest() { + + describe('TextSweepGradientTest', () => { + + let PAGE_TAG = 'TextSweepGradientTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置sweepGradient {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:0 colors:{0xFFFFFFFF, 0xFF0000FF, 0xFF000000} stops:{0.2, 0.5, 1}size:3} + * {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2} + * {.value[0].f32:50 .value[1].f32:50 .value[2].f32:0 .value[3].f32:180 .value[4].f32:90 .value[5].i32:0 colors:{1234, 1234} stops:{0.3, 1}size:2} + * {.value[0].f32:-50 .value[1].f32:-50 .value[2].f32:-1 .value[3].f32:-180 .value[4].f32:-90 .value[5].i32:-1 colors:{0xFFFFFFFF, 0xFF0000FF} stops:{0.3, 1}size:2}时的显示效果测试 + */ + it('testTextSweepGradient001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextAlignTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextAlignTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb8880059eb96707da21fd68fe4566fb778bdf72 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextAlignTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textTextAlignTest() { + + describe('TextTextAlignTest', () => { + + let PAGE_TAG = 'TextTextAlignTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置textAlign -10,ARKUI_TEXT_ALIGNMENT_CENTER, + * ARKUI_TEXT_ALIGNMENT_END,ARKUI_TEXT_ALIGNMENT_JUSTIFY时的显示效果测试 + */ + it('testTextTextAlign001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextCaseTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextCaseTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea14ad7cec7345f6bac27180ae3b1f731c5d98b1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextCaseTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textTextCaseTest() { + + describe('TextTextCaseTest', () => { + + let PAGE_TAG = 'TextTextCaseTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件参数设置textCase -10,ARKUI_TEXT_CASE_LOWER,ARKUI_TEXT_CASE_UPPER时的显示效果测试 + it('testTextTextCase001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextIndentTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextIndentTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6467efd92404cf69f927964b7269bf89f6aed60d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextIndentTest.test.ets @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textTextIndentTest() { + + describe('TextTextIndentTest', () => { + + let PAGE_TAG = 'TextTextIndentTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // Text组件参数设置textIndent -10,20时的显示效果测试 + it('testTextTextIndent001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextOverflowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextOverflowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c7b5236f87c0783cdc01d18b4e763019cbf3cb8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextOverflowTest.test.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textTextOverflowTest() { + + describe('TextTextOverflowTest', () => { + + let PAGE_TAG = 'TextTextOverflowTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置textOverflow -10,ARKUI_TEXT_OVERFLOW_NONE, + * ARKUI_TEXT_OVERFLOW_ELLIPSIS,ARKUI_TEXT_OVERFLOW_MARQUEE时的显示效果测试 + */ + it('testTextOverflow001', 0, async (done: Function) => { + await Utils.sleep(10000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextShadowTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextShadowTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce0720ccf84575ffe55d58946c00b185f5af2151 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTextShadowTest.test.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textTextShadowTest() { + + describe('TextTextShadowTest', () => { + + let PAGE_TAG = 'TextTextShadowTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置textShadow [30,1234,0xFF000000,0,0],[30,ARKUI_SHADOW_TYPE_BLUR,0xFFFF0000,0,0], + * [50,ARKUI_SHADOW_TYPE_COLOR,0xFF000000,10,10],[-10,ARKUI_SHADOW_TYPE_COLOR,0xFF000000,10,10], + * [20,ARKUI_SHADOW_TYPE_COLOR,0xFF000000,40,40]时的显示效果测试 + */ + it('testTextTextShadow001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTransformTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTransformTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..98015fab3d6045a0d99044c3d245e278f3228bba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextTransformTest.test.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textTransformTest() { + + describe('TextTransformTest', () => { + + let PAGE_TAG = 'TextTransformTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + /* + * Text组件参数设置transform + * 0.5, 0, 0, 0, + * 0, 0.5, 0, 0, + * 0, 0, 1, 0, + * 100, 100, 0, 1 + * + * -1, 0, 0, 0, + * 0, -1, 0, 0, + * 0, 0, -1, 0, + * -100, -100, 0, 1; + * + * cos(45), -sin(45), 0, 0, + * sin(45), cos(45), 0, 0, + * 0, 0, 1, 0, + * 0, 0, 0, 1; + * + * 1, 0, 0, 0, + * 0, 1, 0, 0, + * 0, 0, 1, 0, + * 1000, 1000, 0, 1; + * + * 0, 0, 0, 0, + * 0, 0, 0, 0, + * 0, 0, 0, 0, + * 0, 0, 0, 0; + * 时的显示效果测试 + */ + it('testTextTransform001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextVisibilityTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextVisibilityTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..41690cdae6c15ee88406fedc1013a95b6763fb4c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextVisibilityTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textVisibilityTest() { + + describe('TextVisibilityTest', () => { + + let PAGE_TAG = 'TextVisibilityTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * Text组件参数设置visibility -10,ARKUI_VISIBILITY_VISIBLE, + * ARKUI_VISIBILITY_HIDDEN,ARKUI_VISIBILITY_NONE时的显示效果测试 + */ + it('testTextVisibility001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4bfc8cc056d82464bbc40863e5199cbd42d5b06 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/text/TextWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textWidthTest() { + + describe('TextWidthTest', () => { + + let PAGE_TAG = 'TextWidthTest'; + let PAGE_TAG_LARGE = 'TextWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Text组件width参数分别设置为300、-100时的显示效果测试 + it('testTextWidth001', 0, async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG}`, done); + }) + + //Text组件width参数设置为500,超出父控件时的显示效果测试 + it('testTextWidth002', 0, async (done: Function) => { + await Utils.pushPage(`text/${PAGE_TAG_LARGE}`, done); + }); + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaBackgroundColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaBackgroundColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..08655a3af9a1f673b4d143eaa143aca45ba5dee7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaBackgroundColorTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaBackgroundColorTest() { + + describe('TextAreaBackgroundColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件backgroundColor参数设置为0xFFFF0000时的显示效果测试 + it('testTextAreaBackgroundColor001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaBackgroundColorTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件backgroundColor参数设置为黑色时的显示效果测试 + it('testTextAreaBackgroundColor002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaBackgroundColorBlackTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件backgroundColor参数设置为白色时的显示效果测试 + it('testTextAreaBackgroundColor003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaBackgroundColorWhiteTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaBorderRadiusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaBorderRadiusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5247335fb6788cb2be625a3afa6beb7c4528c8a6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaBorderRadiusTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaBorderRadiusTest() { + + describe('TextAreaBorderRadiusTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件borderRadius参数设置为40时的显示效果测试 + it('testTextAreaBorderRadius001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaBorderRadiusSingleTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件borderRadius参数设置为10,40,10,40时的显示效果测试 + it('testTextAreaBorderRadius002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaBorderRadiusAllParamTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件borderRadius参数设置为-100时的显示效果测试 + it('testTextAreaBorderRadius003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaBorderRadiusAbnormalTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaCaretColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaCaretColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..2b5d8f79936d9e33d61b373330b4c8d97874353f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaCaretColorTest.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaCaretColorTest() { + + describe('TextAreaCaretColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件caretColor参数设置为0xFFFF0000时的显示效果测试 + it('testTextAreaCaretColor001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaCaretColorTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + await Utils.clickComponent('TextCaretColor'); + done(); + }) + + // TextArea组件caretColor参数设置为黑色时的显示效果测试 + it('testTextAreaCaretColor002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaCaretColorBlackTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + await Utils.clickComponent('TextCaretColor'); + done(); + }) + + // TextArea组件caretColor参数设置为白色时的显示效果测试 + it('testTextAreaCaretColor003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaCaretColorWhiteTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + await Utils.clickComponent('TextCaretColor'); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaDefaultFocusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaDefaultFocusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..74c830a9d8e98e209080646fdbd34936d40a9a0e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaDefaultFocusTest.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaDefaultFocusTest() { + + describe('TextAreaDefaultFocusTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShotByDriver(globalThis.context, 'test', done); + }) + + // TextArea组件defaultFocus参数设置为true的显示效果测试 + it('testTextAreaDefaultFocus001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaDefaultFocusTrueTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件defaultFocus参数设置为false的显示效果测试 + it('testTextAreaDefaultFocus002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaDefaultFocusFalseTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件defaultFocus参数不设置的显示效果测试 + it('testTextAreaDefaultFocus003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaDefaultFocusNoneTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // 参考组件defaultFocus参数设置true的显示效果测试 + it('testTextAreaDefaultFocus004', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaDefaultFocusSingleTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // 参考组件和测试组件都设置defaultFocus参数为true的显示效果测试 + it('testTextAreaDefaultFocus005', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaDefaultFocusMultiTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件defaultFocus参数设置为-10的显示效果测试 + it('testTextAreaDefaultFocus006', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaDefaultFocusAbnormalTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaEnabledTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaEnabledTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca71c08661186e633cff019a0307de58a11667a8 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaEnabledTest.test.ets @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaEnabledTest() { + + describe('TextAreaEnabledTest', () => { + + let PAGE_TAG = 'TextAreaEnabledTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textarea/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }) + + //TextArea组件enabled参数设置为true时的显示效果测试 + it('testTextAreaEnabled001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickEnabledTextArea') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurEnabledTextArea') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusEnabledTextArea') + await Utils.sleep(1000) + done(); + }) + + //TextArea组件enabled参数设置为false时的显示效果测试 + it('testTextAreaEnabled002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickDisabledTextArea') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurDisabledTextArea') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusDisabledTextArea') + await Utils.sleep(1000) + done(); + }) + + //TextArea组件enabled参数设置为-1时的显示效果测试 + it('testTextAreaEnabled003', 0, async (done: Function) => { + await Utils.clickComponent('OnClickAbnormalTextArea') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurAbnormalTextArea') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusAbnormalTextArea') + await Utils.sleep(1000) + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..03efea40813bb05b6736e37c88a5f1753ac67c5d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontColorTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaFontColorTest() { + + describe('TextAreaFontColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件fontColor参数设置为0xFFFF0000时的显示效果测试 + it('testTextAreaFontColor001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaFontColorTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件fontColor参数设置为黑色时的显示效果测试 + it('testTextAreaFontColor002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaFontColorBlackTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件fontColor参数设置为白色时的显示效果测试 + it('testTextAreaFontColor003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaFontColorWhiteTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontFamilyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontFamilyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd081fe7f1b5e9fc7f36161cfe6c1085a6e6690a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontFamilyTest.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaFontFamilyTest() { + + describe('TextAreaFontFamilyTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件fontFamily参数设置为HarmonyOS Sans时的显示效果测试 + it('testTextAreaFontFamily001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaFontFamilyTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件fontFamily参数设置为""时的显示效果测试 + it('testTextAreaFontFamily002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaFontFamilyNoneTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontSizeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontSizeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..47e81dc8cc15db118fa5f56d4b3b4105928e02da --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontSizeTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaFontSizeTest() { + + describe('TextAreaFontSizeTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件fontSize参数设置为30时的显示效果测试 + it('testTextAreaFontSize001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaFontSizeTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件fontSize参数设置为0时的显示效果测试 + it('testTextAreaFontSize002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaFontSizeNoneTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件fontSize参数设置为-100时的显示效果测试 + it('testTextAreaFontSize003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaFontSizeAbnormalTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontStyleTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontStyleTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0ecfec19d10a335fe9c38eb33ace10b51ad36a91 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontStyleTest.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaFontStyleTest() { + + describe('TextAreaFontStyleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件fontStyle参数设置为ARKUI_FONT_STYLE_NORMAL时的显示效果测试 + it('testTextAreaFontStyle001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaFontStyleNormalTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件fontStyle参数设置为ARKUI_FONT_STYLE_ITALIC时的显示效果测试 + it('testTextAreaFontStyle002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaFontStyleItalicTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontWeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontWeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3efad590089919a42e5b0e395427526aa18ab04 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaFontWeightTest.ets @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach, beforeAll } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +async function doIt(pageTag: string, testType: number, done?: Function) { + Utils.emitEvent(pageTag, testType, 1111) +} + +export default function textAreaFontWeightTest() { + + describe('TextAreaFontWeightTest', () => { + + let PAGE_TAG = 'TextAreaFontWeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textarea/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W100时的显示效果测试 + it('testTextAreaFontWeight001', 0, async (done: Function) => { + doIt(PAGE_TAG, 1); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W200时的显示效果测试 + it('testTextAreaFontWeight002', 0, async (done: Function) => { + doIt(PAGE_TAG, 2); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W300时的显示效果测试 + it('testTextAreaFontWeight003', 0, async (done: Function) => { + doIt(PAGE_TAG, 3); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W400时的显示效果测试 + it('testTextAreaFontWeight004', 0, async (done: Function) => { + doIt(PAGE_TAG, 4); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W500时的显示效果测试 + it('testTextAreaFontWeight005', 0, async (done: Function) => { + doIt(PAGE_TAG, 5); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W600时的显示效果测试 + it('testTextAreaFontWeight006', 0, async (done: Function) => { + doIt(PAGE_TAG, 6); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W700时的显示效果测试 + it('testTextAreaFontWeight007', 0, async (done: Function) => { + doIt(PAGE_TAG, 7); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W800时的显示效果测试 + it('testTextAreaFontWeight008', 0, async (done: Function) => { + doIt(PAGE_TAG, 8); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W900时的显示效果测试 + it('testTextAreaFontWeight009', 0, async (done: Function) => { + doIt(PAGE_TAG, 9); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_BOLD时的显示效果测试 + it('testTextAreaFontWeight010', 0, async (done: Function) => { + doIt(PAGE_TAG, 10); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_NORMAL时的显示效果测试 + it('testTextAreaFontWeight011', 0, async (done: Function) => { + doIt(PAGE_TAG, 11); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_BOLDER时的显示效果测试 + it('testTextAreaFontWeight012', 0, async (done: Function) => { + doIt(PAGE_TAG, 12); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_LIGHTER时的显示效果测试 + it('testTextAreaFontWeight013', 0, async (done: Function) => { + doIt(PAGE_TAG, 13); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_MEDIUM时的显示效果测试 + it('testTextAreaFontWeight014', 0, async (done: Function) => { + doIt(PAGE_TAG, 14); + done(); + }) + + // TextArea组件fontWeight参数设置为ARKUI_FONT_WEIGHT_REGULAR时的显示效果测试 + it('testTextAreaFontWeight015', 0, async (done: Function) => { + doIt(PAGE_TAG, 15); + done(); + }) + + // TextArea组件fontWeight参数设置为-100时的显示效果测试 + it('testTextAreaFontWeight016', 0, async (done: Function) => { + doIt(PAGE_TAG, 16); + done(); + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab17181a802ec3d99267c78d77f44dac65092e9b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaHeightTest() { + + describe('TextAreaHeightTest', () => { + + let PAGE_TAG = 'TextAreaHeightTest'; + let PAGE_TAG_LARGE = 'TextAreaHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //TextArea组件height参数分别设置为200、-50时的显示效果测试 + it('testTextAreaHeight001', 0, async (done: Function) => { + await Utils.pushPage(`textarea/${PAGE_TAG}`, done); + }); + + //TextArea组件height参数设置为500,超出父控件时的显示效果测试 + it('testTextAreaHeight002', 0, async (done: Function) => { + await Utils.pushPage(`textarea/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaKeyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaKeyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..1e717d859353a2bffc7c3b41f2c9ebe7a1ccbd99 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaKeyTest.ets @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaKeyTest() { + + describe('TextAreaKeyTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + done(); + }) + + // TextArea组件调用capi触发onClick的显示效果测试 + it('testTextAreaKey001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaKeyTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + await Utils.clickComponent('TextAreaKey'); + await Utils.sleep(3000); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaLineHeightTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaLineHeightTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9719e2d96de7a5b1c2d7c84b61f15569b4d6569a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaLineHeightTest.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaLineHeightTest() { + + describe('TextAreaLineHeightTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件lineHeight参数设置为100时的显示效果测试 + it('testTextAreaLineHeight001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaLineHeightTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件lineHeight参数设置为0时的显示效果测试 + it('testTextAreaLineHeight002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaLineHeightNoneTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaMaxLengthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaMaxLengthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..48ac90012432a4280108b052e719262b4343e12d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaMaxLengthTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaMaxLengthTest() { + + describe('TextAreaMaxLengthTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件MaxLength参数设置为10时的显示效果测试 + it('testTextAreaMaxLength001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaMaxLengthTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件MaxLength参数设置为0时的显示效果测试 + it('testTextAreaMaxLength002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaMaxLengthNoneTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件MaxLength参数设置为-100时的显示效果测试 + it('testTextAreaMaxLength003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaMaxLengthAbnormalTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaOnBlurTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaOnBlurTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb10e474a35522fa032bbbdf39299bdafac872c7 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaOnBlurTest.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaOnBlurTest() { + + describe('TextAreaOnBlurTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + done(); + }) + + // TextArea组件调用capi触发onBlur的显示效果测试 + it('testTextAreaOnBlur001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaOnBlurTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + await Utils.clickComponent('TextAreaOnBlur'); + await Utils.clickComponent('TextAreaOnFocusCompare'); + await Utils.sleep(3000); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaOnChangeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaOnChangeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..d99f23446f85ab86a905ddfabe6c8a0d1b2a2ece --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaOnChangeTest.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaOnChangeTest() { + + describe('TextAreaOnChangeTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件调用capi触发onchange的显示效果测试 + it('testTextAreaOnChange001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaOnChangeTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaOnFocusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaOnFocusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..b793b8dcff5c60c4a3525ecc100dbf9dc50caf40 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaOnFocusTest.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaOnFocusTest() { + + describe('TextAreaOnFocusTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // textarea组件调用capi设置onFocus正常触发的场景 + it('testTextAreaOnFocus001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaOnFocusTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + focusControl.requestFocus('TextAreaOnFocus'); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPaddingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPaddingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..be891051e520c64463148539e45e557fd57e4bfa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPaddingTest.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaPaddingTest() { + + describe('TextAreaPaddingTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件padding参数设置为20时的显示效果测试 + it('testTextAreaPadding001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaPaddingTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件padding参数设置为10,20,30,40时的显示效果测试 + it('testTextAreaPadding002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaPaddingAllTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPlaceHolderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPlaceHolderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..5fdd9184daf71d2adfe2c4c0b0f4b91b77e68eb0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPlaceHolderColorTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaPlaceHolderColorTest() { + + describe('TextAreaPlaceHolderColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件placeholderColor参数设置为0xFFFF0000时的显示效果测试 + it('testTextAreaPlaceholderColor001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaPlaceHolderColorTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件placeholderColor参数设置为黑色时的显示效果测试 + it('testTextAreaPlaceholderColor002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaPlaceHolderColorBlackTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件placeholderColor参数设置为白色时的显示效果测试 + it('testTextAreaPlaceholderColor003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaPlaceHolderColorWhiteTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPlaceholderFontTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPlaceholderFontTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..23cb16220a6bcbf16a0952f5e422bff54db5f85d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPlaceholderFontTest.ets @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach, beforeAll } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +async function doIt(pageTag: string, testType: number, done?: Function) { + Utils.emitEvent(pageTag, testType, 7777) +} + +export default function textAreaPlaceholderFontTest() { + + describe('TextAreaPlaceholderFontTest', () => { + + let PAGE_TAG = 'TextAreaPlaceholderFontTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textarea/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件placeholderFont参数设置为16.0,ARKUI_FONT_STYLE_NORMAL,ARKUI_FONT_WEIGHT_NORMAL的显示效果测试 + it('testTextAreaPlaceholderFont001', 0, async (done: Function) => { + doIt(PAGE_TAG, 1); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_NORMAL,ARKUI_FONT_WEIGHT_NORMAL的显示效果测试 + it('testTextAreaPlaceholderFont002', 0, async (done: Function) => { + doIt(PAGE_TAG, 2); + done(); + }) + + // TextArea组件placeholderFont参数设置为16.0的显示效果测试(验证ArkUI_FontStyle默认值) + it('testTextAreaPlaceholderFont003', 0, async (done: Function) => { + doIt(PAGE_TAG, 3); + done(); + }) + + // TextArea组件placeholderFont参数设置为16.0的显示效果测试(验证ArkUI_FontWeight默认值) + it('testTextAreaPlaceholderFont004', 0, async (done: Function) => { + doIt(PAGE_TAG, 4); + done(); + }) + + // TextArea组件placeholderFont默认的显示效果测试 + it('testTextAreaPlaceholderFont005', 0, async (done: Function) => { + doIt(PAGE_TAG, 5); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W100的显示效果测试 + it('testTextAreaPlaceholderFont006', 0, async (done: Function) => { + doIt(PAGE_TAG, 6); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W200的显示效果测试 + it('testTextAreaPlaceholderFont007', 0, async (done: Function) => { + doIt(PAGE_TAG, 7); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W300的显示效果测试 + it('testTextAreaPlaceholderFont008', 0, async (done: Function) => { + doIt(PAGE_TAG, 8); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W400的显示效果测试 + it('testTextAreaPlaceholderFont009', 0, async (done: Function) => { + doIt(PAGE_TAG, 9); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W500的显示效果测试 + it('testTextAreaPlaceholderFont010', 0, async (done: Function) => { + doIt(PAGE_TAG, 10); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W600的显示效果测试 + it('testTextAreaPlaceholderFont011', 0, async (done: Function) => { + doIt(PAGE_TAG, 11); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W700的显示效果测试 + it('testTextAreaPlaceholderFont012', 0, async (done: Function) => { + doIt(PAGE_TAG, 12); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W800的显示效果测试 + it('testTextAreaPlaceholderFont013', 0, async (done: Function) => { + doIt(PAGE_TAG, 13); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W900的显示效果测试 + it('testTextAreaPlaceholderFont014', 0, async (done: Function) => { + doIt(PAGE_TAG, 14); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_BOLD的显示效果测试 + it('testTextAreaPlaceholderFont015', 0, async (done: Function) => { + doIt(PAGE_TAG, 15); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_NORMAL的显示效果测试 + it('testTextAreaPlaceholderFont016', 0, async (done: Function) => { + doIt(PAGE_TAG, 16); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_BOLDER的显示效果测试 + it('testTextAreaPlaceholderFont017', 0, async (done: Function) => { + doIt(PAGE_TAG, 17); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_LIGHTER的显示效果测试 + it('testTextAreaPlaceholderFont018', 0, async (done: Function) => { + doIt(PAGE_TAG, 18); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_MEDIUM的显示效果测试 + it('testTextAreaPlaceholderFont019', 0, async (done: Function) => { + doIt(PAGE_TAG, 19); + done(); + }) + + // TextArea组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_REGULAR的显示效果测试 + it('testTextAreaPlaceholderFont020', 0, async (done: Function) => { + doIt(PAGE_TAG, 20); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b6f3e7284c45e1af789ae54fdd5f16ace90f186e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaPositionTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaPositionTest() { + + describe('TextAreaPositionTest', () => { + + let PAGE_TAG = 'TextAreaPositionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textarea/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //TextArea组件position参数分别设置为{10,10},{-10,-10}时的显示效果测试 + it('testTextAreaPosition001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaResponseRegionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaResponseRegionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4758839d98997923ad47b84f1a9a5247240815bb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaResponseRegionTest.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach, beforeAll } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaResponseRegionTest() { + + describe('TextAreaResponseRegionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件responseRegion参数设置为40,-80,80,60的显示效果测试 + it('testTextAreaResponseRegion001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaResponseRegionSingleTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + let rect = Utils.getComponentRect("ResponseRegion"); + let X = Utils.getRectHorizontalCenterX(rect); + let Y = Utils.getRectVerticalCenterY(rect); + console.log("Utils.getRectHorizontalCenterX = " + X); + console.log("Utils.getRectVerticalCenterY = " + Y); + Utils.clickLocation(X, Y + 100); + done(); + }) + + // TextArea组件responseRegion参数设置为40,-80,80,60,80,-40,60,80的显示效果测试 + it('testTextAreaResponseRegion002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaResponseRegionDoubleTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + let rect = Utils.getComponentRect("ResponseRegionMulti"); + let X = Utils.getRectHorizontalCenterX(rect); + let Y = Utils.getRectVerticalCenterY(rect); + Utils.clickLocation(X, Y + 100); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaStopEditingTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaStopEditingTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e219e344001d7a0031c3db23a0def7000631bf9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaStopEditingTest.ets @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +async function doIt(pageTag: string, testType: number, done?: Function) { + Utils.emitEvent(pageTag, testType, 6666) +} + +export default function textAreaStopEditingTest() { + + describe('TextAreaStopEditingTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件进入编辑态stopEditing参数设置为true时的显示效果测试 + it('testTextAreaStopEditing001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaStopEditingTrueTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + await Utils.clickComponent('Stop'); + await Utils.sleep(2000); + doIt(PAGE_TAG, 1); + await Utils.sleep(2000); + done(); + }) + + // TextArea组件进入编辑态stopEditing参数设置为false时的显示效果测试 + it('testTextAreaStopEditing002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaStopEditingFalseTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + await Utils.clickComponent('Stop'); + await Utils.sleep(2000); + doIt(PAGE_TAG, 2); + await Utils.sleep(2000); + done(); + }) + + // TextArea组件不进入编辑态stopEditing参数设置为true时的显示效果测试 + it('testTextAreaStopEditing003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaStopEditingNoneTrueTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + doIt(PAGE_TAG, 3); + await Utils.sleep(2000); + done(); + }) + + // TextArea组件不进入编辑态stopEditing参数设置为false时的显示效果测试 + it('testTextAreaStopEditing004', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaStopEditingNoneFalseTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + doIt(PAGE_TAG, 4); + await Utils.sleep(2000); + done(); + }) + + // TextArea组件进入编辑态stopEditing参数设置为-10时的显示效果测试 + it('testTextAreaStopEditing005', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaStopEditingAbnormalTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + await Utils.clickComponent('Stop'); + await Utils.sleep(1000); + doIt(PAGE_TAG, 5); + await Utils.sleep(2000); + done(); + }) + + // TextArea组件不进入编辑态stopEditing参数设置为-10时的显示效果测试 + it('testTextAreaStopEditing006', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaStopEditingNoneAbnormalTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + doIt(PAGE_TAG, 6); + await Utils.sleep(2000); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaTextAlignTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaTextAlignTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..034c2ce78ed9192f713f9f82e042ccfc36b5c1ce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaTextAlignTest.ets @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaTextAlignTest() { + + describe('TextAreaTextAlignTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextArea组件textAlign参数设置为ARKUI_TEXT_ALIGNMENT_START时的显示效果测试 + it('testTextAreaTextAlign001', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaTextAlignStartTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件textAlign参数设置为ARKUI_TEXT_ALIGNMENT_CENTER时的显示效果测试 + it('testTextAreaTextAlign002', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaTextAlignCenterTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件textAlign参数设置为ARKUI_TEXT_ALIGNMENT_END时的显示效果测试 + it('testTextAreaTextAlign003', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaTextAlignEndTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件textAlign参数设置为ARKUI_TEXT_ALIGNMENT_JUSTIFY时的显示效果测试 + it('testTextAreaTextAlign004', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaTextAlignJustifyTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + + // TextArea组件textAlign参数设置为-100时的显示效果测试 + it('testTextAreaTextAlign005', 0, async (done: Function) => { + let PAGE_TAG = 'TextAreaTextAlignAbnormalTest'; + await Utils.pushPage(`textarea/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..253e8a2ce5e6aafed8154e10be077bbae2204457 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textarea/TextAreaWidthTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textAreaWidthTest() { + + describe('TextAreaWidthTest', () => { + + let PAGE_TAG = 'TextAreaWidthTest'; + let PAGE_TAG_LARGE = 'TextAreaWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //TextArea组件width参数分别设置为300、-100时的显示效果测试 + it('testTextAreaWidth001', 0, async (done: Function) => { + await Utils.pushPage(`textarea/${PAGE_TAG}`, done); + }); + + //TextArea组件width参数设置为500,超出父控件时的显示效果测试 + it('testTextAreaWidth002', 0, async (done: Function) => { + await Utils.pushPage(`textarea/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e02f16142ba99123f79c9d8c86548b6fd88a002f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputBackgroundColorTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputBackgroundColorTest() { + + describe('TextInputBackgroundColorTest', () => { + + let PAGE_TAG = 'TextInputBackgroundColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * TextInput组件backgroundColor参数设置为0xFFFF0000时的显示效果测试 + * TextInput组件backgroundColor参数设置为0xFF000000时的显示效果测试 + */ + it('testTextInputBackgroundColor001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputBackgroundImageTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputBackgroundImageTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2a07db00af19a1300f58a4b35457e9c00624998e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputBackgroundImageTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputBackgroundImageTest() { + + describe('TextInputBackgroundImageTest', () => { + + let PAGE_TAG = 'TextInputBackgroundImageTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * TextInput组件backgroundImage参数设置为ARKUI_IMAGE_REPEAT_NONE时的显示效果测试 + * TextInput组件backgroundImage参数设置为ARKUI_IMAGE_REPEAT_X时的显示效果测试 + * TextInput组件backgroundImage参数设置为ARKUI_IMAGE_REPEAT_Y时的显示效果测试 + * TextInput组件backgroundImage参数设置为ARKUI_IMAGE_REPEAT_XY时的显示效果测试 + * TextInput组件backgroundImage参数设置为ARKUI_IMAGE_REPEAT_NONE时加载网络图片的显示效果测试 + * TextInput组件backgroundImage参数设置为-100时加载图片的显示效果测试 + */ + it('testTextInputBackgroundImage001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputCaretColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputCaretColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1d14ed9573d7ce696b63808ca4a9162991d2961 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputCaretColorTest.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputCaretColorTest() { + + describe('TextInputCaretColorTest', () => { + + let PAGE_TAG = 'TextInputCaretColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件caretColor参数设置为0xFFFF0000时的显示效果测试 + it('testTextInputCaretColor001', 0, async (done: Function) => { + await Utils.clickComponent('onTouchFirstTextInputCaretColor') + await Utils.sleep(2000) + done() + }) + + // TextInput组件caretColor参数设置为0xFF000000时的显示效果测试 + it('testTextInputCaretColor002', 0, async (done: Function) => { + await Utils.clickComponent('onTouchSecondTextInputCaretColor') + await Utils.sleep(2000) + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputCaretStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputCaretStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..316e93c2db00c4421e80cca68808c77af8cd23ac --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputCaretStyleTest.test.ets @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputCaretStyleTest() { + + describe('TextInputCaretStyleTest', () => { + + let PAGE_TAG = 'TextInputCaretStyleTest'; + let PAGE_LARGE_TAG = 'TextInputCaretStyleLargeTest'; + let PAGE_ABNORMAL_TAG = 'TextInputCaretStyleAbnormalTest'; + let PAGE_DECIMAL_TAG = 'TextInputCaretStyleDecimalTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //TextInput组件caretStyle参数分别设置为10时的显示效果测试 + it('testTextInputCaretStyle001', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_LARGE_TAG}`); + await Utils.clickComponent('caretStyle_10_textInput') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件caretStyle参数分别设置为1时的显示效果测试 + it('testTextInputCaretStyle002', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`); + await Utils.clickComponent('caretStyle_1_textInput') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件caretStyle参数分别设置为-1时的显示效果测试 + it('testTextInputCaretStyle003', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_ABNORMAL_TAG}`); + await Utils.clickComponent('caretStyle_-1_textInput') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件caretStyle参数分别设置为10.5时的显示效果测试 + it('testTextInputCaretStyle004', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_DECIMAL_TAG}`); + await Utils.clickComponent('caretStyle_10_5_textInput') + await Utils.sleep(1000) + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputClearButtonModeTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputClearButtonModeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..814089c7e39f6ba22c25ce59244c85f31114e80b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputClearButtonModeTest.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach, beforeAll } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputClearButtonModeTest() { + + describe('TextInputClearButtonModeTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件clearButtonMode参数设置为ARKUI_CANCELBUTTON_STYLE_INPUT的显示效果测试 + it('testTextInputClearButtonMode001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputClearButtonModeInputTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件clearButtonMode参数设置为ARKUI_CANCELBUTTON_STYLE_INVISIBLE的显示效果测试 + it('testTextInputClearButtonMode002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputClearButtonModeInvisibleTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件clearButtonMode参数设置为ARKUI_CANCELBUTTON_STYLE_CONSTANT的显示效果测试 + it('testTextInputClearButtonMode003', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputClearButtonModeConstantTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件clearButtonMode参数设置为异常值的显示效果测试 + it('testTextInputClearButtonMode004', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputClearButtonModeAbnormalTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputClipTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputClipTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..66dbd79d81119d52cb3ae6fc608d93b7625b174d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputClipTest.test.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputClipTest() { + + describe('TextInputClipTest', () => { + + let PAGE_TAG = 'TextInputClipTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * TextInput组件clip参数设置为ARKUI_CLIP_TYPE_RECTANGLE时的显示效果测试 + * TextInput组件clip参数设置为ARKUI_CLIP_TYPE_CIRCLE时的显示效果测试 + * TextInput组件clip参数设置为ARKUI_CLIP_TYPE_ELLIPSE时的显示效果测试 + * TextInput组件clip参数设置为ARKUI_CLIP_TYPE_PATH时的显示效果测试 + */ + it('testTextInputClip001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputDefaultFocusTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputDefaultFocusTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..97ef7c615935b8e3b44788026d42623402b26188 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputDefaultFocusTest.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputDefaultFocusTest() { + + describe('TextInputDefaultFocusTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件defaultFocus参数设置为true的显示效果测试 + it('testTextInputDefaultFocus001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputDefaultFocusTrueTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件defaultFocus参数设置为false的显示效果测试 + it('testTextInputDefaultFocus002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputDefaultFocusFalseTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件defaultFocus参数不设置的显示效果测试 + it('testTextInputDefaultFocus003', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputDefaultFocusNoneTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // 参考组件defaultFocus参数设置true的显示效果测试 + it('testTextInputDefaultFocus004', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputDefaultFocusSingleTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // 参考组件和测试组件都设置defaultFocus参数为true的显示效果测试 + it('testTextInputDefaultFocus005', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputDefaultFocusMultiTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件defaultFocus参数设置-10的显示效果测试 + it('testTextInputDefaultFocus006', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputDefaultFocusAbnormalTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputEnableKeyboardOnFocusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputEnableKeyboardOnFocusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3edc51b607e3e4e2904b5bec4e5d8c365e7b81e2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputEnableKeyboardOnFocusTest.test.ets @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputEnableKeyboardOnFocusTest() { + + describe('TextInputEnableKeyboardOnFocusTest', () => { + + let PAGE_TAG = 'TextInputEnableKeyboardOnFocusTest'; + let PAGE_TAG_DISABLED = 'TextInputEnableKeyboardOnFocusDisableTest'; + let PAGE_TAG_ABNORMAL = 'TextInputEnableKeyboardOnFocusAbnormalTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShotByDriver(globalThis.context, 'test', done); + }); + + //TextInput组件enableKeyboardOnFocus参数设置为1时的显示效果测试 + it('testTextInputEnableKeyboardOnFocus001', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`); + focusControl.requestFocus('OnFocusEnableKeyBoard') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件enableKeyboardOnFocus参数设置为0时的显示效果测试 + it('testTextInputEnableKeyboardOnFocus002', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_DISABLED}`); + focusControl.requestFocus('OnFocusDisableKeyBoard') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件enableKeyboardOnFocus参数设置为-1时的显示效果测试 + it('testTextInputEnableKeyboardOnFocus003', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_ABNORMAL}`); + focusControl.requestFocus('OnFocusAbnormal') + await Utils.sleep(1000) + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputEnabledTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputEnabledTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9450d064740072fb7fb54e23172e62ad089239d0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputEnabledTest.test.ets @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputEnabledTest() { + + describe('TextInputEnabledTest', () => { + + let PAGE_TAG = 'TextInputEnabledTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //TextInput组件enabled参数设置为1时的显示效果测试 + it('testTextInputEnabled001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickEnabledTextInput') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurEnabledTextInput') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusEnabledTextInput') + await Utils.sleep(1000) + + done(); + }) + + //TextInput组件enabled参数设置为0时的显示效果测试 + it('testTextInputEnabled002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickDisabledTextInput') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurDisabledTextInput') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusDisabledTextInput') + await Utils.sleep(1000) + + done(); + }) + + //TextInput组件enabled参数设置为-1时的显示效果测试 + it('testTextInputEnabled003', 0, async (done: Function) => { + await Utils.clickComponent('OnClickAbnormalTextInput') + await Utils.sleep(1000) + + focusControl.requestFocus('OnBlurAbnormalTextInput') + await Utils.sleep(1000) + + focusControl.requestFocus('OnFocusAbnormalTextInput') + await Utils.sleep(1000) + + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputEnterKeyTypeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputEnterKeyTypeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..80bf689578684dc94c1e6bb3036c74df0f21983f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputEnterKeyTypeTest.test.ets @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputEnterKeyTypeTest() { + + describe('TextInputEnterKeyTypeTest', () => { + + let PAGE_TAG_TYPE_GO = 'TextInputEnterKeyTypeTest'; + let PAGE_TAG_TYPE_SEARCH = 'TextInputEnterKeyTypeSearchTest'; + let PAGE_TAG_TYPE_SEND = 'TextInputEnterKeyTypeSendTest'; + let PAGE_TAG_TYPE_NEXT = 'TextInputEnterKeyTypeNextTest'; + let PAGE_TAG_TYPE_DONE = 'TextInputEnterKeyTypeDoneTest'; + let PAGE_TAG_TYPE_PREVIOUS = 'TextInputEnterKeyTypePreviousTest'; + let PAGE_TAG_TYPE_NEWLINE = 'TextInputEnterKeyTypeNewLineTest'; + let PAGE_TAG_TYPE_ABNORMAL = 'TextInputEnterKeyTypeAbnormalTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShotByDriver(globalThis.context, 'test', done); + }); + + //TextInput组件enterKeyType参数设置为ARKUI_ENTER_KEY_TYPE_GO时的显示效果测试 + it('testTextInputEnterKeyType001', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_TYPE_GO}`); + await Utils.clickComponent('OnClickTypeGo') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件enterKeyType参数设置为ARKUI_ENTER_KEY_TYPE_SEARCH时的显示效果测试 + it('testTextInputEnterKeyType002', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_TYPE_SEARCH}`); + await Utils.clickComponent('OnClickTypeSearch') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件enterKeyType参数设置为ARKUI_ENTER_KEY_TYPE_SEND时的显示效果测试 + it('testTextInputEnterKeyType003', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_TYPE_SEND}`); + await Utils.clickComponent('OnClickTypeSend') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件enterKeyType参数设置为ARKUI_ENTER_KEY_TYPE_NEXT时的显示效果测试 + it('testTextInputEnterKeyType004', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_TYPE_NEXT}`); + await Utils.clickComponent('OnClickTypeNext') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件enterKeyType参数设置为ARKUI_ENTER_KEY_TYPE_DONE时的显示效果测试 + it('testTextInputEnterKeyType005', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_TYPE_DONE}`); + await Utils.clickComponent('OnClickTypeDone') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件enterKeyType参数设置为ARKUI_ENTER_KEY_TYPE_PREVIOUS时的显示效果测试 + it('testTextInputEnterKeyType006', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_TYPE_PREVIOUS}`); + await Utils.clickComponent('OnClickTypePrevious') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件enterKeyType参数设置为时ARKUI_ENTER_KEY_TYPE_NEW_LINE的显示效果测试 + it('testTextInputEnterKeyType007', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_TYPE_NEWLINE}`); + await Utils.clickComponent('OnClickTypeNewLine') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件enterKeyType参数设置为-1时的显示效果测试 + it('testTextInputEnterKeyType008', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_TYPE_ABNORMAL}`); + await Utils.clickComponent('OnClickAbnormal') + await Utils.sleep(1000) + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b83ffd55e0fc74cd8bc47236c294eb154d5a1d45 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontColorTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputFontColorTest() { + + describe('TextInputFontColorTest', () => { + + let PAGE_TAG = 'TextInputFontColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * TextInput组件fontColor参数设置为0xFFFF0000时的显示效果测试 + * TextInput组件fontColor参数设置为0xFF000000时的显示效果测试 + */ + it('testTextInputFontColor001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontFamilyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontFamilyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dac93498ba95fff8a8c2182577fd1a795b6f239d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontFamilyTest.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach, beforeAll } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputFontFamilyTest() { + + describe('TextInputFontFamilyTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件fontFamily参数设置为"HarmonyOS Sans"的显示效果测试 + it('testTextInputFontFamily001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputFontFamilySingleTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件fontFamily参数设置为"HarmonyOS Sans STR_AREA"的显示效果测试 + it('testTextInputFontFamily002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputFontFamilyAddTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontSizeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontSizeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..65cc85806387eae8aa613c1ad8643df27cafb0f3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontSizeTest.test.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputFontSizeTest() { + + describe('TextInputFontSizeTest', () => { + + let PAGE_TAG = 'TextInputFontSizeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * TextInput组件fontSize参数设置为0时的显示效果测试 + * TextInput组件fontSize参数设置为10时的显示效果测试 + * TextInput组件fontSize参数设置为12.5时的显示效果测试 + * TextInput组件fontSize参数设置为-1时的显示效果测试 + */ + it('testTextInputFontSize001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..48704753ba42d1875ba0ba8b560ddaf2aee7de28 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontStyleTest.test.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputFontStyleTest() { + + describe('TextInputFontStyleTest', () => { + + let PAGE_TAG = 'TextInputFontStyleTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * TextInput组件fontStyle参数设置为ARKUI_FONT_STYLE_NORMAL时的显示效果测试 + * TextInput组件fontStyle参数设置为ARKUI_FONT_STYLE_ITALIC时的显示效果测试 + * TextInput组件fontStyle参数设置为-100时的显示效果测试 + */ + it('testTextInputFontStyle001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontWeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontWeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..40f2d2afe72b47117accb45a4427cceea4b59e02 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputFontWeightTest.test.ets @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputFontWeightTest() { + + describe('TextInputFontWeightTest', () => { + + let PAGE_TAG = 'TextInputFontWeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W100时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W200时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W300时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W400时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W500时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W600时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W700时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W800时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_W900时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_BOLD时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_NORMAL时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_BOLDER时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_LIGHTER时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_MEDIUM时的显示效果测试 + * TextInput组件fontWeight参数设置为ARKUI_FONT_WEIGHT_REGULAR时的显示效果测试 + * TextInput组件fontWeight参数设置为-100时的显示效果测试 + */ + it('testTextInputFontWeight001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b3d807de95257c1eec0a973fc6971e6e6b31dfd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputHeightTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputHeightTest() { + + describe('TextInputHeightTest', () => { + + let PAGE_TAG = 'TextInputHeightTest'; + let PAGE_TAG_LARGE = 'TextInputHeightLargeTest'; + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //TextInput组件height参数分别设置为200、-50时的显示效果测试 + it('testTextInputHeight001', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + //TextInput组件height参数设置为500,超出父控件时的显示效果测试 + it('testTextInputHeight002', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputKeyTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputKeyTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f853234e4ea37104d233a367abd7bc07b89416c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputKeyTest.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputKeyTest() { + + describe('TextInputKeyTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + done(); + }) + + // TextInput组件调用capi触发onClick的显示效果测试 + it('testTextInputKey001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputKeyTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + await Utils.clickComponent('KEY'); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputLineHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputLineHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..58b0e4102a6479473b78f17d3f28ea66c5d100d9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputLineHeightTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputLineHeightTest() { + + describe('TextInputLineHeightTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件设置lineHeight的正常场景 + it('testTextInputLineHeight001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputLineHeightTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + done(); + }) + + // TextInput组件设置lineHeight的异常场景 + it('testTextInputLineHeight002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputLineHeightAbnormalTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputMaxLengthTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputMaxLengthTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a82d57537f8f3880aca9af81e5a1fd1ecf0b9df1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputMaxLengthTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach, beforeAll } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputMaxLengthTest() { + + describe('TextInputMaxLengthTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件maxLength参数设置为8的显示效果测试 + it('testTextInputMaxLength001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputMaxLengthTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件maxLength参数设置为0的显示效果测试 + it('testTextInputMaxLength002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputMaxLengthNoneTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件maxLength参数设置为-100的显示效果测试 + it('testTextInputMaxLength003', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputMaxLengthAbnormalTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnBlurTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnBlurTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d08f0580c02e66f90ea4ebcd7f4410972116469e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnBlurTest.test.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputOnBlurTest() { + + describe('TextInputOnBlurTest', () => { + + let PAGE_TAG = 'TextInputOnBlurTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //TextInput组件调用capi设置enabled为true,通用事件onBlur正常触发的场景 + it('testTextInputOnBlur001', 0, async (done: Function) => { + focusControl.requestFocus('OnBlurTestTextInputCompare') + await Utils.sleep(2000) + focusControl.requestFocus('OnBlurTestTextInput') + await Utils.sleep(2000) + done() + }) + + + //TextInput组件调用capi设置enabled为false,通用事件onBlur无法触发的场景 + it('testTextInputOnBlur002', 0, async (done: Function) => { + focusControl.requestFocus('OnBlurTestTextInputDisable') + await Utils.sleep(2000) + focusControl.requestFocus('OnBlurTestTextInput') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5bbf05809112e27b9bde979cb0bc6f2ef1acf5f1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnChangeTest.test.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputOnChangeTest() { + + describe('TextInputOnChangeTest', () => { + + let PAGE_TAG = 'TextInputOnChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //TextInput组件onChange回调触发时的显示效果测试 + it('testTextInputOnChange001', 0, async (done: Function) => { + await Utils.clickComponent('OnChangeTextInput') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件onChange回调不触发时的显示效果测试 + it('testTextInputOnChange002', 0, async (done: Function) => { + await Utils.clickComponent('OnChangeTextInputDisabled'); + await Utils.sleep(1000); + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnCutTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnCutTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..436c39fb3f65cfb51ec7e54d2d1b0c282816bf49 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnCutTest.test.ets @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputOnCutTest() { + + describe('TextInputOnCutTest', () => { + + let PAGE_TAG = 'TextInputOnCutTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //TextInput组件调用capi监听onCut正常触发的场景 + it('testTextInputOnCut001', 0, async (done: Function) => { + focusControl.requestFocus('OnCutTestTextInput') + await Utils.sleep(2000) + await Utils.doubleClickComponent('OnCutTestTextInput') + await Utils.sleep(2000) + await Utils.clickComponentByText('剪切') + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnFocusTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnFocusTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9fbcc9d2559540e687ddc50962a8dfe930e7c3aa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnFocusTest.test.ets @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputOnFocusTest() { + + describe('TextInputOnFocusTest', () => { + + let PAGE_TAG = 'TextInputOnFocusTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //TextInput组件调用capi设置enabled为true,通用事件onFocus正常触发的场景 + it('testTextInputOnFocus001', 0, async (done: Function) => { + focusControl.requestFocus('OnFocusTestTextInputCompare') + await Utils.sleep(2000) + focusControl.requestFocus('OnFocusTestTextInput') + await Utils.sleep(2000) + done() + }) + + //TextInput组件调用capi设置enabled为false,通用事件onFocus无法触发的场景 + it('testTextInputOnFocus002', 0, async (done: Function) => { + focusControl.requestFocus('OnFocusTestTextInput') + await Utils.sleep(2000) + focusControl.requestFocus('OnFocusTestTextInputDisable') + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnPasteTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnPasteTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c436308cc767ae0e0d5606d1ec1cd34b079dbb8f --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnPasteTest.test.ets @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputOnPasteTest() { + + describe('TextInputOnPasteTest', () => { + + let PAGE_TAG = 'TextInputOnPasteTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //TextInput组件调用capi监听onPaste正常触发的场景 + it('testTextInputOnPaste001', 0, async (done: Function) => { + focusControl.requestFocus('OnPasteTestTextInput') + await Utils.sleep(1000) + await Utils.doubleClickComponent('OnPasteTestTextInput') + await Utils.sleep(1000) + await Utils.clickComponentByText('剪切') + await Utils.sleep(1000) + focusControl.requestFocus('OnPasteTestTextInputCompare') + await Utils.sleep(1000) + await Utils.doubleClickComponent('OnPasteTestTextInputCompare') + await Utils.sleep(1000) + await Utils.clickComponentByText('粘贴') + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnSubmitTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnSubmitTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..98ae8731fa7fe2cd4cf9b9de4c71a608020d2fba --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputOnSubmitTest.test.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputOnSubmitTest() { + + describe('TextInputOnSubmitTest', () => { + + let PAGE_TAG = 'TextInputOnSubmitTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //TextInput组件调用capi监听onSubmit正常触发的场景 + it('testTextInputOnSubmit001', 0, async (done: Function) => { + focusControl.requestFocus('OnSubmitTestTextInput') + await Utils.sleep(2000) + await Utils.triggerKey(2054) + await Utils.sleep(2000) + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPaddingTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPaddingTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d56ddf845b72e89b84d0bebdd290b0f39ce3139 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPaddingTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputPaddingTest() { + + describe('TextInputPaddingTest', () => { + + let PAGE_TAG = 'TextInputPaddingTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * TextInput组件padding参数设置为0时的显示效果测试 + * TextInput组件padding参数设置为10时的显示效果测试 + * TextInput组件padding参数设置为0,0,0,0时的显示效果测试 + * TextInput组件padding参数设置为10,10,10,10时的显示效果测试 + * TextInput组件padding参数设置为-1时的显示效果测试 + * TextInput组件padding参数设置为-1,-1,-1,-1时的显示效果测试 + */ + it('testTextInputPadding001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPlaceholderColorTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPlaceholderColorTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..55e35473e0e0ab7357351f97121e37483d9f46ce --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPlaceholderColorTest.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach, beforeAll } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputPlaceholderColorTest() { + + describe('TextInputPlaceholderColorTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件placeholderColor参数设置为0xFFFF0000的显示效果测试 + it('testTextInputPlaceholderColor001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputPlaceholderColorTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件placeholderColor参数设置为黑色的显示效果测试 + it('testTextInputPlaceholderColor002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputPlaceholderColorBlackTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + + // TextInput组件placeholderColor参数设置为白色的显示效果测试 + it('testTextInputPlaceholderColor003', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputPlaceholderColorWhiteTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPlaceholderFontTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPlaceholderFontTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..a680876d03f2847568eaf35a2972dd73f0bce3c1 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPlaceholderFontTest.ets @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach, beforeAll } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +async function doIt(pageTag: string, testType: number, done?: Function) { + Utils.emitEvent(pageTag, testType, 6666) +} + +export default function textInputPlaceholderFontTest() { + + describe('TextInputPlaceholderFontTest', () => { + + let PAGE_TAG = 'TextInputPlaceholderFontTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件placeholderFont参数设置为16.0,ARKUI_FONT_STYLE_NORMAL,ARKUI_FONT_WEIGHT_NORMAL的显示效果测试 + it('testTextInputPlaceholderFont001', 0, async (done: Function) => { + doIt(PAGE_TAG, 1); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_NORMAL,ARKUI_FONT_WEIGHT_NORMAL的显示效果测试 + it('testTextInputPlaceholderFont002', 0, async (done: Function) => { + doIt(PAGE_TAG, 2); + done(); + }) + + // TextInput组件placeholderFont参数设置为16.0的显示效果测试(验证ArkUI_FontStyle默认值) + it('testTextInputPlaceholderFont003', 0, async (done: Function) => { + doIt(PAGE_TAG, 3); + done(); + }) + + // TextInput组件placeholderFont参数设置为16.0的显示效果测试(验证ArkUI_FontWeight默认值) + it('testTextInputPlaceholderFont004', 0, async (done: Function) => { + doIt(PAGE_TAG, 4); + done(); + }) + + // TextInput组件placeholderFont默认的显示效果测试 + it('testTextInputPlaceholderFont005', 0, async (done: Function) => { + doIt(PAGE_TAG, 5); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W100的显示效果测试 + it('testTextInputPlaceholderFont006', 0, async (done: Function) => { + doIt(PAGE_TAG, 6); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W200的显示效果测试 + it('testTextInputPlaceholderFont007', 0, async (done: Function) => { + doIt(PAGE_TAG, 7); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W300的显示效果测试 + it('testTextInputPlaceholderFont008', 0, async (done: Function) => { + doIt(PAGE_TAG, 8); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W400的显示效果测试 + it('testTextInputPlaceholderFont009', 0, async (done: Function) => { + doIt(PAGE_TAG, 9); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W500的显示效果测试 + it('testTextInputPlaceholderFont010', 0, async (done: Function) => { + doIt(PAGE_TAG, 10); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W600的显示效果测试 + it('testTextInputPlaceholderFont011', 0, async (done: Function) => { + doIt(PAGE_TAG, 11); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W700的显示效果测试 + it('testTextInputPlaceholderFont012', 0, async (done: Function) => { + doIt(PAGE_TAG, 12); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W800的显示效果测试 + it('testTextInputPlaceholderFont013', 0, async (done: Function) => { + doIt(PAGE_TAG, 13); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_W900的显示效果测试 + it('testTextInputPlaceholderFont014', 0, async (done: Function) => { + doIt(PAGE_TAG, 14); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_BOLD的显示效果测试 + it('testTextInputPlaceholderFont015', 0, async (done: Function) => { + doIt(PAGE_TAG, 15); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_NORMAL的显示效果测试 + it('testTextInputPlaceholderFont016', 0, async (done: Function) => { + doIt(PAGE_TAG, 16); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_BOLDER的显示效果测试 + it('testTextInputPlaceholderFont017', 0, async (done: Function) => { + doIt(PAGE_TAG, 17); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_LIGHTER的显示效果测试 + it('testTextInputPlaceholderFont018', 0, async (done: Function) => { + doIt(PAGE_TAG, 18); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_MEDIUM的显示效果测试 + it('testTextInputPlaceholderFont019', 0, async (done: Function) => { + doIt(PAGE_TAG, 19); + done(); + }) + + // TextInput组件placeholderFont参数设置为0,ARKUI_FONT_STYLE_ITALIC,ARKUI_FONT_WEIGHT_REGULAR的显示效果测试 + it('testTextInputPlaceholderFont020', 0, async (done: Function) => { + doIt(PAGE_TAG, 20); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..80550a3a6b2e8b812ecff25e9aa025d3448762b6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputPositionTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputPositionTest() { + + describe('TextInputPositionTest', () => { + + let PAGE_TAG = 'TextInputPositionTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //TextInput组件position参数分别设置为{10,10},{-10,-10}时的显示效果测试 + it('testTextInputPosition001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputResponseRegionTest.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputResponseRegionTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ef42aa8eeb5ebe2c16edcd28e3e12e3721e0107 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputResponseRegionTest.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach, beforeAll } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputResponseRegionTest() { + + describe('TextInputResponseRegionTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件responseRegion参数设置为40,-80,80,60的显示效果测试 + it('testTextInputResponseRegion001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputResponseRegionSingleTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + let rect = Utils.getComponentRect("ResponseRegion"); + let X = Utils.getRectHorizontalCenterX(rect); + let Y = Utils.getRectVerticalCenterY(rect); + console.log("Utils.getRectHorizontalCenterX = " + X); + console.log("Utils.getRectVerticalCenterY = " + Y); + Utils.clickLocation(X, Y + 100); + done(); + }) + + // TextInput组件responseRegion参数设置为40,-80,80,60,80,-40,60,80的显示效果测试 + it('testTextInputResponseRegion002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputResponseRegionDoubleTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + let rect = Utils.getComponentRect("ResponseRegionMulti"); + let X = Utils.getRectHorizontalCenterX(rect); + let Y = Utils.getRectVerticalCenterY(rect); + Utils.clickLocation(X, Y + 100); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputSelectedBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputSelectedBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e80116ee314a9da67808c7199eb59da072b94dc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputSelectedBackgroundColorTest.test.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputSelectedBackgroundColorTest() { + + describe('TextInputSelectedBackgroundColorTest', () => { + + let PAGE_TAG = 'TextInputSelectedBackgroundColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //TextInput组件selectedBackgroundColor参数设置为0xFFFF0000时的显示效果测试 + it('testTextInputSelectedBackgroundColor001', 0, async (done: Function) => { + focusControl.requestFocus('0xFFFF0000_textInput') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件selectedBackgroundColor参数设置为0x00000000时的显示效果测试 + it('testTextInputSelectedBackgroundColor002', 0, async (done: Function) => { + focusControl.requestFocus('0xFFFFFFFF_textInput') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件selectedBackgroundColor参数设置为0xFFFFFFFF时的显示效果测试 + it('testTextInputSelectedBackgroundColor003', 0, async (done: Function) => { + focusControl.requestFocus('0x00000000_textInput') + await Utils.sleep(1000) + done(); + }); + + //TextInput组件selectedBackgroundColor参数设置为0x77FF0000时的显示效果测试 + it('testTextInputSelectedBackgroundColor004', 0, async (done: Function) => { + focusControl.requestFocus('0x77FF0000_textInput') + await Utils.sleep(1000) + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputShowPasswordIconTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputShowPasswordIconTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d5bfdf31d72f8214b482146f407144b5be9c2fd --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputShowPasswordIconTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputShowPasswordIconTest() { + + describe('TextInputShowPasswordIconTest', () => { + + let PAGE_TAG = 'TextInputShowPasswordIconTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //TextInput组件showPasswordIcon参数分别设置为0、1、-1时的显示效果测试 + it('testTextInputShowPasswordIcon001', 0, async (done: Function) => { + done(); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputShowUnderLineTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputShowUnderLineTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..761bf335b467464f55bcb97504d33acc293488d6 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputShowUnderLineTest.test.ets @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputShowUnderLineTest() { + + describe('TextInputShowUnderLineTest', () => { + + let PAGE_TAG = 'TextInputShowUnderLineTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * TextInput组件showUnderLine参数设置为0时的显示效果测试 + * TextInput组件showUnderLine参数设置为1时的显示效果测试 + * TextInput组件showUnderLine参数设置为-10时的显示效果测试 + */ + it('testTextInputShowUnderLine001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputStopEditingTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputStopEditingTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c60fc0a8403416cc4106a65fbd7a6128c9fa4381 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputStopEditingTest.test.ets @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { describe, it, afterEach } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +async function doIt(pageTag: string, testType: number, done?: Function) { + Utils.emitEvent(pageTag, testType, 6666) +} + +export default function textInputStopEditingTest() { + + describe('TextInputStopEditingTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextInput组件进入编辑态stopEditing参数设置为true时的显示效果测试 + it('testTextInputStopEditing001', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputStopEditingTrueTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + await Utils.clickComponent('Stop'); + doIt(PAGE_TAG, 1); + await Utils.sleep(2000); + done(); + }) + + // TextInput组件进入编辑态stopEditing参数设置为false时的显示效果测试 + it('testTextInputStopEditing002', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputStopEditingFalseTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + await Utils.clickComponent('Stop'); + await Utils.sleep(1000); + doIt(PAGE_TAG, 2); + await Utils.sleep(2000); + done(); + }) + + // TextInput组件不进入编辑态stopEditing参数设置为true时的显示效果测试 + it('testTextInputStopEditing003', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputStopEditingNoneTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + doIt(PAGE_TAG, 3); + await Utils.sleep(2000); + done(); + }) + + // TextInput组件不进入编辑态stopEditing参数设置为false时的显示效果测试 + it('testTextInputStopEditing004', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputStopEditingNoneFalseTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + doIt(PAGE_TAG, 4); + await Utils.sleep(2000); + done(); + }) + + // TextInput组件进入编辑态stopEditing参数设置为-10时的显示效果测试 + it('testTextInputStopEditing005', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputStopEditingAbnormalTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + await Utils.clickComponent('Stop'); + await Utils.sleep(1000); + doIt(PAGE_TAG, 5); + await Utils.sleep(2000); + done(); + }) + + // TextInput组件不进入编辑态stopEditing参数设置为-10时的显示效果测试 + it('testTextInputStopEditing006', 0, async (done: Function) => { + let PAGE_TAG = 'TextInputStopEditingNoneAbnormalTest'; + await Utils.pushPage(`textinput/${PAGE_TAG}`); + doIt(PAGE_TAG, 6); + await Utils.sleep(2000); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputTextAlignTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputTextAlignTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6655ba54755516eb793449d8e9f4b3cec4e1040 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputTextAlignTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputTextAlignTest() { + + describe('TextInputTextAlignTest', () => { + + let PAGE_TAG = 'TextInputTextAlignTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * TextInput组件textAlign参数设置为ARKUI_TEXT_ALIGNMENT_START时的显示效果测试 + * TextInput组件textAlign参数设置为ARKUI_TEXT_ALIGNMENT_CENTER时的显示效果测试 + * TextInput组件textAlign参数设置为ARKUI_TEXT_ALIGNMENT_END时的显示效果测试 + * TextInput组件textAlign参数设置为ARKUI_TEXT_ALIGNMENT_JUSTIFY时的显示效果测试 + * TextInput组件textAlign参数设置为-100时的显示效果测试 + */ + it('testTextInputTextAlign001', 0, async (done: Function) => { + done() + }) + + }) +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputTypeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputTypeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a0f7edbc30fbfb77b1a3d1a00963a0a09f20e85 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputTypeTest.test.ets @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputTypeTest() { + + describe('TextInputTypeTest', () => { + + let PAGE_TAG = 'TextInputTypeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + /* + TextInput组件type参数分别设置为 + ARKUI_TEXTINPUT_TYPE_NORMAL, + ARKUI_TEXTINPUT_TYPE_NUMBER, + ARKUI_TEXTINPUT_TYPE_PHONE_NUMBER, + ARKUI_TEXTINPUT_TYPE_EMAIL, + ARKUI_TEXTINPUT_TYPE_PASSWORD, + ARKUI_TEXTINPUT_TYPE_NUMBER_PASSWORD, + ARKUI_TEXTINPUT_TYPE_SCREEN_LOCK_PASSWORD, + ARKUI_TEXTINPUT_TYPE_USER_NAME, + ARKUI_TEXTINPUT_TYPE_NEW_PASSWORD, + ARKUI_TEXTINPUT_TYPE_NUMBER_DECIMAL, + -100时的显示效果测试 + */ + it('testTextInputType001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..10e422838414bd52df513cc5ad74e70c88385549 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textinput/TextInputWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textInputWidthTest() { + + describe('TextInputWidthTest', () => { + + let PAGE_TAG = 'TextInputWidthTest'; + let PAGE_TAG_LARGE = 'TextInputWidthLargeTest'; + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }); + + //TextInput组件width参数分别设置为300、-100时的显示效果测试 + it('testTextInputWidth001', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG}`, done); + }); + + //TextInput组件width参数设置为500,超出父控件时的显示效果测试 + it('testTextInputWidth002', 0, async (done: Function) => { + await Utils.pushPage(`textinput/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerCanLoopTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerCanLoopTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5fdf17abf970bb0f51e31853f7aaab4871af6ee2 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerCanLoopTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerCanLoopTest() { + + describe('TextPickerCanLoopTest', () => { + + let PAGE_TAG = 'TextPickerCanLoopTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件参数设置canLoop,true/false时的显示效果测试 + it('testTextPickerCanLoop001', 0, async (done: Function) => { + await Utils.flingComponent('textPickerCanLoopTest', false, true); + await Utils.sleep(2000) + await Utils.flingComponent('textPickerCanLoopTestDisable', false, true); + await Utils.sleep(2000) + await Utils.flingComponent('textPickerCanLoopTestDefault', false, true); + await Utils.sleep(2000) + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerDefaultPickerItemHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerDefaultPickerItemHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bc06ac66a88539ac194e7276ffa4210583ed2ca9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerDefaultPickerItemHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerDefaultPickerItemHeightTest() { + + describe('TextPickerDefaultPickerItemHeightTest', () => { + + let PAGE_TAG = 'TextPickerDefaultPickerItemHeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件参数设置defaultPickerItemHeight 50,0,-1时的显示效果测试 + it('testTextPickerDefaultPickerItemHeight001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerDisappearTextStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerDisappearTextStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..39839b3c6f1c60fa970ff5b42e24ac531838e19d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerDisappearTextStyleTest.test.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerDisappearTextStyleTest() { + + describe('TextPickerDisappearTextStyleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;bold;Arial,HarmonyOS Sans;normal""abnormal"时的显示效果测试 + it('testTextPickerDisappearTextStyle001', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerDisappearTextStyleTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;normal;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;normal;Arial,HarmonyOS Sans;italic" + it('testTextPickerDisappearTextStyle002', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerDisappearTextStyleNormalTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;bolder;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;bolder;Arial,HarmonyOS Sans;italic" + it('testTextPickerDisappearTextStyle003', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerDisappearTextStyleBolderTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;lighter;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;lighter;Arial,HarmonyOS Sans;italic" + it('testTextPickerDisappearTextStyle004', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerDisappearTextStyleLighterTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;medium;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;medium;Arial,HarmonyOS Sans;italic" + it('testTextPickerDisappearTextStyle005', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerDisappearTextStyleMediumTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;regular;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;regular;Arial,HarmonyOS Sans;italic" + it('testTextPickerDisappearTextStyle006', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerDisappearTextStyleRegularTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置disappearTextStyle "#ff007dff;30;bold;Arial,HarmonyOS Sans;italic" + it('testTextPickerDisappearTextStyle007', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerDisappearTextStyleBoldTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..42d59fa935273c364fb3052674cf709c3327cece --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerHeightTest() { + + describe('TextPickerHeightTest', () => { + + let PAGE_TAG = 'TextPickerHeightTest'; + let PAGE_TAG_LARGE = 'TextPickerHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //TextPicker组件height参数分别设置为200、-50时的显示效果测试 + it('testTextPickerHeight001', 0, async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG}`, done); + }) + + //TextPicker组件height参数设置为500,超出父控件时的显示效果测试 + it('testTextPickerHeight002', 0, async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerOnChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerOnChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..98381bb9fd6e79585ad0f4cddc8efcf450aafd8b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerOnChangeTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerOnChangeTest() { + + describe('TextPickerOnChangeTest', () => { + + let PAGE_TAG = 'TextPickerOnChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件调用capi设置enabled为true/false时,onChange是否触发的场景 + it('testTextPickerOnChange001', 0, async (done: Function) => { + await Utils.flingComponent('textPickerOnChangeTest', false, true); + await Utils.sleep(2000) + await Utils.flingComponent('textPickerOnChangeTestDisable', false, true); + await Utils.sleep(2000) + done() + }) + + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerRangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerRangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ba6dfd34e08a8d14538edfe70cc7c4df6069222 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerRangeTest.test.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerRangeTest() { + + describe('TextPickerRangeTest', () => { + + let PAGE_TAG = 'TextPickerRangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* TextPicker组件参数设置range + * ARKUI_TEXTPICKER_RANGETYPE_SINGLE, + * ARKUI_TEXTPICKER_RANGETYPE_MULTI, + * ARKUI_TEXTPICKER_RANGETYPE_RANGE_CONTENT, + * ARKUI_TEXTPICKER_RANGETYPE_CASCADE_RANGE_CONTENT, + * -1时的显示效果测试 + */ + it('testTextPickerRange001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerSelectedIndexTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerSelectedIndexTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5bb2f7732aa8b39a73ae6cbf709d97fde4f83b50 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerSelectedIndexTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerSelectedIndexTest() { + + describe('TextPickerSelectedIndexTest', () => { + + let PAGE_TAG = 'TextPickerSelectedIndexTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件参数设置selectedIndex 2; 2,2,2; 100时的显示效果测试 + it('testTextPickerSelectedIndex001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerSelectedTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerSelectedTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..909a66752cca715a9a3f17bb07885ad92c6cd651 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerSelectedTest.test.ets @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerSelectedTest() { + + describe('TextPickerSelectedTest', () => { + + let PAGE_TAG = 'TextPickerSelectedTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * CalendarPicker组件参数设置textStyle (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W100) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W200) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W300) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W400) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W500) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W600) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W700) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W800) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_W900) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_BOLD) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_NORMAL) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_BOLDER) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_LIGHTER) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_MEDIUM) + * (nodeAPI, 0xFFFF0000, 30, ARKUI_FONT_WEIGHT_REGULAR) + * (nodeAPI, 1234, -1, ENUM_ABNORMAL_VALUE)时的显示效果测试 + */ + + it('testTextPickerSelected001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerSelectedTextStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerSelectedTextStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b394803b3cb2b9f14aaae653ac93d54eaee839ad --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerSelectedTextStyleTest.test.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerSelectedTextStyleTest() { + + describe('TextPickerSelectedTextStyleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;normal;Arial,HarmonyOS Sans;normal""abnormal"时的显示效果测试 + it('testTextPickerSelectedTextStyle001', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerSelectedTextStyleTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;normal;Arial,HarmonyOS Sans;italic" + it('testTextPickerSelectedTextStyle002', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerSelectedTextStyleNormalTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;bolder;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;bolder;Arial,HarmonyOS Sans;italic" + it('testTextPickerSelectedTextStyle003', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerSelectedTextStyleBolderTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;lighter;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;lighter;Arial,HarmonyOS Sans;italic" + it('testTextPickerSelectedTextStyle004', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerSelectedTextStyleLighterTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;medium;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;medium;Arial,HarmonyOS Sans;italic" + it('testTextPickerSelectedTextStyle005', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerSelectedTextStyleMediumTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;regular;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;regular;Arial,HarmonyOS Sans;italic" + it('testTextPickerSelectedTextStyle006', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerSelectedTextStyleRegularTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;bold;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置SelectedTextStyle "#ff182431;50;bold;Arial,HarmonyOS Sans;italic" + it('testTextPickerSelectedTextStyle007', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerSelectedTextStyleBoldTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerTextStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerTextStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e2ae59cb67916ab688eb752733fe35a6028d5b88 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerTextStyleTest.test.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerTextStyleTest() { + + describe('TextPickerTextStyleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件参数设置TextPicker组件参数设置TextStyle "#ff007dff;30;normal;Arial,HarmonyOS Sans;normal""abnormal"时的显示效果测试 + it('testTextPickerTextStyle001', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerTextStyleTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置TextStyle "#ff007dff;30;normal;Arial,HarmonyOS Sans;italic" + it('testTextPickerTextStyle002', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerTextStyleNormalTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置TextStyle "#ff007dff;30;bolder;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置TextStyle "#ff007dff;30;bolder;Arial,HarmonyOS Sans;italic" + it('testTextPickerTextStyle003', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerTextStyleBolderTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置TextStyle "#ff007dff;30;lighter;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置TextStyle "#ff007dff;30;lighter;Arial,HarmonyOS Sans;italic" + it('testTextPickerTextStyle004', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerTextStyleLighterTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置TextStyle "#ff007dff;30;medium;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置TextStyle "#ff007dff;30;medium;Arial,HarmonyOS Sans;italic" + it('testTextPickerTextStyle005', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerTextStyleMediumTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置TextStyle "#ff007dff;30;regular;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置TextStyle "#ff007dff;30;regular;Arial,HarmonyOS Sans;italic" + it('testTextPickerTextStyle006', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerTextStyleRegularTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + + // TextPicker组件参数设置TextStyle "#ff007dff;30;bold;Arial,HarmonyOS Sans;normal" + // TextPicker组件参数设置TextStyle "#ff007dff;30;bold;Arial,HarmonyOS Sans;italic" + it('testTextPickerTextStyle007', 0, async (done: Function) => { + let PAGE_TAG = 'TextPickerTextStyleBoldTest'; + await Utils.pushPage(`textpicker/${PAGE_TAG}`); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerValueTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerValueTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..82cb4c778c29859cdcb5744287561022a0586336 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerValueTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerValueTest() { + + describe('TextPickerValueTest', () => { + + let PAGE_TAG = 'TextPickerValueTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TextPicker组件参数设置value "B","B;B;B" "D"时的显示效果测试 + it('testTextPickerValue001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e270d280a410ff946f99846c6710489ace0d74cb --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/textpicker/TextPickerWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function textPickerWidthTest() { + + describe('TextPickerWidthTest', () => { + + let PAGE_TAG = 'TextPickerWidthTest'; + let PAGE_TAG_LARGE = 'TextPickerWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //TextPicker组件width参数分别设置为300、-100时的显示效果测试 + it('testTextPickerWidth001', 0, async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG}`, done); + }) + + //TextPicker组件width参数设置为500,超出父控件时的显示效果测试 + it('testTextPickerWidth002', 0, async (done: Function) => { + await Utils.pushPage(`textpicker/${PAGE_TAG_LARGE}`, done); + }); + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerDisappearTextStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerDisappearTextStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b2254d50cff8178d8d1a761fcd1db8c0d9fac9c --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerDisappearTextStyleTest.test.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerDisappearTextStyleTest() { + + describe('TimePickerDisappearTextStyleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;bold;Arial,HarmonyOS Sans;normal""abnormal"时的显示效果测试 + it('testTimePickerDisappearTextStyle001', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerDisappearTextStyleTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;normal;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;normal;Arial,HarmonyOS Sans;italic" + it('testTimePickerDisappearTextStyle002', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerDisappearTextStyleNormalTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;bolder;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;bolder;Arial,HarmonyOS Sans;italic" + it('testTimePickerDisappearTextStyle003', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerDisappearTextStyleBolderTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;lighter;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;lighter;Arial,HarmonyOS Sans;italic" + it('testTimePickerDisappearTextStyle004', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerDisappearTextStyleLighterTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;medium;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;medium;Arial,HarmonyOS Sans;italic" + it('testTimePickerDisappearTextStyle005', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerDisappearTextStyleMediumTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;regular;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;regular;Arial,HarmonyOS Sans;italic" + it('testTimePickerDisappearTextStyle006', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerDisappearTextStyleRegularTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置disappearTextStyle "#ff007dff;30;bold;Arial,HarmonyOS Sans;italic" + it('testTimePickerDisappearTextStyle007', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerDisappearTextStyleBoldTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1eda662e05e9f0f59f7c7ff55faaab832f3cba0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerHeightTest() { + + describe('TimePickerHeightTest', () => { + + let PAGE_TAG = 'TimePickerHeightTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`timepicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TimePicker组件参数设置height 300,-1,1000时的显示效果测试 + it('testTimePickerHeight001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerOnChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerOnChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a8d8b667f4e143edee582ff733b1e01ddb352e9 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerOnChangeTest.test.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerOnChangeTest() { + + describe('TimePickerOnChangeTest', () => { + + let PAGE_TAG = 'TimePickerOnChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`timepicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TimePicker组件调用capi,onChange是否触发的场景 + it('testTimePickerOnChange001', 0, async (done: Function) => { + await Utils.flingComponent('timePickerOnChangeTest', false, true); + await Utils.sleep(2000) + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerSelectedTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerSelectedTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..352f9a685c176c8466b440413326cb3f6e2f24ee --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerSelectedTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerSelectedTest() { + + describe('TimePickerSelectedTest', () => { + + let PAGE_TAG = 'TimePickerSelectedTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`timepicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // DatePicker组件参数设置selected "22-8",""时的显示效果测试 + it('testTimePickerSelected001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerSelectedTextStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerSelectedTextStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed131b02be3f245875b0779e60ddb731b7fb5b60 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerSelectedTextStyleTest.test.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerSelectedTextStyleTest() { + + describe('TimePickerSelectedTextStyleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TimePicker组件参数设置selectedTextStyle "#ff182431;50;normal;Arial,HarmonyOS Sans;normal""abnormal"时的显示效果测试 + it('testTimePickerSelectedTextStyle001', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerSelectedTextStyleTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;normal;Arial,HarmonyOS Sans;italic" + it('testTimePickerSelectedTextStyle002', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerSelectedTextStyleNormalTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;bolder;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;bolder;Arial,HarmonyOS Sans;italic" + it('testTimePickerSelectedTextStyle003', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerSelectedTextStyleBolderTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;lighter;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;lighter;Arial,HarmonyOS Sans;italic" + it('testTimePickerSelectedTextStyle004', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerSelectedTextStyleLighterTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;medium;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;medium;Arial,HarmonyOS Sans;italic" + it('testTimePickerSelectedTextStyle005', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerSelectedTextStyleMediumTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;regular;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;regular;Arial,HarmonyOS Sans;italic" + it('testTimePickerSelectedTextStyle006', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerSelectedTextStyleRegularTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;bold;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置SelectedTextStyle "#ff182431;50;bold;Arial,HarmonyOS Sans;italic" + it('testTimePickerSelectedTextStyle007', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerSelectedTextStyleBoldTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerTextStyleTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerTextStyleTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8b6348fea8c7df154a9a6494f155cebbd7c4c765 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerTextStyleTest.test.ets @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerTextStyleTest() { + + describe('TimePickerTextStyleTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TimePicker组件参数设置textStyle "#ff007dff;30;normal;Arial,HarmonyOS Sans;normal""abnormal""时的显示效果测试 + it('testTimePickerTextStyle001', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerTextStyleTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置TextStyle "#ff007dff;30;normal;Arial,HarmonyOS Sans;italic" + it('testTimePickerTextStyle002', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerTextStyleNormalTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置TextStyle "#ff007dff;30;bolder;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置TextStyle "#ff007dff;30;bolder;Arial,HarmonyOS Sans;italic" + it('testTimePickerTextStyle003', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerTextStyleBolderTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置TextStyle "#ff007dff;30;lighter;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置TextStyle "#ff007dff;30;lighter;Arial,HarmonyOS Sans;italic" + it('testTimePickerTextStyle004', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerTextStyleLighterTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置TextStyle "#ff007dff;30;medium;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置TextStyle "#ff007dff;30;medium;Arial,HarmonyOS Sans;italic" + it('testTimePickerTextStyle005', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerTextStyleMediumTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置TextStyle "#ff007dff;30;regular;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置TextStyle "#ff007dff;30;regular;Arial,HarmonyOS Sans;italic" + it('testTimePickerTextStyle006', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerTextStyleRegularTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + + // TimePicker组件参数设置TextStyle "#ff007dff;30;bold;Arial,HarmonyOS Sans;normal" + // TimePicker组件参数设置TextStyle "#ff007dff;30;bold;Arial,HarmonyOS Sans;italic" + it('testTimePickerTextStyle007', 0, async (done: Function) => { + let PAGE_TAG = 'TimePickerTextStyleBoldTest'; + await Utils.pushPage(`timepicker/${PAGE_TAG}`); + done() + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerUseMilitaryTimeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerUseMilitaryTimeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..96e3e36dd3b1eb9f6bfcb0189e03b73631a4a346 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/timepicker/TimePickerUseMilitaryTimeTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function timePickerUseMilitaryTimeTest() { + + describe('TimePickerUseMilitaryTimeTest', () => { + + let PAGE_TAG = 'TimePickerUseMilitaryTimeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`timepicker/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // TimePicker组件参数设置canLoop,true/false时的显示效果测试 + it('testTimePickerUseMilitaryTime001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleBackgroundColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleBackgroundColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7795a34ff8d24d6bf1ed41b32437db3944e6b4ec --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleBackgroundColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleBackgroundColorTest() { + + describe('ToggleBackgroundColorTest', () => { + + let PAGE_TAG = 'ToggleBackgroundColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Toggle组件backgroundColor参数分别设置为#FFFF0000、#00000000、#FFFFFFFF时的显示效果测试 + it('testToggleBackgroundColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleClipTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleClipTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d093a93388db9c0820a2b11c11af2b4bd239dcf3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleClipTest.test.ets @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleClipTest() { + + describe('ToggleClipTest', () => { + + let PAGE_TAG = 'ToggleClipTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /*Toggle组件clip参数分别设置为 + NODE_CLIP_SHAPE: + (1) + 裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE + 矩形宽度:20, + 矩形高度:20, + 矩形圆角宽度:3, + 矩形圆角高度:3 + (2) + 裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE + 矩形宽度:-20, + 矩形高度:-20, + 矩形圆角宽度:-3, + 矩形圆角高度:-3 + (3) + 裁剪类型:ARKUI_CLIP_TYPE_RECTANGLE + 矩形宽度:30000, + 矩形高度:30000, + 矩形圆角宽度:10000, + 矩形圆角高度:10000 + (4) + 裁剪类型:ARKUI_CLIP_TYPE_CIRCLE + 圆形宽度:20, + 圆形高度:20 + (5) + 裁剪类型:ARKUI_CLIP_TYPE_CIRCLE + 圆形宽度:-20, + 圆形高度:-20 + (6) + 裁剪类型:ARKUI_CLIP_TYPE_CIRCLE + 圆形宽度:10000, + 圆形高度:10000 + (7) + 裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE + 椭圆形宽度:35, + 椭圆形高度:20 + (8) + 裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE + 椭圆形宽度:-35, + 椭圆形高度:-20 + (9) + 裁剪类型:ARKUI_CLIP_TYPE_ELLIPSE + 椭圆形宽度:20000, + 椭圆形高度:10000 + (10) + 裁剪类型:ARKUI_CLIP_TYPE_PATH + 路径宽度:35, + 路径高度:20, + 路径绘制的命令字符串:"M0 0 H20 V20 H0 Z" + (11) + 裁剪类型:ARKUI_CLIP_TYPE_PATH + 路径宽度:-35, + 路径高度:-20, + 路径绘制的命令字符串:"" + (12) + 裁剪类型:ARKUI_CLIP_TYPE_PATH + 路径宽度:10000, + 路径高度:10000, + 路径绘制的命令字符串:"M0 0 H20 V20 H0 Z" + (13) + 1 + (14) + 0 + (15) + -1 + 时的显示效果测试*/ + it('testToggleClip001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleEnabledTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleEnabledTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..09537440073635bb5cbfd93386ee19cf05428624 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleEnabledTest.test.ets @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleEnabledTest() { + + describe('ToggleEnabledTest', () => { + + let PAGE_TAG = 'ToggleEnabledTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }) + + //Toggle组件enabled参数分别设置为true时的显示效果测试 + it('testToggleEnabled001', 0, async (done: Function) => { + await Utils.clickComponent('OnClickEnabledToggle') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickAbnormalToggle') + focusControl.requestFocus('OnClickEnabledToggle') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickAbnormalToggle') + await Utils.sleep(1000) + done(); + }) + + //Toggle组件enabled参数分别设置为false时的显示效果测试 + it('testToggleEnabled002', 0, async (done: Function) => { + await Utils.clickComponent('OnClickDisabledToggle') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickEnabledToggle') + focusControl.requestFocus('OnClickDisabledToggle') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickEnabledToggle') + await Utils.sleep(1000) + done(); + }) + + //Toggle组件enabled参数分别设置为-1时的显示效果测试 + it('testToggleEnabled003', 0, async (done: Function) => { + await Utils.clickComponent('OnClickAbnormalToggle') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickEnabledToggle') + focusControl.requestFocus('OnClickAbnormalToggle') + await Utils.sleep(1000) + + focusControl.requestFocus('OnClickEnabledToggle') + await Utils.sleep(1000) + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleFocusableTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleFocusableTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..897d5440f717455124a5fc8df083f7f178c038ab --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleFocusableTest.test.ets @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleFocusableTest() { + + describe('ToggleFocusableTest', () => { + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }) + + //Toggle组件可获得焦点状态为是、否、-1时,触发onfocus回调时的显示效果测试 + it('testToggleFocusable001', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleFocusableTest'; + await Utils.pushPage(`toggle/${PAGE_TAG}`); + await Utils.sleep(2000) + focusControl.requestFocus('FocusableToggle') + await Utils.sleep(2000) + focusControl.requestFocus('NofocusableToggle') + await Utils.sleep(2000) + focusControl.requestFocus('AbnormalToggle') + await Utils.sleep(2000) + done(); + }) + + //Toggle组件设置focusable和defaultFocus结合的场景 + it('testToggleFocusable002', 0, async (done: Function) => { + let PAGE_TAG = 'ToggleFocusableCombineTest'; + await Utils.pushPage(`toggle/${PAGE_TAG}`); + await Utils.sleep(2000) + focusControl.requestFocus('FocusableToggleTrue') + await Utils.sleep(2000) + focusControl.requestFocus('FocusableToggleTrueFalse') + await Utils.sleep(2000) + focusControl.requestFocus('FocusableToggleFalseTrue') + await Utils.sleep(2000) + focusControl.requestFocus('FocusableToggleFalse') + await Utils.sleep(2000) + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1f7330df6081d201a3e8280a6de9895f4686690 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleHeightTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleHeightTest() { + + describe('ToggleHeightTest', () => { + + let PAGE_TAG = 'ToggleHeightTest'; + let PAGE_TAG_LARGE = 'ToggleHeightLargeTest'; + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Toggle组件height参数分别设置为30、-30时的显示效果测试 + it('testToggleHeight001', 0, async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }) + + //Toggle组件height参数设置为10000vp时,大于父组件宽度的显示效果测试 + it('testToggleHeight002', 0, async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG_LARGE}`, done); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleMarginTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleMarginTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e8c1ba2d19d49a31a0316a6f2b922aa6eff02a0 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleMarginTest.test.ets @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleMarginTest() { + + describe('ToggleMarginTest', () => { + + let PAGE_TAG = 'ToggleMarginTest'; + let PAGE_TAG_MIDDLE = 'ToggleMarginMiddleTest'; + let PAGE_TAG_LARGE = 'ToggleMarginLargeTest'; + let PAGE_TAG_FOUR_LARGE = 'ToggleMarginFourLargeTest'; + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Toggle组件margin参数分别设置为{10},{-10},{50,50,10,10},[-10,-10,-50,-50]时的显示效果测试 + it('testToggleMargin001', 0, async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }) + + //Toggle组件margin参数设置为{230}时的显示效果测试 + it('testToggleMargin002', 0, async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG_MIDDLE}`, done); + }) + + //Toggle组件margin参数设置为{100}时的显示效果测试 + it('testToggleMargin003', 0, async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG_LARGE}`, done); + }) + + //Toggle组件margin参数设置为{100,100,100,100}时的显示效果测试 + it('testToggleMargin004', 0, async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG_FOUR_LARGE}`, done); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleOnChangeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleOnChangeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..303483ee58e742b502e4ef61c598783a18b9574b --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleOnChangeTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleOnChangeTest() { + + describe('ToggleOnChangeTest', () => { + + let PAGE_TAG = 'ToggleOnChangeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }) + + //Toggle组件开关状态分别为开、关时,触发onchange回调时的显示效果测试 + it('testToggleOnChange001', 0, async (done: Function) => { + await Utils.clickComponent('OnChangeToggle') + await Utils.clickComponent('OnChangeIsOnToggle') + await Utils.sleep(6000); + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/TogglePositionTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/TogglePositionTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa74b55e7b9da3e209a8ac357abc398998ba3049 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/TogglePositionTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function togglePositionTest() { + + describe('TogglePositionTest', () => { + + let PAGE_TAG = 'TogglePositionTest'; + let PAGE_TAG_LARGE = 'TogglePositionLargeTest'; + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Toggle组件position参数分别设置为{100,100}、{-100,-100}时的显示效果测试 + it('testTogglePosition001', 0, async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }) + + //Toggle组件position参数设置为{10000,10000}时的显示效果测试 + it('testTogglePosition002', 0, async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG_LARGE}`, done); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleSelectedColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleSelectedColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b96fe058566b6341c46abc1ee66a545ed47f955e --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleSelectedColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleSelectedColorTest() { + + describe('ToggleSelectedColorTest', () => { + + let PAGE_TAG = 'ToggleSelectedColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Toggle组件selectedColor参数分别设置为#FFFF0000、#00000000、#FFFFFFFF时的显示效果测试 + it('testToggleSelectedColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleSwitchPointColorTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleSwitchPointColorTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8eeeda6a54e3fd074cd18aa21efb555569d2f826 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleSwitchPointColorTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleSwitchPointColorTest() { + + describe('ToggleSwitchPointColorTest', () => { + + let PAGE_TAG = 'ToggleSwitchPointColorTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }) + + //Toggle组件switchPointColor参数分别设置为#FFFF0000、#00000000、#FFFFFFFF时的显示效果测试 + it('testToggleSwitchPointColor001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleSwitchTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleSwitchTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7afca13903f8fadaf79c52fc7e76b55c043aa930 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleSwitchTest.test.ets @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleSwitchTest() { + + describe('ToggleSwitchTest', () => { + + let PAGE_TAG = 'ToggleSwitchTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done); + }) + + //Toggle组件switch参数设置为默认值时的显示效果测试 + it('testToggleSwitch001', 0, async (done: Function) => { + done(); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ac560838d7f2f36152b061a2ad28389fb705ba58 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/toggle/ToggleWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function toggleWidthTest() { + + describe('ToggleWidthTest', () => { + + let PAGE_TAG = 'ToggleWidthTest'; + let PAGE_TAG_LARGE = 'ToggleWidthLargeTest'; + + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //Toggle组件width参数分别设置为100、-100时的显示效果测试 + it('testToggleWidth001', 0, async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG}`, done); + }) + + //Toggle组件width参数设置为10000vp时,大于父组件宽度的显示效果测试 + it('testToggleWidth002', 0, async (done: Function) => { + await Utils.pushPage(`toggle/${PAGE_TAG_LARGE}`, done); + }) + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentHeightTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentHeightTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c33ff33f7cf0acfc6351b93b7039529f859740b3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentHeightTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function xComponentHeightTest() { + + describe('XComponentHeightTest', () => { + + let PAGE_TAG = 'XComponentHeightTest'; + let PAGE_TAG_LARGE = 'XComponentHeightLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //XComponent组件height参数分别设置为200、-50时的显示效果测试 + it('testXComponentHeight001', 0, async (done: Function) => { + await Utils.pushPage(`xcomponent/${PAGE_TAG}`, done); + }) + + //XComponent组件height参数设置为500,超出父控件时的显示效果测试 + it('testXComponentHeight002', 0, async (done: Function) => { + await Utils.pushPage(`xcomponent/${PAGE_TAG_LARGE}`, done); + }); + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentSourceIdTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentSourceIdTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ad8a64c7de592a441e2aaf308e792ac7f98ba1d --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentSourceIdTest.test.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function xComponentSourceIdTest() { + + describe('XComponentSourceIdTest', () => { + + let PAGE_TAG = 'XComponentSourceIdTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`xcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + // XComponent组件参数设置sourceId正常场景 + it('testXComponentSourceId001', 0, async (done: Function) => { + done() + }) + + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentTypeTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentTypeTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..963013c2eab9a528affde33b1649102c5ebc2a41 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentTypeTest.test.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function xComponentTypeTest() { + + describe('XComponentTypeTest', () => { + + let PAGE_TAG = 'XComponentTypeTest'; + + beforeAll(async (done: Function) => { + await Utils.pushPage(`xcomponent/${PAGE_TAG}`, done); + }); + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + /* + * XComponent组件参数设置type为 + * ARKUI_XCOMPONENT_TYPE_SURFACE + * ARKUI_XCOMPONENT_TYPE_TEXTURE + * 默认值 + * 的显示效果测试 + */ + it('testXComponentType001', 0, async (done: Function) => { + done() + }) + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentWidthTest.test.ets b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentWidthTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b58f5cb4b39e0a43ad8c1c996fe77e1b71022ed --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/test/xcomponent/XComponentWidthTest.test.ets @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2024 Huawei Device 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 { afterEach, beforeAll, describe, it } from '@ohos/hypium'; +import Utils from '../common/Utils'; +import WindowSnap from '../common/Snap'; + +export default function xComponentWidthTest() { + + describe('XComponentWidthTest', () => { + + let PAGE_TAG = 'XComponentWidthTest'; + let PAGE_TAG_LARGE = 'XComponentWidthLargeTest'; + + afterEach(async (done: Function) => { + WindowSnap.snapShot(globalThis.context, 'test', done) + }) + + //XComponent组件width参数分别设置为300、-100时的显示效果测试 + it('testXComponentWidth001', 0, async (done: Function) => { + await Utils.pushPage(`xcomponent/${PAGE_TAG}`, done); + }) + + //XComponent组件width参数设置为500,超出父控件时的显示效果测试 + it('testXComponentWidth002', 0, async (done: Function) => { + await Utils.pushPage(`xcomponent/${PAGE_TAG_LARGE}`, done); + }); + + }) +} diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..22e8d7e308a48383a2acdc13254a18588637bdfa --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2024 Huawei Device 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 TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +let abilityDelegator = undefined; +let abilityDelegatorArguments = undefined; + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]); + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}`; + } + } + return targetParams.trim(); +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + console.log('OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments(); + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'; + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback); + let cmd = 'aa start -d 0 -a MainAbility' + + ' -b ' + abilityDelegatorArguments.bundleName; + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters); + let debug = abilityDelegatorArguments.parameters['-D']; + if (debug == 'true') { + cmd += ' -D'; + } + console.info('cmd : ' + cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }); + console.info('OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/module.json5 b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1b0ee0e81d470b8fc3b276f0b706ddf014ed6099 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/module.json5 @@ -0,0 +1,47 @@ +{ + "module": { + "name": "entry_test", + "type": "feature", + "srcEntry": "./ets/Application/AbilityStage.ts", + "description": "$string:module_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "tablet", + "default" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "MainAbility", + "srcEntry": "./ets/MainAbility/MainAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.INTERNET" + } + ] + } +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/element/color.json b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/element/float.json b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..8658bacc0d5d479ee25116b206bc152e53d92953 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/element/float.json @@ -0,0 +1,24 @@ +{ + "float": [ + { + "name": "300vp", + "value": "300vp" + }, + { + "name": "200vp", + "value": "200vp" + }, + { + "name": "100vp", + "value": "100vp" + }, + { + "name": "50vp", + "value": "50vp" + } + ,{ + "name": "10vp", + "value": "10vp" + } + ] +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/element/string.json b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/background.png b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/background.png new file mode 100644 index 0000000000000000000000000000000000000000..bbe9979eda9db82793df2873701e4beae14c44cc Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/background.png differ diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/icon.png b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/icon_transparent.png b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/icon_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..0ec2e1692ed4a280147f41fa7491fa6595958153 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/icon_transparent.png differ diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/rectIcon.png b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/rectIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..4b68e9b07b4c30539ff093e43c193cfd61dc59fd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/rectIcon.png differ diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/src.jpg b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/src.jpg new file mode 100644 index 0000000000000000000000000000000000000000..36a19cd6b90bb98511116f5015c74fe2f860249d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/media/src.jpg differ diff --git a/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/profile/main_pages.json b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..25ac0a5cafffa259b61441e2599c69e8f358c26a --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/entry/src/ohosTest/resources/base/profile/main_pages.json @@ -0,0 +1,1207 @@ +{ + "src": [ + "MainAbility/pages/DemoIndex", + "MainAbility/pages/button/ButtonOnClickTest", + "MainAbility/pages/button/ButtonFontSizeTest", + "MainAbility/pages/button/ButtonFontColorTest", + "MainAbility/pages/button/ButtonFontWeightTest", + "MainAbility/pages/button/ButtonBackgroundColorTest", + "MainAbility/pages/checkbox/CheckboxSelectTest", + "MainAbility/pages/checkbox/CheckboxSelectedColorTest", + "MainAbility/pages/checkbox/CheckboxUnselectedColorTest", + "MainAbility/pages/checkbox/CheckboxMarkTest", + "MainAbility/pages/checkbox/CheckboxShapeTest", + "MainAbility/pages/checkbox/CheckboxOnChangeTest", + "MainAbility/pages/commonattrs/CommonAttrsWidthTest", + "MainAbility/pages/commonattrs/CommonAttrsHeightTest", + "MainAbility/pages/commonattrs/CommonAttrsBackgroundColorTest", + "MainAbility/pages/commonattrs/CommonAttrsPositionTest", + "MainAbility/pages/commonattrs/CommonAttrsBorderWidthTest", + "MainAbility/pages/commonattrs/CommonAttrsBorderColorTest", + "MainAbility/pages/commonattrs/CommonAttrsBorderRadiusTest", + "MainAbility/pages/commonattrs/CommonAttrsBorderStyleTest", + "MainAbility/pages/commonattrs/CommonAttrsAlignTest", + "MainAbility/pages/commonattrs/CommonAttrsDirectionTest", + "MainAbility/pages/commonattrs/CommonAttrsEnabledTest", + "MainAbility/pages/commonattrs/CommonAttrsFocusableTest", + "MainAbility/pages/commonevent/CommonEventOnAppearTest", + "MainAbility/pages/commonevent/CommonEventOnAreaChangeTest", + "MainAbility/pages/commonevent/CommonEventOnBlurTest", + "MainAbility/pages/commonevent/CommonEventOnTouchTest", + "MainAbility/pages/commonevent/CommonEventOnFocusTest", + "MainAbility/pages/commonevent/CommonEventOnClickTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexRowTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexColumnTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexRowReverseTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexBasisFlexColumnReverseTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexBasisRowTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexBasisColumnTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexRowTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexColumnTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexRowReverseTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexGrowFlexColumnReverseTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexGrowRowTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexGrowColumnTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexRowTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexColumnTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexRowReverseTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexShrinkFlexColumnReverseTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexShrinkRowTest", + "MainAbility/pages/commonattrs/CommonAttrsFlexShrinkColumnTest", + "MainAbility/pages/commonattrs/CommonAttrsAlignSelfTest", + "MainAbility/pages/commonattrs/CommonAttrsAlignContentTest", + "MainAbility/pages/commonattrs/CommonAttrsJustifyContentTest", + "MainAbility/pages/commonattrs/CommonAttrsAlignItemsTest", + "MainAbility/pages/commonattrs/CommonAttrsRadialGradientTest", + "MainAbility/pages/commonattrs/CommonAttrsSweepGradientTest", + "MainAbility/pages/commonattrs/CommonAttrsGrayscaleTest", + "MainAbility/pages/commonattrs/CommonAttrsForegroundBlurStyleTest", + "MainAbility/pages/commonattrs/CommonAttrsHitTestBehaviorTest", + "MainAbility/pages/commonattrs/CommonAttrsIdTest", + "MainAbility/pages/commonattrs/CommonAttrsOpacityTest", + "MainAbility/pages/commonattrs/CommonAttrsInvertTest", + "MainAbility/pages/commonattrs/CommonAttrsSepiaTest", + "MainAbility/pages/commonattrs/CommonAttrsContrastTest", + "MainAbility/pages/commonattrs/CommonAttrsClipCircleTest", + "MainAbility/pages/commonattrs/CommonAttrsClipEllipseTest", + "MainAbility/pages/commonattrs/CommonAttrsClipPathTest", + "MainAbility/pages/commonattrs/CommonAttrsClipRectangleTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientTopTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientBottomTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftTopTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientLeftBottomTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightTopTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientRightBottomTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientNoneTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientCustomTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientLowerBoundAbnormalTest", + "MainAbility/pages/commonattrs/CommonAttrsLinearGradientIllegalColorAbnormalTest", + "MainAbility/pages/commonattrs/CommonAttrsShadowUltraSmallShadowTest", + "MainAbility/pages/commonattrs/CommonAttrsShadowSmallShadowTest", + "MainAbility/pages/commonattrs/CommonAttrsShadowMiddleShadowTest", + "MainAbility/pages/commonattrs/CommonAttrsShadowLargeShadowTest", + "MainAbility/pages/commonattrs/CommonAttrsShadowFloatingShadowTest", + "MainAbility/pages/commonattrs/CommonAttrsShadowFloatingSmallShadowTest", + "MainAbility/pages/commonattrs/CommonAttrsShadowLowerBoundAbnormalTest", + "MainAbility/pages/commonattrs/CommonAttrsShadowUpperBoundAbnormalTest", + "MainAbility/pages/commonattrs/CommonAttrsScaleReduceXYTest", + "MainAbility/pages/commonattrs/CommonAttrsScaleReduceXTest", + "MainAbility/pages/commonattrs/CommonAttrsScaleEnlargeXYTest", + "MainAbility/pages/commonattrs/CommonAttrsScaleEnlargeXTest", + "MainAbility/pages/commonattrs/CommonAttrsScaleAbnormalTest", + "MainAbility/pages/commonattrs/CommonAttrsMarginUnifiedTest", + "MainAbility/pages/commonattrs/CommonAttrsMarginRespectivelyTest", + "MainAbility/pages/commonattrs/CommonAttrsMarginUnifiedNegativeTest", + "MainAbility/pages/commonattrs/CommonAttrsMarginRespectivelyNegativeTest", + "MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMaxSetMinTest", + "MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMaxMinSetTest", + "MainAbility/pages/commonattrs/CommonAttrsConstraintSizeSetMaxMinTest", + "MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMinSetMaxTest", + "MainAbility/pages/commonattrs/CommonAttrsConstraintSizeMinMaxSetTest", + "MainAbility/pages/commonattrs/CommonAttrsConstraintSizeSetMinMaxTest", + "MainAbility/pages/commonattrs/CommonAttrsTransformTest", + "MainAbility/pages/commonattrs/CommonAttrsTransformAbnormalTest", + "MainAbility/pages/commonattrs/CommonAttrsMaskTest", + "MainAbility/pages/commonattrs/CommonAttrsMaskAbnormalTest", + "MainAbility/pages/commonattrs/CommonAttrsBlendModeTest", + "MainAbility/pages/customcomponent/CustomComponentOnMeasureTest", + "MainAbility/pages/customcomponent/CustomComponentOnLayoutTest", + "MainAbility/pages/customcomponent/CustomComponentOnDrawTest", + "MainAbility/pages/list/ListHeightTest", + "MainAbility/pages/list/ListHeightBeyondParentComponentTest", + "MainAbility/pages/list/ListHeightLowerBoundAbnormalTest", + "MainAbility/pages/list/ListHeightLowerBoundAbnormalContainsSubComponentTest", + "MainAbility/pages/list/ListWidthTest", + "MainAbility/pages/list/ListWidthBeyondParentComponentTest", + "MainAbility/pages/list/ListWidthLowerBoundAbnormalTest", + "MainAbility/pages/list/ListWidthLowerBoundAbnormalContainsSubComponentTest", + "MainAbility/pages/list/ListBackgroundColorTest", + "MainAbility/pages/list/ListBorderWidthUnifiedSettingsTest", + "MainAbility/pages/list/ListBorderWidthRespectivelySettingsTest", + "MainAbility/pages/list/ListBorderWidthUnifiedSettingsLowerBoundAbnormalTest", + "MainAbility/pages/list/ListBorderWidthRespectivelySettingsLowerBoundAbnormalTest", + "MainAbility/pages/list/ListBorderColorUnifiedSettingsTest", + "MainAbility/pages/list/ListBorderColorRespectivelySettingsTest", + "MainAbility/pages/list/ListBorderRadiusUnifiedSettingsTest", + "MainAbility/pages/list/ListBorderRadiusRespectivelySettingsTest", + "MainAbility/pages/list/ListBorderRadiusUnifiedSettingsLowerBoundAbnormalTest", + "MainAbility/pages/list/ListBorderRadiusRespectivelySettingsLowerBoundAbnormalTest", + "MainAbility/pages/list/ListOpacityMaxTest", + "MainAbility/pages/list/ListOpacityMinTest", + "MainAbility/pages/list/ListOpacityMiddleTest", + "MainAbility/pages/list/ListOpacityLowerBoundAbnormalTest", + "MainAbility/pages/list/ListOpacityUpperBoundAbnormalTest", + "MainAbility/pages/list/ListClipCutTest", + "MainAbility/pages/list/ListClipUncutTest", + "MainAbility/pages/list/ListClipRectangleTest", + "MainAbility/pages/list/ListClipCircleTest", + "MainAbility/pages/list/ListClipEllipseTest", + "MainAbility/pages/list/ListClipPathTest", + "MainAbility/pages/list/ListHitTestBehaviorDefaultTest", + "MainAbility/pages/list/ListHitTestBehaviorBlockTest", + "MainAbility/pages/list/ListHitTestBehaviorTransparentTest", + "MainAbility/pages/list/ListHitTestBehaviorNoneTest", + "MainAbility/pages/list/ListTranslateSetXYZTest", + "MainAbility/pages/list/ListTranslateSetXTest", + "MainAbility/pages/list/ListTranslateSetXMinusTest", + "MainAbility/pages/list/ListTranslateSetXYZMinusTest", + "MainAbility/pages/list/ListTranslateUnifiedAbnormalTest", + "MainAbility/pages/list/ListTranslateUnifiedMinusAbnormalTest", + "MainAbility/pages/list/ListScaleReduceXYTest", + "MainAbility/pages/list/ListScaleReduceXTest", + "MainAbility/pages/list/ListScaleEnlargeXYTest", + "MainAbility/pages/list/ListScaleEnlargeXTest", + "MainAbility/pages/list/ListScaleAbnormalTest", + "MainAbility/pages/list/ListRotateTest", + "MainAbility/pages/list/ListRotateSetNegativeNumbersTest", + "MainAbility/pages/list/ListRotateDefaultValueTest", + "MainAbility/pages/list/ListRotateSetXYZTest", + "MainAbility/pages/list/ListRotateSetRotationAngleTest", + "MainAbility/pages/list/ListRotateSetSightDistanceTest", + "MainAbility/pages/list/ListBrightnessMinTest", + "MainAbility/pages/list/ListBrightnessMaxTest", + "MainAbility/pages/list/ListBrightnessLowerBoundAbnormalTest", + "MainAbility/pages/list/ListBrightnessUpperBoundAbnormalTest", + "MainAbility/pages/list/ListSaturateMinTest", + "MainAbility/pages/list/ListSaturateMaxTest", + "MainAbility/pages/list/ListSaturateLowerBoundAbnormalTest", + "MainAbility/pages/list/ListSaturateUpperBoundAbnormalTest", + "MainAbility/pages/list/ListBlurTest", + "MainAbility/pages/list/ListBlurDefaultValueTest", + "MainAbility/pages/list/ListBlurAbnormalTest", + "MainAbility/pages/list/ListShadowUltraSmallShadowTest", + "MainAbility/pages/list/ListShadowSmallShadowTest", + "MainAbility/pages/list/ListShadowMiddleShadowTest", + "MainAbility/pages/list/ListShadowLargeShadowTest", + "MainAbility/pages/list/ListShadowFloatingShadowTest", + "MainAbility/pages/list/ListShadowFloatingSmallShadowTest", + "MainAbility/pages/list/ListShadowLowerBoundAbnormalTest", + "MainAbility/pages/list/ListShadowUpperBoundAbnormalTest", + "MainAbility/pages/list/ListLinearGradientLeftTest", + "MainAbility/pages/list/ListLinearGradientTopTest", + "MainAbility/pages/list/ListLinearGradientRightTest", + "MainAbility/pages/list/ListLinearGradientBottomTest", + "MainAbility/pages/list/ListLinearGradientLeftTopTest", + "MainAbility/pages/list/ListLinearGradientLeftBottomTest", + "MainAbility/pages/list/ListLinearGradientRightTopTest", + "MainAbility/pages/list/ListLinearGradientRightBottomTest", + "MainAbility/pages/list/ListLinearGradientNoneTest", + "MainAbility/pages/list/ListLinearGradientCustomTest", + "MainAbility/pages/list/ListLinearGradientLowerBoundAbnormalTest", + "MainAbility/pages/list/ListLinearGradientIllegalColorAbnormalTest", + "MainAbility/pages/list/ListScrollBarOffTest", + "MainAbility/pages/list/ListScrollBarAutoTest", + "MainAbility/pages/list/ListScrollBarOnTest", + "MainAbility/pages/list/ListScrollBarLowerBoundAbnormalTest", + "MainAbility/pages/list/ListScrollBarUpperBoundAbnormalTest", + "MainAbility/pages/list/ListListDirectionVerticalTest", + "MainAbility/pages/list/ListListDirectionHorizontalTest", + "MainAbility/pages/list/ListListDirectionLowerBoundAbnormalTest", + "MainAbility/pages/list/ListListDirectionUpperBoundAbnormalTest", + "MainAbility/pages/list/ListStickyNoneTest", + "MainAbility/pages/list/ListStickyHeaderTest", + "MainAbility/pages/list/ListStickyFooterTest", + "MainAbility/pages/list/ListStickyBothTest", + "MainAbility/pages/list/ListStickyLowerBoundAbnormalTest", + "MainAbility/pages/list/ListStickyUpperBoundAbnormalTest", + "MainAbility/pages/list/ListFrictionDefaultTest", + "MainAbility/pages/list/ListFrictionNormalTest", + "MainAbility/pages/list/ListFrictionAbnormalTest", + "MainAbility/pages/list/ListEnableScrollInteractionSupportedTest", + "MainAbility/pages/list/ListEnableScrollInteractionNotSupportedTest", + "MainAbility/pages/list/ListEnableScrollInteractionLowerBoundAbnormalTest", + "MainAbility/pages/list/ListEnableScrollInteractionUpperBoundAbnormalTest", + "MainAbility/pages/list/ListCachedCountTest", + "MainAbility/pages/listitem/ListItemHeightTest", + "MainAbility/pages/listitem/ListItemHeightBeyondParentComponentTest", + "MainAbility/pages/listitem/ListItemHeightLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemHeightLowerBoundAbnormalContainsSubComponentTest", + "MainAbility/pages/listitem/ListItemWidthTest", + "MainAbility/pages/listitem/ListItemWidthBeyondParentComponentTest", + "MainAbility/pages/listitem/ListItemWidthLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemWidthLowerBoundAbnormalContainsSubComponentTest", + "MainAbility/pages/listitem/ListItemBackgroundColorTest", + "MainAbility/pages/listitem/ListItemBorderWidthUnifiedSettingsTest", + "MainAbility/pages/listitem/ListItemBorderWidthRespectivelySettingsTest", + "MainAbility/pages/listitem/ListItemBorderWidthUnifiedSettingsLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemBorderWidthRespectivelySettingsLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemBorderColorUnifiedSettingsTest", + "MainAbility/pages/listitem/ListItemBorderColorRespectivelySettingsTest", + "MainAbility/pages/listitem/ListItemBorderRadiusUnifiedSettingsTest", + "MainAbility/pages/listitem/ListItemBorderRadiusRespectivelySettingsTest", + "MainAbility/pages/listitem/ListItemBorderRadiusUnifiedSettingsLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemBorderRadiusRespectivelySettingsLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemOpacityMaxTest", + "MainAbility/pages/listitem/ListItemOpacityMinTest", + "MainAbility/pages/listitem/ListItemOpacityMiddleTest", + "MainAbility/pages/listitem/ListItemOpacityLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemOpacityUpperBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemClipCutTest", + "MainAbility/pages/listitem/ListItemClipUncutTest", + "MainAbility/pages/listitem/ListItemClipRectangleTest", + "MainAbility/pages/listitem/ListItemClipCircleTest", + "MainAbility/pages/listitem/ListItemClipEllipseTest", + "MainAbility/pages/listitem/ListItemClipPathTest", + "MainAbility/pages/listitem/ListItemHitTestBehaviorDefaultTest", + "MainAbility/pages/listitem/ListItemHitTestBehaviorBlockTest", + "MainAbility/pages/listitem/ListItemHitTestBehaviorTransparentTest", + "MainAbility/pages/listitem/ListItemHitTestBehaviorNoneTest", + "MainAbility/pages/listitem/ListItemTranslateSetXYZTest", + "MainAbility/pages/listitem/ListItemTranslateSetXTest", + "MainAbility/pages/listitem/ListItemTranslateSetXMinusTest", + "MainAbility/pages/listitem/ListItemTranslateSetXYZMinusTest", + "MainAbility/pages/listitem/ListItemTranslateUnifiedAbnormalTest", + "MainAbility/pages/listitem/ListItemTranslateUnifiedMinusAbnormalTest", + "MainAbility/pages/listitem/ListItemScaleReduceXYTest", + "MainAbility/pages/listitem/ListItemScaleReduceXTest", + "MainAbility/pages/listitem/ListItemScaleEnlargeXYTest", + "MainAbility/pages/listitem/ListItemScaleEnlargeXTest", + "MainAbility/pages/listitem/ListItemScaleAbnormalTest", + "MainAbility/pages/listitem/ListItemRotateTest", + "MainAbility/pages/listitem/ListItemRotateSetNegativeNumbersTest", + "MainAbility/pages/listitem/ListItemRotateDefaultValueTest", + "MainAbility/pages/listitem/ListItemRotateSetXYZTest", + "MainAbility/pages/listitem/ListItemRotateSetRotationAngleTest", + "MainAbility/pages/listitem/ListItemRotateSetSightDistanceTest", + "MainAbility/pages/listitem/ListItemBrightnessMinTest", + "MainAbility/pages/listitem/ListItemBrightnessMaxTest", + "MainAbility/pages/listitem/ListItemBrightnessLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemBrightnessUpperBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemSaturateMinTest", + "MainAbility/pages/listitem/ListItemSaturateMaxTest", + "MainAbility/pages/listitem/ListItemSaturateLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemSaturateUpperBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemBlurTest", + "MainAbility/pages/listitem/ListItemBlurDefaultValueTest", + "MainAbility/pages/listitem/ListItemBlurAbnormalTest", + "MainAbility/pages/listitem/ListItemShadowUltraSmallShadowTest", + "MainAbility/pages/listitem/ListItemShadowSmallShadowTest", + "MainAbility/pages/listitem/ListItemShadowMiddleShadowTest", + "MainAbility/pages/listitem/ListItemShadowLargeShadowTest", + "MainAbility/pages/listitem/ListItemShadowFloatingShadowTest", + "MainAbility/pages/listitem/ListItemShadowFloatingSmallShadowTest", + "MainAbility/pages/listitem/ListItemShadowLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemShadowUpperBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemLinearGradientLeftTest", + "MainAbility/pages/listitem/ListItemLinearGradientTopTest", + "MainAbility/pages/listitem/ListItemLinearGradientRightTest", + "MainAbility/pages/listitem/ListItemLinearGradientBottomTest", + "MainAbility/pages/listitem/ListItemLinearGradientLeftTopTest", + "MainAbility/pages/listitem/ListItemLinearGradientLeftBottomTest", + "MainAbility/pages/listitem/ListItemLinearGradientRightTopTest", + "MainAbility/pages/listitem/ListItemLinearGradientRightBottomTest", + "MainAbility/pages/listitem/ListItemLinearGradientNoneTest", + "MainAbility/pages/listitem/ListItemLinearGradientCustomTest", + "MainAbility/pages/listitem/ListItemLinearGradientLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemLinearGradientIllegalColorAbnormalTest", + "MainAbility/pages/text/TextWidthTest", + "MainAbility/pages/text/TextWidthLargeTest", + "MainAbility/pages/text/TextHeightTest", + "MainAbility/pages/text/TextHeightLargeTest", + "MainAbility/pages/text/TextPositionTest", + "MainAbility/pages/text/TextEnabledTest", + "MainAbility/pages/text/TextBackgroundColorTest", + "MainAbility/pages/text/TextBackgroundImageTest", + "MainAbility/pages/text/TextBorderWidthTest", + "MainAbility/pages/text/TextBorderColorTest", + "MainAbility/pages/text/TextBorderRadiusTest", + "MainAbility/pages/text/TextOpacityTest", + "MainAbility/pages/text/TextFontColorTest", + "MainAbility/pages/text/TextFontSizeTest", + "MainAbility/pages/text/TextMaxLinesTest", + "MainAbility/pages/text/TextLineHeightTest", + "MainAbility/pages/text/TextTextOverflowTest", + "MainAbility/pages/text/TextTextAlignTest", + "MainAbility/pages/text/TextDecorationTest", + "MainAbility/pages/text/TextFontWeightTest", + "MainAbility/pages/text/TextFontStyleTest", + "MainAbility/pages/text/TextPaddingTest", + "MainAbility/pages/text/TextBaselineOffsetTest", + "MainAbility/pages/text/TextTextShadowTest", + "MainAbility/pages/text/TextLetterSpacingTest", + "MainAbility/pages/text/TextTextCaseTest", + "MainAbility/pages/text/TextVisibilityTest", + "MainAbility/pages/text/TextOffsetTest", + "MainAbility/pages/text/TextMaskTest", + "MainAbility/pages/text/TextShadowTest", + "MainAbility/pages/text/TextLinearGradientTest", + "MainAbility/pages/text/TextScaleTest", + "MainAbility/pages/text/TextTransformTest", + "MainAbility/pages/text/TextTextIndentTest", + "MainAbility/pages/text/TextMinFontSizeTest", + "MainAbility/pages/text/TextMaxFontSizeTest", + "MainAbility/pages/text/TextHeightAdaptivePolicyTest", + "MainAbility/pages/text/TextOverlayTest", + "MainAbility/pages/text/TextFontFamilyTest", + "MainAbility/pages/text/TextClipTest", + "MainAbility/pages/text/TextRadialGradientTest", + "MainAbility/pages/text/TextSweepGradientTest", + "MainAbility/pages/text/TextFontTest", + "MainAbility/pages/text/TextAlignTest", + "MainAbility/pages/text/TextCopyOptionTest", + "MainAbility/pages/text/TextLineBreakStrategyTest", + "MainAbility/pages/text/TextAlignRulesTest", + "MainAbility/pages/scroll/ScrollHeightTest", + "MainAbility/pages/scroll/ScrollHeightLargeTest", + "MainAbility/pages/scroll/ScrollPositionTest", + "MainAbility/pages/scroll/ScrollNestedScrollTest", + "MainAbility/pages/scroll/ScrollWidthTest", + "MainAbility/pages/scroll/ScrollWidthLargeTest", + "MainAbility/pages/scroll/ScrollScrollBarAutoTest", + "MainAbility/pages/scroll/ScrollScrollBarOnTest", + "MainAbility/pages/scroll/ScrollScrollBarOffTest", + "MainAbility/pages/scroll/ScrollScrollBarAbnormalTest", + "MainAbility/pages/scroll/ScrollScrollBarColorBlackTest", + "MainAbility/pages/scroll/ScrollScrollBarColorTest", + "MainAbility/pages/scroll/ScrollScrollBarColorWhiteTest", + "MainAbility/pages/scroll/ScrollScrollAbleTest", + "MainAbility/pages/scroll/ScrollScrollAbleAbnormalTest", + "MainAbility/pages/scroll/ScrollScrollAbleHorizontalTest", + "MainAbility/pages/scroll/ScrollScrollAbleNoneTest", + "MainAbility/pages/scroll/ScrollBackgroundColorTest", + "MainAbility/pages/scroll/ScrollBackgroundColorBlackTest", + "MainAbility/pages/scroll/ScrollBackgroundColorWhiteTest", + "MainAbility/pages/scroll/ScrollBorderColorTest", + "MainAbility/pages/scroll/ScrollBorderColorAbnormalTest", + "MainAbility/pages/scroll/ScrollBorderRadiusSingleTest", + "MainAbility/pages/scroll/ScrollBorderRadiusAbnormalTest", + "MainAbility/pages/scroll/ScrollBorderRadiusAllParamTest", + "MainAbility/pages/scroll/ScrollBorderWidthSingleTest", + "MainAbility/pages/scroll/ScrollBorderWidthAbnormalTest", + "MainAbility/pages/scroll/ScrollBorderWidthAllParamTest", + "MainAbility/pages/scroll/ScrollClipTrueTest", + "MainAbility/pages/scroll/ScrollClipFalseTest", + "MainAbility/pages/scroll/ScrollClipAbnormalTest", + "MainAbility/pages/scroll/ScrollEnableScrollInteractionTrueTest", + "MainAbility/pages/scroll/ScrollEnableScrollInteractionFalseTest", + "MainAbility/pages/scroll/ScrollEnableScrollInteractionAbnormalTest", + "MainAbility/pages/scroll/ScrollOpacityAbnormalTest", + "MainAbility/pages/scroll/ScrollOpacityMinTest", + "MainAbility/pages/scroll/ScrollOpacityMiddleTest", + "MainAbility/pages/scroll/ScrollOpacityMaxTest", + "MainAbility/pages/scroll/ScrollTranslateTest", + "MainAbility/pages/scroll/ScrollTranslateDefaultTest", + "MainAbility/pages/scroll/ScrollScaleTest", + "MainAbility/pages/scroll/ScrollScaleNormalTest", + "MainAbility/pages/scroll/ScrollScaleAbNormalTest", + "MainAbility/pages/scroll/ScrollBrightnessTest", + "MainAbility/pages/scroll/ScrollBrightnessAbnormalTest", + "MainAbility/pages/scroll/ScrollBrightnessMaxTest", + "MainAbility/pages/scroll/ScrollBrightnessMinTest", + "MainAbility/pages/scroll/ScrollBlurTest", + "MainAbility/pages/scroll/ScrollBlurDefaultTest", + "MainAbility/pages/scroll/ScrollShadowMiddleTest", + "MainAbility/pages/scroll/ScrollShadowMinTest", + "MainAbility/pages/scroll/ScrollShadowBigTest", + "MainAbility/pages/scroll/ScrollShadowLittleTest", + "MainAbility/pages/scroll/ScrollShadowFloatMiddleTest", + "MainAbility/pages/scroll/ScrollShadowFloatLittleTest", + "MainAbility/pages/scroll/ScrollOnScrollTest", + "MainAbility/pages/scroll/ScrollOnScrollFrameBeginTest", + "MainAbility/pages/scroll/ScrollOnAppearTest", + "MainAbility/pages/scroll/ScrollOnScrollEdgeTest", + "MainAbility/pages/scroll/ScrollScrollEdgeEndTest", + "MainAbility/pages/scroll/ScrollScrollEdgeBottomTest", + "MainAbility/pages/scroll/ScrollScrollEdgeTest", + "MainAbility/pages/scroll/ScrollScrollEdgeStartTest", + "MainAbility/pages/scroll/ScrollOnScrollStartTest", + "MainAbility/pages/scroll/ScrollOnScrollStopTest", + "MainAbility/pages/scroll/ScrollRotateTest", + "MainAbility/pages/scroll/ScrollRotateNormalTest", + "MainAbility/pages/scroll/ScrollRotateAbNormalTest", + "MainAbility/pages/scroll/ScrollEdgeEffectFadeTest", + "MainAbility/pages/scroll/ScrollEdgeEffectSpringTest", + "MainAbility/pages/scroll/ScrollEdgeEffectNoneTest", + "MainAbility/pages/scroll/ScrollFrictionNormalTest", + "MainAbility/pages/scroll/ScrollFrictionAbNormalTest", + "MainAbility/pages/scroll/ScrollFrictionDefaultTest", + "MainAbility/pages/scroll/ScrollScrollSnapNoneTest", + "MainAbility/pages/scroll/ScrollScrollSnapCenterTest", + "MainAbility/pages/scroll/ScrollScrollSnapEndTest", + "MainAbility/pages/scroll/ScrollScrollSnapStartTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetLinearTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetEaseTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetEaseInTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetEaseOutTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetEaseInOutTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetFastOutSlowInTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetLinearOutSlowInTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetFastOutLinearInTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetExtremeDecelerationTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetSharpTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetRhythmTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetSmoothTest", + "MainAbility/pages/scroll/ScrollCurrentOffsetFrictionTest", + "MainAbility/pages/scroll/ScrollScrollToLinearTest", + "MainAbility/pages/scroll/ScrollScrollToEaseTest", + "MainAbility/pages/scroll/ScrollScrollToEaseInTest", + "MainAbility/pages/scroll/ScrollScrollToEaseOutTest", + "MainAbility/pages/scroll/ScrollScrollToEaseInOutTest", + "MainAbility/pages/scroll/ScrollScrollToFastOutSlowInTest", + "MainAbility/pages/scroll/ScrollScrollToLinearOutSlowInTest", + "MainAbility/pages/scroll/ScrollScrollToFastOutLinearInTest", + "MainAbility/pages/scroll/ScrollScrollToExtremeDecelerationTest", + "MainAbility/pages/scroll/ScrollScrollToSharpTest", + "MainAbility/pages/scroll/ScrollScrollToRhythmTest", + "MainAbility/pages/scroll/ScrollScrollToSmoothTest", + "MainAbility/pages/scroll/ScrollScrollToFrictionTest", + "MainAbility/pages/scroll/ScrollOverlayTopTest", + "MainAbility/pages/scroll/ScrollOverlayTopStartTest", + "MainAbility/pages/scroll/ScrollOverlayTopEndTest", + "MainAbility/pages/scroll/ScrollOverlayStartTest", + "MainAbility/pages/scroll/ScrollOverlayCenterTest", + "MainAbility/pages/scroll/ScrollOverlayEndTest", + "MainAbility/pages/scroll/ScrollOverlayBottomStartTest", + "MainAbility/pages/scroll/ScrollOverlayBottomTest", + "MainAbility/pages/scroll/ScrollOverlayBottomEndTest", + "MainAbility/pages/scroll/ScrollHitTestBehaviorTest", + "MainAbility/pages/scroll/ScrollLinearGradientLeftTest", + "MainAbility/pages/scroll/ScrollLinearGradientTopTest", + "MainAbility/pages/scroll/ScrollLinearGradientRightTest", + "MainAbility/pages/scroll/ScrollLinearGradientBottomTest", + "MainAbility/pages/scroll/ScrollLinearGradientLeftTopTest", + "MainAbility/pages/scroll/ScrollLinearGradientLeftBottomTest", + "MainAbility/pages/scroll/ScrollLinearGradientRightTopTest", + "MainAbility/pages/scroll/ScrollLinearGradientRightBottomTest", + "MainAbility/pages/scroll/ScrollLinearGradientNoneTest", + "MainAbility/pages/scroll/ScrollSaturateDefaultTest", + "MainAbility/pages/scroll/ScrollSaturateMinTest", + "MainAbility/pages/scroll/ScrollSaturateMaxTest", + "MainAbility/pages/scroll/ScrollSaturateNormalTest", + "MainAbility/pages/scroll/ScrollPageEnableFalseTest", + "MainAbility/pages/scroll/ScrollPageEnableTrueTest", + "MainAbility/pages/swiper/SwiperVerticalTest", + "MainAbility/pages/swiper/SwiperDisplayCountTest", + "MainAbility/pages/swiper/SwiperIndexTest", + "MainAbility/pages/swiper/SwiperDisplayArrowTest", + "MainAbility/pages/swiper/SwiperItemSpaceTest", + "MainAbility/pages/swiper/SwiperBackgroundColorTest", + "MainAbility/pages/swiper/SwiperAutoPlayTest", + "MainAbility/pages/swiper/SwiperAutoPlayToEndTest", + "MainAbility/pages/swiper/SwiperBackgroundImageTest", + "MainAbility/pages/swiper/SwiperWidthTest", + "MainAbility/pages/swiper/SwiperWidthLargeTest", + "MainAbility/pages/swiper/SwiperHeightTest", + "MainAbility/pages/swiper/SwiperHeightLargeTest", + "MainAbility/pages/swiper/SwiperPositionTest", + "MainAbility/pages/swiper/SwiperIndicatorTest", + "MainAbility/pages/swiper/SwiperClipTest", + "MainAbility/pages/swiper/SwiperDisableSwipeTest", + "MainAbility/pages/swiper/SwiperCachedCountTest", + "MainAbility/pages/toggle/ToggleWidthTest", + "MainAbility/pages/toggle/ToggleWidthLargeTest", + "MainAbility/pages/toggle/ToggleHeightTest", + "MainAbility/pages/toggle/ToggleHeightLargeTest", + "MainAbility/pages/toggle/TogglePositionTest", + "MainAbility/pages/toggle/TogglePositionLargeTest", + "MainAbility/pages/toggle/ToggleOnChangeTest", + "MainAbility/pages/toggle/ToggleFocusableTest", + "MainAbility/pages/toggle/ToggleBackgroundColorTest", + "MainAbility/pages/toggle/ToggleSwitchPointColorTest", + "MainAbility/pages/toggle/ToggleSwitchTest", + "MainAbility/pages/toggle/ToggleMarginTest", + "MainAbility/pages/toggle/ToggleMarginLargeTest", + "MainAbility/pages/toggle/ToggleMarginFourLargeTest", + "MainAbility/pages/toggle/ToggleMarginMiddleTest", + "MainAbility/pages/toggle/ToggleEnabledTest", + "MainAbility/pages/toggle/ToggleSelectedColorTest", + "MainAbility/pages/toggle/ToggleClipTest", + "MainAbility/pages/stack/StackBackgroundColorTest", + "MainAbility/pages/stack/StackBorderColorTest", + "MainAbility/pages/stack/StackBorderRadiusTest", + "MainAbility/pages/stack/StackBrightnessTest", + "MainAbility/pages/stack/StackSaturateTest", + "MainAbility/pages/stack/StackOpacityTest", + "MainAbility/pages/stack/StackScaleTest", + "MainAbility/pages/stack/StackRotateTest", + "MainAbility/pages/stack/StackClipTest", + "MainAbility/pages/stack/StackTranslateTest", + "MainAbility/pages/stack/StackBackgroundImageSizeTest", + "MainAbility/pages/stack/StackBackgroundBlurStyleTest", + "MainAbility/pages/stack/StackShadowTest", + "MainAbility/pages/stack/StackBackgroundImagePositionTest", + "MainAbility/pages/stack/StackBorderWidthTest", + "MainAbility/pages/stack/StackLinearGradientTest", + "MainAbility/pages/stack/StackIdTest", + "MainAbility/pages/stack/StackTransitionTest", + "MainAbility/pages/stack/StackBackgroundImageTest", + "MainAbility/pages/stack/StackHitTestBehaviorTest", + "MainAbility/pages/stack/StackOnAreaChangeTest", + "MainAbility/pages/stack/StackOnTouchTest", + "MainAbility/pages/stack/StackMarginTest", + "MainAbility/pages/stack/StackAlignTest", + "MainAbility/pages/stack/StackWidthTest", + "MainAbility/pages/stack/StackWidthLargeTest", + "MainAbility/pages/stack/StackHeightTest", + "MainAbility/pages/stack/StackHeightLargeTest", + "MainAbility/pages/stack/StackPositionTest", + "MainAbility/pages/stack/StackBorderStyleTest", + "MainAbility/pages/stack/StackTransformTest", + "MainAbility/pages/image/ImageWidthTest", + "MainAbility/pages/image/ImageWidthLargeTest", + "MainAbility/pages/image/ImageHeightTest", + "MainAbility/pages/image/ImageHeightLargeTest", + "MainAbility/pages/image/ImagePositionTest", + "MainAbility/pages/image/ImageBackgroundColorTest", + "MainAbility/pages/image/ImageBorderColorTest", + "MainAbility/pages/image/ImageBorderWidthTest", + "MainAbility/pages/image/ImageBorderRadiusTest", + "MainAbility/pages/image/ImageOpacityTest", + "MainAbility/pages/image/ImageHitTestBehaviorTest", + "MainAbility/pages/image/ImageRotateTest", + "MainAbility/pages/image/ImageScaleTest", + "MainAbility/pages/image/ImageTranslateTest", + "MainAbility/pages/image/ImageBlurTest", + "MainAbility/pages/image/ImageBrightnessTest", + "MainAbility/pages/image/ImageSaturateTest", + "MainAbility/pages/image/ImageAutoResizeTest", + "MainAbility/pages/image/ImageLinearGradientTest", + "MainAbility/pages/image/ImageShadowTest", + "MainAbility/pages/image/ImageInterpolationTest", + "MainAbility/pages/image/ImageObjectFitTest", + "MainAbility/pages/image/ImageObjectRepeatTest", + "MainAbility/pages/image/ImageSrcTest", + "MainAbility/pages/image/ImageColorFilterTest", + "MainAbility/pages/image/ImageBorderStyleTest", + "MainAbility/pages/image/ImageIdTest", + "MainAbility/pages/image/ImageClipTest", + "MainAbility/pages/image/ImageTransformTest", + "MainAbility/pages/image/ImageAltTest", + "MainAbility/pages/image/ImageOnCompleteTest", + "MainAbility/pages/image/ImageOnErrorTest", + "MainAbility/pages/image/ImageRadialGradientTest", + "MainAbility/pages/image/ImageSweepGradientTest", + "MainAbility/pages/column/ColumnWidthTest", + "MainAbility/pages/column/ColumnWidthLargeTest", + "MainAbility/pages/column/ColumnHeightTest", + "MainAbility/pages/column/ColumnHeightLargeTest", + "MainAbility/pages/row/RowHeightTest", + "MainAbility/pages/row/RowHeightLargeTest", + "MainAbility/pages/slider/SliderWidthTest", + "MainAbility/pages/slider/SliderWidthLargeTest", + "MainAbility/pages/slider/SliderHeightTest", + "MainAbility/pages/slider/SliderHeightLargeTest", + "MainAbility/pages/column/ColumnPaddingTest", + "MainAbility/pages/column/ColumnForegroundBlurStyleTest", + "MainAbility/pages/textarea/TextAreaWidthTest", + "MainAbility/pages/textarea/TextAreaWidthLargeTest", + "MainAbility/pages/textarea/TextAreaHeightTest", + "MainAbility/pages/textarea/TextAreaHeightLargeTest", + "MainAbility/pages/textarea/TextAreaPositionTest", + "MainAbility/pages/textarea/TextAreaEnabledTest", + "MainAbility/pages/textinput/TextInputWidthTest", + "MainAbility/pages/textinput/TextInputWidthLargeTest", + "MainAbility/pages/textinput/TextInputHeightTest", + "MainAbility/pages/textinput/TextInputHeightLargeTest", + "MainAbility/pages/textinput/TextInputPositionTest", + "MainAbility/pages/textinput/TextInputShowPasswordIconTest", + "MainAbility/pages/textinput/TextInputSelectedBackgroundColorTest", + "MainAbility/pages/textinput/TextInputCaretStyleTest", + "MainAbility/pages/textinput/TextInputCaretStyleLargeTest", + "MainAbility/pages/textinput/TextInputCaretStyleAbnormalTest", + "MainAbility/pages/textinput/TextInputEnabledTest", + "MainAbility/pages/textinput/TextInputEnterKeyTypeTest", + "MainAbility/pages/textinput/TextInputEnterKeyTypeSearchTest", + "MainAbility/pages/textinput/TextInputEnterKeyTypeSendTest", + "MainAbility/pages/textinput/TextInputEnterKeyTypeNextTest", + "MainAbility/pages/textinput/TextInputEnterKeyTypeDoneTest", + "MainAbility/pages/textinput/TextInputEnterKeyTypePreviousTest", + "MainAbility/pages/textinput/TextInputEnterKeyTypeNewLineTest", + "MainAbility/pages/textinput/TextInputEnterKeyTypeAbnormalTest", + "MainAbility/pages/textinput/TextInputTypeTest", + "MainAbility/pages/textinput/TextInputOnChangeTest", + "MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusTest", + "MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusDisableTest", + "MainAbility/pages/textinput/TextInputEnableKeyboardOnFocusAbnormalTest", + "MainAbility/pages/slider/SliderEnabledTest", + "MainAbility/pages/span/SpanTextCaseTest", + "MainAbility/pages/span/SpanLetterSpacingTest", + "MainAbility/pages/span/SpanDecorationTest", + "MainAbility/pages/span/SpanLineHeightTest", + "MainAbility/pages/calendarpicker/CalendarPickerWidthTest", + "MainAbility/pages/calendarpicker/CalendarPickerWidthLargeTest", + "MainAbility/pages/calendarpicker/CalendarPickerEnabledTest", + "MainAbility/pages/datepicker/DatePickerWidthTest", + "MainAbility/pages/datepicker/DatePickerWidthLargeTest", + "MainAbility/pages/datepicker/DatePickerEnabledTest", + "MainAbility/pages/checkbox/CheckboxWidthTest", + "MainAbility/pages/checkbox/CheckboxWidthLargeTest", + "MainAbility/pages/checkbox/CheckboxHeightTest", + "MainAbility/pages/checkbox/CheckboxHeightLargeTest", + "MainAbility/pages/checkbox/CheckboxEnabledTest", + "MainAbility/pages/xcomponent/XComponentWidthTest", + "MainAbility/pages/xcomponent/XComponentWidthLargeTest", + "MainAbility/pages/xcomponent/XComponentHeightTest", + "MainAbility/pages/xcomponent/XComponentHeightLargeTest", + "MainAbility/pages/textpicker/TextPickerWidthTest", + "MainAbility/pages/textpicker/TextPickerWidthLargeTest", + "MainAbility/pages/textpicker/TextPickerHeightTest", + "MainAbility/pages/textpicker/TextPickerHeightLargeTest", + "MainAbility/pages/flex/FlexWidthTest", + "MainAbility/pages/flex/FlexWidthLargeTest", + "MainAbility/pages/flex/FlexHeightTest", + "MainAbility/pages/flex/FlexHeightLargeTest", + "MainAbility/pages/imagespan/ImageSpanWidthTest", + "MainAbility/pages/imagespan/ImageSpanWidthLargeTest", + "MainAbility/pages/imagespan/ImageSpanHeightTest", + "MainAbility/pages/imagespan/ImageSpanHeightLargeTest", + "MainAbility/pages/imagespan/ImageSpanObjectFitTest", + "MainAbility/pages/imagespan/ImageSpanVerticalAlignTest", + "MainAbility/pages/imagespan/ImageSpanPaddingTest", + "MainAbility/pages/span/SpanFontStyleTest", + "MainAbility/pages/span/SpanFontWeightTest", + "MainAbility/pages/span/SpanFontColorTest", + "MainAbility/pages/span/SpanFontSizeTest", + "MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignStartTest", + "MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignCenterTest", + "MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignEndTest", + "MainAbility/pages/calendarpicker/CalendarPickerEdgeAlignDefaultTest", + "MainAbility/pages/calendarpicker/CalendarPickerTextStyleTest", + "MainAbility/pages/customdialog/CustomDialogOpenTest", + "MainAbility/pages/calendarpicker/CalendarPickerOnChangeTest", + "MainAbility/pages/datepicker/DatePickerLunarTest", + "MainAbility/pages/textpicker/TextPickerRangeTest", + "MainAbility/pages/textpicker/TextPickerSelectedTest", + "MainAbility/pages/textpicker/TextPickerValueTest", + "MainAbility/pages/textpicker/TextPickerDisappearTextStyleTest", + "MainAbility/pages/textpicker/TextPickerTextStyleTest", + "MainAbility/pages/textpicker/TextPickerSelectedTextStyleTest", + "MainAbility/pages/textpicker/TextPickerSelectedIndexTest", + "MainAbility/pages/textpicker/TextPickerCanLoopTest", + "MainAbility/pages/textpicker/TextPickerDefaultPickerItemHeightTest", + "MainAbility/pages/textpicker/TextPickerOnChangeTest", + "MainAbility/pages/xcomponent/XComponentSourceIdTest", + "MainAbility/pages/xcomponent/XComponentTypeTest", + "MainAbility/pages/customdialog/CustomDialogCloseTest", + "MainAbility/pages/timepicker/TimePickerUseMilitaryTimeTest", + "MainAbility/pages/customdialog/CustomDialogAlignmentTopStartTest", + "MainAbility/pages/customdialog/CustomDialogAlignmentTopTest", + "MainAbility/pages/customdialog/CustomDialogAlignmentTopEndTest", + "MainAbility/pages/customdialog/CustomDialogAlignmentStartTest", + "MainAbility/pages/customdialog/CustomDialogAlignmentCenterTest", + "MainAbility/pages/customdialog/CustomDialogAlignmentEndTest", + "MainAbility/pages/customdialog/CustomDialogAlignmentBottomStartTest", + "MainAbility/pages/customdialog/CustomDialogAlignmentBottomTest", + "MainAbility/pages/customdialog/CustomDialogAlignmentBottomEndTest", + "MainAbility/pages/customdialog/CustomDialogAlignmentAbnormalTest", + "MainAbility/pages/customdialog/CustomDialogCustomStyleTest", + "MainAbility/pages/customdialog/CustomDialogMaskColorTest", + "MainAbility/pages/datepicker/DatePickerOnDateChangeTest", + "MainAbility/pages/datepicker/DatePickerStartTest", + "MainAbility/pages/datepicker/DatePickerEndTest", + "MainAbility/pages/datepicker/DatePickerSelectedTest", + "MainAbility/pages/datepicker/DatePickerSelectedTextStyleTest", + "MainAbility/pages/datepicker/DatePickerDisappearTextStyleTest", + "MainAbility/pages/datepicker/DatePickerTextStyleTest", + "MainAbility/pages/timepicker/TimePickerOnChangeTest", + "MainAbility/pages/timepicker/TimePickerHeightTest", + "MainAbility/pages/timepicker/TimePickerSelectedTest", + "MainAbility/pages/timepicker/TimePickerSelectedTextStyleTest", + "MainAbility/pages/timepicker/TimePickerDisappearTextStyleTest", + "MainAbility/pages/timepicker/TimePickerTextStyleTest", + "MainAbility/pages/customcomponent/CustomComponentWidthTest", + "MainAbility/pages/customcomponent/CustomComponentHeightTest", + "MainAbility/pages/customcomponent/CustomComponentBackgroundColorTest", + "MainAbility/pages/customcomponent/CustomComponentPositionTest", + "MainAbility/pages/customcomponent/CustomComponentBorderWidthTest", + "MainAbility/pages/customcomponent/CustomComponentBorderColorTest", + "MainAbility/pages/customcomponent/CustomComponentBorderRadiusTest", + "MainAbility/pages/customcomponent/CustomComponentBorderStyleTest", + "MainAbility/pages/customcomponent/CustomComponentAlignTest", + "MainAbility/pages/customcomponent/CustomComponentDirectionTest", + "MainAbility/pages/customcomponent/CustomComponentEnabledTest", + "MainAbility/pages/customcomponent/CustomComponentFocusableTest", + "MainAbility/pages/customcomponent/CustomComponentOnAppearTest", + "MainAbility/pages/customcomponent/CustomComponentOnAreaChangeTest", + "MainAbility/pages/customcomponent/CustomComponentOnBlurTest", + "MainAbility/pages/customcomponent/CustomComponentOnTouchTest", + "MainAbility/pages/customcomponent/CustomComponentOnFocusTest", + "MainAbility/pages/customcomponent/CustomComponentOnClickTest", + "MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexRowTest", + "MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexColumnTest", + "MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexRowReverseTest", + "MainAbility/pages/customcomponent/CustomComponentFlexBasisFlexColumnReverseTest", + "MainAbility/pages/customcomponent/CustomComponentFlexBasisRowTest", + "MainAbility/pages/customcomponent/CustomComponentFlexBasisColumnTest", + "MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexRowTest", + "MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexColumnTest", + "MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexRowReverseTest", + "MainAbility/pages/customcomponent/CustomComponentFlexGrowFlexColumnReverseTest", + "MainAbility/pages/customcomponent/CustomComponentFlexGrowRowTest", + "MainAbility/pages/customcomponent/CustomComponentFlexGrowColumnTest", + "MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexRowTest", + "MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexColumnTest", + "MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexRowReverseTest", + "MainAbility/pages/customcomponent/CustomComponentFlexShrinkFlexColumnReverseTest", + "MainAbility/pages/customcomponent/CustomComponentFlexShrinkRowTest", + "MainAbility/pages/customcomponent/CustomComponentFlexShrinkColumnTest", + "MainAbility/pages/customcomponent/CustomComponentAlignSelfTest", + "MainAbility/pages/customcomponent/CustomComponentRadialGradientTest", + "MainAbility/pages/customcomponent/CustomComponentSweepGradientTest", + "MainAbility/pages/customcomponent/CustomComponentGrayscaleTest", + "MainAbility/pages/customcomponent/CustomComponentHitTestBehaviorTest", + "MainAbility/pages/customcomponent/CustomComponentIdTest", + "MainAbility/pages/customcomponent/CustomComponentOpacityTest", + "MainAbility/pages/customcomponent/CustomComponentInvertTest", + "MainAbility/pages/customcomponent/CustomComponentSepiaTest", + "MainAbility/pages/customcomponent/CustomComponentContrastTest", + "MainAbility/pages/customcomponent/CustomComponentClipCircleTest", + "MainAbility/pages/customcomponent/CustomComponentClipEllipseTest", + "MainAbility/pages/customcomponent/CustomComponentClipPathTest", + "MainAbility/pages/customcomponent/CustomComponentClipRectangleTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientTopTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientRightTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientBottomTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftTopTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientLeftBottomTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientRightTopTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientRightBottomTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientNoneTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientCustomTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientLowerBoundAbnormalTest", + "MainAbility/pages/customcomponent/CustomComponentLinearGradientIllegalColorAbnormalTest", + "MainAbility/pages/customcomponent/CustomComponentShadowUltraSmallShadowTest", + "MainAbility/pages/customcomponent/CustomComponentShadowSmallShadowTest", + "MainAbility/pages/customcomponent/CustomComponentShadowMiddleShadowTest", + "MainAbility/pages/customcomponent/CustomComponentShadowLargeShadowTest", + "MainAbility/pages/customcomponent/CustomComponentShadowFloatingShadowTest", + "MainAbility/pages/customcomponent/CustomComponentShadowFloatingSmallShadowTest", + "MainAbility/pages/customcomponent/CustomComponentShadowLowerBoundAbnormalTest", + "MainAbility/pages/customcomponent/CustomComponentShadowUpperBoundAbnormalTest", + "MainAbility/pages/customcomponent/CustomComponentScaleReduceXYTest", + "MainAbility/pages/customcomponent/CustomComponentScaleReduceXTest", + "MainAbility/pages/customcomponent/CustomComponentScaleEnlargeXYTest", + "MainAbility/pages/customcomponent/CustomComponentScaleEnlargeXTest", + "MainAbility/pages/customcomponent/CustomComponentScaleAbnormalTest", + "MainAbility/pages/customcomponent/CustomComponentMarginUnifiedTest", + "MainAbility/pages/customcomponent/CustomComponentMarginRespectivelyTest", + "MainAbility/pages/customcomponent/CustomComponentMarginUnifiedNegativeTest", + "MainAbility/pages/customcomponent/CustomComponentMarginRespectivelyNegativeTest", + "MainAbility/pages/customcomponent/CustomComponentConstraintSizeMaxSetMinTest", + "MainAbility/pages/customcomponent/CustomComponentConstraintSizeMaxMinSetTest", + "MainAbility/pages/customcomponent/CustomComponentConstraintSizeSetMaxMinTest", + "MainAbility/pages/customcomponent/CustomComponentConstraintSizeMinSetMaxTest", + "MainAbility/pages/customcomponent/CustomComponentConstraintSizeMinMaxSetTest", + "MainAbility/pages/customcomponent/CustomComponentConstraintSizeSetMinMaxTest", + "MainAbility/pages/customcomponent/CustomComponentTransformTest", + "MainAbility/pages/customcomponent/CustomComponentTransformAbnormalTest", + "MainAbility/pages/customcomponent/CustomComponentMaskTest", + "MainAbility/pages/customcomponent/CustomComponentMaskAbnormalTest", + "MainAbility/pages/customcomponent/CustomComponentBlendModeTest", + "MainAbility/pages/customcomponent/CustomComponentAccessibilityGroupTrueTest", + "MainAbility/pages/customcomponent/CustomComponentAccessibilityGroupFalseTest", + "MainAbility/pages/customcomponent/CustomComponentAccessibilityTextTest", + "MainAbility/pages/customcomponent/CustomComponentAccessibilityTextNullTest", + "MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelAutoTest", + "MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelEnabledTest", + "MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelDisabledTest", + "MainAbility/pages/customcomponent/CustomComponentAccessibilityLevelDescendantsTest", + "MainAbility/pages/customcomponent/CustomComponentAccessibilityDescriptionTest", + "MainAbility/pages/customcomponent/CustomComponentAccessibilityDescriptionNullTest", + "MainAbility/pages/customcomponent/CustomComponentForegroundBlurStyleTest", + "MainAbility/pages/accessibility/TextInputAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/TextInputAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/TextInputAccessibilityTextTest", + "MainAbility/pages/accessibility/TextInputAccessibilityTextNullTest", + "MainAbility/pages/accessibility/TextInputAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/TextInputAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/TextInputAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/TextInputAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/TextInputAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/TextInputAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityTextTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityTextNullTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/SwiperAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/SwiperAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/SwiperAccessibilityTextTest", + "MainAbility/pages/accessibility/SwiperAccessibilityTextNullTest", + "MainAbility/pages/accessibility/SwiperAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/SwiperAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/SwiperAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/SwiperAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/SwiperAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/SwiperAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/ScrollAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/ScrollAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/ScrollAccessibilityTextTest", + "MainAbility/pages/accessibility/ScrollAccessibilityTextNullTest", + "MainAbility/pages/accessibility/ScrollAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/ScrollAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/ScrollAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/ScrollAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/ScrollAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/ScrollAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/ListAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/ListAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/ListAccessibilityTextTest", + "MainAbility/pages/accessibility/ListAccessibilityTextNullTest", + "MainAbility/pages/accessibility/ListAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/ListAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/ListAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/ListAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/ListAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/ListAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/ToggleAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/ToggleAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/ToggleAccessibilityTextTest", + "MainAbility/pages/accessibility/ToggleAccessibilityTextNullTest", + "MainAbility/pages/accessibility/ToggleAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/ToggleAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/ToggleAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/ToggleAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/ToggleAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/ToggleAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/TextAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/TextAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/TextAccessibilityTextTest", + "MainAbility/pages/accessibility/TextAccessibilityTextNullTest", + "MainAbility/pages/accessibility/TextAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/TextAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/TextAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/TextAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/TextAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/TextAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/RefreshAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/RefreshAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/RefreshAccessibilityTextTest", + "MainAbility/pages/accessibility/RefreshAccessibilityTextNullTest", + "MainAbility/pages/accessibility/RefreshAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/RefreshAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/RefreshAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/RefreshAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/RefreshAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/RefreshAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityTextTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityTextNullTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityTextTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityTextNullTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/SliderAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/SliderAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/SliderAccessibilityTextTest", + "MainAbility/pages/accessibility/SliderAccessibilityTextNullTest", + "MainAbility/pages/accessibility/SliderAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/SliderAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/SliderAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/SliderAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/SliderAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/SliderAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/ButtonAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/ButtonAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/ButtonAccessibilityTextTest", + "MainAbility/pages/accessibility/ButtonAccessibilityTextNullTest", + "MainAbility/pages/accessibility/ButtonAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/ButtonAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/ButtonAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/ButtonAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/ButtonAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/ButtonAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityTextTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityTextNullTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityTextTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityTextNullTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/ProgressAccessibilityGroupTrueTest", + "MainAbility/pages/accessibility/ProgressAccessibilityGroupFalseTest", + "MainAbility/pages/accessibility/ProgressAccessibilityTextTest", + "MainAbility/pages/accessibility/ProgressAccessibilityTextNullTest", + "MainAbility/pages/accessibility/ProgressAccessibilityLevelAutoTest", + "MainAbility/pages/accessibility/ProgressAccessibilityLevelEnabledTest", + "MainAbility/pages/accessibility/ProgressAccessibilityLevelDisabledTest", + "MainAbility/pages/accessibility/ProgressAccessibilityLevelDescendantsTest", + "MainAbility/pages/accessibility/ProgressAccessibilityDescriptionTest", + "MainAbility/pages/accessibility/ProgressAccessibilityDescriptionNullTest", + "MainAbility/pages/accessibility/TextInputAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/TextInputAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/TextAreaAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/SwiperAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/SwiperAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/ScrollAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/ScrollAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/ListAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/ListAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/ToggleAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/ToggleAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/TextAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/TextAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/RefreshAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/RefreshAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/DatePickerAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/TimePickerAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/SliderAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/SliderAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/ButtonAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/ButtonAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/TextPickerAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/CheckboxAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/accessibility/ProgressAccessibilityLevelUpperAbnormalTest", + "MainAbility/pages/accessibility/ProgressAccessibilityLevelLowerAbnormalTest", + "MainAbility/pages/textinput/TextInputBackgroundColorTest", + "MainAbility/pages/textinput/TextInputBackgroundImageTest", + "MainAbility/pages/textinput/TextInputCaretColorTest", + "MainAbility/pages/textinput/TextInputClipTest", + "MainAbility/pages/textinput/TextInputFontColorTest", + "MainAbility/pages/textinput/TextInputFontSizeTest", + "MainAbility/pages/textinput/TextInputFontStyleTest", + "MainAbility/pages/textinput/TextInputFontWeightTest", + "MainAbility/pages/textinput/TextInputPaddingTest", + "MainAbility/pages/textinput/TextInputShowUnderLineTest", + "MainAbility/pages/textinput/TextInputTextAlignTest", + "MainAbility/pages/textinput/TextInputOnBlurTest", + "MainAbility/pages/textinput/TextInputOnFocusTest", + "MainAbility/pages/textinput/TextInputOnSubmitTest", + "MainAbility/pages/textinput/TextInputOnCutTest", + "MainAbility/pages/textinput/TextInputOnPasteTest", + "MainAbility/pages/textinput/TextInputDefaultFocusTrueTest", + "MainAbility/pages/textinput/TextInputDefaultFocusFalseTest", + "MainAbility/pages/textinput/TextInputDefaultFocusNoneTest", + "MainAbility/pages/textinput/TextInputDefaultFocusSingleTest", + "MainAbility/pages/textinput/TextInputDefaultFocusMultiTest", + "MainAbility/pages/slider/SliderBlockColorTest", + "MainAbility/pages/slider/SliderBlockStyleTest", + "MainAbility/pages/slider/SliderBlockStyleAbnormalTest", + "MainAbility/pages/slider/SliderDirectionTest", + "MainAbility/pages/slider/SliderDirectionAbnormalTest", + "MainAbility/pages/slider/SliderValueTest", + "MainAbility/pages/slider/SliderValueAbnormalTest", + "MainAbility/pages/slider/SliderValueLargeTest", + "MainAbility/pages/slider/SliderMinTest", + "MainAbility/pages/slider/SliderMinAbnormalTest", + "MainAbility/pages/slider/SliderMinLargeTest", + "MainAbility/pages/slider/SliderMaxTest", + "MainAbility/pages/slider/SliderMaxAbnormalTest", + "MainAbility/pages/slider/SliderMaxLargeTest", + "MainAbility/pages/slider/SliderReverseTest", + "MainAbility/pages/slider/SliderReverseAbnormalTest", + "MainAbility/pages/slider/SliderReverseLargeTest", + "MainAbility/pages/slider/SliderSelectedColorTest", + "MainAbility/pages/slider/SliderShowStepsTest", + "MainAbility/pages/slider/SliderShowStepsAbnormalTest", + "MainAbility/pages/slider/SliderStepTest", + "MainAbility/pages/slider/SliderStepAbnormalTest", + "MainAbility/pages/slider/SliderStepLargeTest", + "MainAbility/pages/slider/SliderStyleTest", + "MainAbility/pages/slider/SliderStyleAbnormalTest", + "MainAbility/pages/slider/SliderStyleLargeTest", + "MainAbility/pages/slider/SliderTrackColorTest", + "MainAbility/pages/slider/SliderOnChangeTest", + "MainAbility/pages/textinput/TextInputLineHeightTest", + "MainAbility/pages/textinput/TextInputLineHeightAbnormalTest", + "MainAbility/pages/textinput/TextInputStopEditingTrueTest", + "MainAbility/pages/textinput/TextInputStopEditingNoneTrueTest", + "MainAbility/pages/textinput/TextInputStopEditingNoneFalseTest", + "MainAbility/pages/textinput/TextInputStopEditingFalseTest", + "MainAbility/pages/textarea/TextAreaFontColorTest", + "MainAbility/pages/textarea/TextAreaFontColorBlackTest", + "MainAbility/pages/textarea/TextAreaFontColorWhiteTest", + "MainAbility/pages/textarea/TextAreaFontFamilyTest", + "MainAbility/pages/textarea/TextAreaFontFamilyNoneTest", + "MainAbility/pages/textarea/TextAreaFontSizeTest", + "MainAbility/pages/textarea/TextAreaFontSizeNoneTest", + "MainAbility/pages/textarea/TextAreaFontSizeAbnormalTest", + "MainAbility/pages/textarea/TextAreaFontStyleItalicTest", + "MainAbility/pages/textarea/TextAreaFontStyleNormalTest", + "MainAbility/pages/textarea/TextAreaFontWeightTest", + "MainAbility/pages/textarea/TextAreaMaxLengthTest", + "MainAbility/pages/textarea/TextAreaMaxLengthNoneTest", + "MainAbility/pages/textarea/TextAreaMaxLengthAbnormalTest", + "MainAbility/pages/textarea/TextAreaTextAlignStartTest", + "MainAbility/pages/textarea/TextAreaTextAlignCenterTest", + "MainAbility/pages/textarea/TextAreaTextAlignEndTest", + "MainAbility/pages/textarea/TextAreaTextAlignJustifyTest", + "MainAbility/pages/textarea/TextAreaTextAlignAbnormalTest", + "MainAbility/pages/textarea/TextAreaPlaceHolderColorTest", + "MainAbility/pages/textarea/TextAreaPlaceHolderColorBlackTest", + "MainAbility/pages/textarea/TextAreaPlaceHolderColorWhiteTest", + "MainAbility/pages/textarea/TextAreaPlaceholderFontTest", + "MainAbility/pages/textarea/TextAreaPaddingTest", + "MainAbility/pages/textarea/TextAreaPaddingAllTest", + "MainAbility/pages/textarea/TextAreaBackgroundColorTest", + "MainAbility/pages/textarea/TextAreaBackgroundColorBlackTest", + "MainAbility/pages/textarea/TextAreaBackgroundColorWhiteTest", + "MainAbility/pages/textarea/TextAreaBorderRadiusSingleTest", + "MainAbility/pages/textarea/TextAreaBorderRadiusAllParamTest", + "MainAbility/pages/textarea/TextAreaBorderRadiusAbnormalTest", + "MainAbility/pages/textarea/TextAreaCaretColorTest", + "MainAbility/pages/textarea/TextAreaCaretColorBlackTest", + "MainAbility/pages/textarea/TextAreaCaretColorWhiteTest", + "MainAbility/pages/textarea/TextAreaLineHeightTest", + "MainAbility/pages/textarea/TextAreaLineHeightNoneTest", + "MainAbility/pages/textarea/TextAreaStopEditingTrueTest", + "MainAbility/pages/textarea/TextAreaStopEditingNoneTrueTest", + "MainAbility/pages/textarea/TextAreaStopEditingNoneFalseTest", + "MainAbility/pages/textarea/TextAreaStopEditingFalseTest", + "MainAbility/pages/textarea/TextAreaOnChangeTest", + "MainAbility/pages/textarea/TextAreaDefaultFocusTrueTest", + "MainAbility/pages/textarea/TextAreaDefaultFocusFalseTest", + "MainAbility/pages/textarea/TextAreaDefaultFocusNoneTest", + "MainAbility/pages/textarea/TextAreaDefaultFocusSingleTest", + "MainAbility/pages/textarea/TextAreaDefaultFocusMultiTest", + "MainAbility/pages/textarea/TextAreaOnBlurTest", + "MainAbility/pages/loadingprogress/LoadingProgressColorTest", + "MainAbility/pages/loadingprogress/LoadingProgressColorBlackTest", + "MainAbility/pages/loadingprogress/LoadingProgressColorWhiteTest", + "MainAbility/pages/loadingprogress/LoadingProgressEnableLoadingFalseTest", + "MainAbility/pages/loadingprogress/LoadingProgressEnableLoadingTrueTest", + "MainAbility/pages/progress/ProgressColorTest", + "MainAbility/pages/progress/ProgressColorBlackTest", + "MainAbility/pages/progress/ProgressColorWhiteTest", + "MainAbility/pages/progress/ProgressBackgroundColorTest", + "MainAbility/pages/progress/ProgressBackgroundColorBlackTest", + "MainAbility/pages/progress/ProgressBackgroundColorWhiteTest", + "MainAbility/pages/progress/ProgressStyleRingTest", + "MainAbility/pages/progress/ProgressStyleEclipseTest", + "MainAbility/pages/progress/ProgressStyleScaleRingTest", + "MainAbility/pages/progress/ProgressStyleCapsuleTest", + "MainAbility/pages/progress/ProgressStyleLinearTest", + "MainAbility/pages/textarea/TextAreaOnFocusTest", + "MainAbility/pages/refresh/RefreshOnStateChangeTest", + "MainAbility/pages/refresh/RefreshOnRefreshingTest", + "MainAbility/pages/textinput/TextInputMaxLengthTest", + "MainAbility/pages/textinput/TextInputMaxLengthNoneTest", + "MainAbility/pages/textinput/TextInputMaxLengthAbnormalTest", + "MainAbility/pages/textinput/TextInputPlaceholderColorTest", + "MainAbility/pages/textinput/TextInputPlaceholderColorBlackTest", + "MainAbility/pages/textinput/TextInputPlaceholderColorWhiteTest", + "MainAbility/pages/textinput/TextInputPlaceholderFontTest", + "MainAbility/pages/textinput/TextInputFontFamilySingleTest", + "MainAbility/pages/textinput/TextInputFontFamilyAddTest", + "MainAbility/pages/textinput/TextInputClearButtonModeInputTest", + "MainAbility/pages/textinput/TextInputClearButtonModeInvisibleTest", + "MainAbility/pages/textinput/TextInputClearButtonModeConstantTest", + "MainAbility/pages/textinput/TextInputClearButtonModeAbnormalTest", + "MainAbility/pages/textinput/TextInputResponseRegionSingleTest", + "MainAbility/pages/textinput/TextInputResponseRegionDoubleTest", + "MainAbility/pages/textarea/TextAreaResponseRegionSingleTest", + "MainAbility/pages/textarea/TextAreaResponseRegionDoubleTest", + "MainAbility/pages/textarea/TextAreaKeyTest", + "MainAbility/pages/textinput/TextInputKeyTest", + "MainAbility/pages/list/ListBackgroundColorNullTest", + "MainAbility/pages/list/ListBackgroundColorUndefinedTest", + "MainAbility/pages/list/ListBorderColorNullTest", + "MainAbility/pages/list/ListBorderColorUndefinedTest", + "MainAbility/pages/list/ListCachedCountAbnormalTest", + "MainAbility/pages/list/ListEdgeEffectSpringTest", + "MainAbility/pages/list/ListEdgeEffectFadeTest", + "MainAbility/pages/list/ListEdgeEffectNoneTest", + "MainAbility/pages/list/ListEdgeEffectLowerBoundAbnormalTest", + "MainAbility/pages/list/ListEdgeEffectUpperBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemEdgeEffectSpringTest", + "MainAbility/pages/listitem/ListItemEdgeEffectFadeTest", + "MainAbility/pages/listitem/ListItemEdgeEffectNoneTest", + "MainAbility/pages/listitem/ListItemEdgeEffectLowerBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemEdgeEffectUpperBoundAbnormalTest", + "MainAbility/pages/listitem/ListItemBackgroundColorNullTest", + "MainAbility/pages/listitem/ListItemBackgroundColorUndefinedTest", + "MainAbility/pages/listitem/ListItemBorderColorNullTest", + "MainAbility/pages/listitem/ListItemBorderColorUndefinedTest", + "MainAbility/pages/listitem/ListItemCachedCountAbnormalTest", + "MainAbility/pages/scroll/ScrollBorderColorNullTest", + "MainAbility/pages/scroll/ScrollBorderColorUndefinedTest", + "MainAbility/pages/slider/SliderMaxEqualMinTest", + "MainAbility/pages/slider/SliderStepUnevenTest", + "MainAbility/pages/textinput/TextInputStopEditingAbnormalTest", + "MainAbility/pages/textinput/TextInputStopEditingNoneAbnormalTest", + "MainAbility/pages/textinput/TextInputDefaultFocusAbnormalTest", + "MainAbility/pages/textarea/TextAreaStopEditingAbnormalTest", + "MainAbility/pages/textarea/TextAreaStopEditingNoneAbnormalTest", + "MainAbility/pages/textarea/TextAreaDefaultFocusAbnormalTest", + "MainAbility/pages/textinput/TextInputCaretStyleDecimalTest", + "MainAbility/pages/datepicker/DatePickerStartAbnormalTest", + "MainAbility/pages/datepicker/DatePickerEndAbnormalTest", + "MainAbility/pages/datepicker/DatePickerSelectedAbnormalTest", + "MainAbility/pages/textpicker/TextPickerDisappearTextStyleBoldTest", + "MainAbility/pages/textpicker/TextPickerDisappearTextStyleNormalTest", + "MainAbility/pages/textpicker/TextPickerDisappearTextStyleBolderTest", + "MainAbility/pages/textpicker/TextPickerDisappearTextStyleLighterTest", + "MainAbility/pages/textpicker/TextPickerDisappearTextStyleMediumTest", + "MainAbility/pages/textpicker/TextPickerDisappearTextStyleRegularTest", + "MainAbility/pages/textpicker/TextPickerTextStyleBoldTest", + "MainAbility/pages/textpicker/TextPickerTextStyleNormalTest", + "MainAbility/pages/textpicker/TextPickerTextStyleBolderTest", + "MainAbility/pages/textpicker/TextPickerTextStyleLighterTest", + "MainAbility/pages/textpicker/TextPickerTextStyleMediumTest", + "MainAbility/pages/textpicker/TextPickerTextStyleRegularTest", + "MainAbility/pages/textpicker/TextPickerSelectedTextStyleBoldTest", + "MainAbility/pages/textpicker/TextPickerSelectedTextStyleNormalTest", + "MainAbility/pages/textpicker/TextPickerSelectedTextStyleBolderTest", + "MainAbility/pages/textpicker/TextPickerSelectedTextStyleLighterTest", + "MainAbility/pages/textpicker/TextPickerSelectedTextStyleMediumTest", + "MainAbility/pages/textpicker/TextPickerSelectedTextStyleRegularTest", + "MainAbility/pages/timepicker/TimePickerTextStyleBoldTest", + "MainAbility/pages/timepicker/TimePickerTextStyleNormalTest", + "MainAbility/pages/timepicker/TimePickerTextStyleBolderTest", + "MainAbility/pages/timepicker/TimePickerTextStyleLighterTest", + "MainAbility/pages/timepicker/TimePickerTextStyleMediumTest", + "MainAbility/pages/timepicker/TimePickerTextStyleRegularTest", + "MainAbility/pages/timepicker/TimePickerSelectedTextStyleBoldTest", + "MainAbility/pages/timepicker/TimePickerSelectedTextStyleNormalTest", + "MainAbility/pages/timepicker/TimePickerSelectedTextStyleBolderTest", + "MainAbility/pages/timepicker/TimePickerSelectedTextStyleLighterTest", + "MainAbility/pages/timepicker/TimePickerSelectedTextStyleMediumTest", + "MainAbility/pages/timepicker/TimePickerSelectedTextStyleRegularTest", + "MainAbility/pages/timepicker/TimePickerDisappearTextStyleBoldTest", + "MainAbility/pages/timepicker/TimePickerDisappearTextStyleNormalTest", + "MainAbility/pages/timepicker/TimePickerDisappearTextStyleBolderTest", + "MainAbility/pages/timepicker/TimePickerDisappearTextStyleLighterTest", + "MainAbility/pages/timepicker/TimePickerDisappearTextStyleMediumTest", + "MainAbility/pages/timepicker/TimePickerDisappearTextStyleRegularTest", + "MainAbility/pages/swiper/SwiperLoopTest", + "MainAbility/pages/swiper/SwiperCurveTest", + "MainAbility/pages/swiper/SwiperIntervalTest", + "MainAbility/pages/swiper/SwiperDurationTest", + "MainAbility/pages/commonattrs/CommonAttrsFocusableCombineTest", + "MainAbility/pages/toggle/ToggleFocusableCombineTest", + "MainAbility/pages/scroll/ScrollScrollBarColorNullTest", + "MainAbility/pages/scroll/ScrollScrollBarColorUndefinedTest", + "MainAbility/pages/scroll/ScrollScrollSnapLowerAbnormalTest", + "MainAbility/pages/scroll/ScrollScrollSnapUpperAbnormalTest" + ] +} + diff --git a/scenario/arkui/arkui_capi_demo/hvigor/hvigor-config.json5 b/scenario/arkui/arkui_capi_demo/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..0450bec27475c1853a73087292c8a8d946880600 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/hvigor/hvigor-config.json5 @@ -0,0 +1,6 @@ +{ + "hvigorVersion": "2.4.2", + "dependencies": { + "@ohos/hvigor-ohos-plugin": "2.4.2" + } +} diff --git a/scenario/arkui/arkui_capi_demo/hvigor/hvigor-wrapper.js b/scenario/arkui/arkui_capi_demo/hvigor/hvigor-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..994f22987bd0739b9faa07c966b066c2d9218602 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/hvigor/hvigor-wrapper.js @@ -0,0 +1,2 @@ +"use strict";var e=require("fs"),t=require("path"),n=require("os"),r=require("crypto"),u=require("child_process"),o=require("constants"),i=require("stream"),s=require("util"),c=require("assert"),a=require("tty"),l=require("zlib"),f=require("net");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var D=d(e),p=d(t),E=d(n),m=d(r),h=d(u),y=d(o),C=d(i),F=d(s),g=d(c),A=d(a),v=d(l),S=d(f),w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},O={},b={},_={},B=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_,"__esModule",{value:!0}),_.isMac=_.isLinux=_.isWindows=void 0;const P=B(E.default),k="Windows_NT",x="Linux",N="Darwin";_.isWindows=function(){return P.default.type()===k},_.isLinux=function(){return P.default.type()===x},_.isMac=function(){return P.default.type()===N};var I={},T=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),R=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),M=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&T(t,e,n);return R(t,e),t};Object.defineProperty(I,"__esModule",{value:!0}),I.hash=void 0;const L=M(m.default);I.hash=function(e,t="md5"){return L.createHash(t).update(e,"utf-8").digest("hex")},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r};Object.defineProperty(e,"__esModule",{value:!0}),e.HVIGOR_BOOT_JS_FILE_PATH=e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=e.HVIGOR_PROJECT_DEPENDENCIES_HOME=e.HVIGOR_PROJECT_WRAPPER_HOME=e.HVIGOR_PROJECT_NAME=e.HVIGOR_PROJECT_ROOT_DIR=e.HVIGOR_PROJECT_CACHES_HOME=e.HVIGOR_PNPM_STORE_PATH=e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=e.HVIGOR_WRAPPER_TOOLS_HOME=e.HVIGOR_USER_HOME=e.DEFAULT_PACKAGE_JSON=e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=e.PNPM=e.HVIGOR=e.NPM_TOOL=e.PNPM_TOOL=e.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const u=r(p.default),o=r(E.default),i=_,s=I;e.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",e.PNPM_TOOL=(0,i.isWindows)()?"pnpm.cmd":"pnpm",e.NPM_TOOL=(0,i.isWindows)()?"npm.cmd":"npm",e.HVIGOR="hvigor",e.PNPM="pnpm",e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",e.DEFAULT_PACKAGE_JSON="package.json",e.HVIGOR_USER_HOME=u.resolve(o.homedir(),".hvigor"),e.HVIGOR_WRAPPER_TOOLS_HOME=u.resolve(e.HVIGOR_USER_HOME,"wrapper","tools"),e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=u.resolve(e.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",e.PNPM_TOOL),e.HVIGOR_PNPM_STORE_PATH=u.resolve(e.HVIGOR_USER_HOME,"caches"),e.HVIGOR_PROJECT_CACHES_HOME=u.resolve(e.HVIGOR_USER_HOME,"project_caches"),e.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),e.HVIGOR_PROJECT_NAME=u.basename((0,s.hash)(e.HVIGOR_PROJECT_ROOT_DIR)),e.HVIGOR_PROJECT_WRAPPER_HOME=u.resolve(e.HVIGOR_PROJECT_ROOT_DIR,e.HVIGOR),e.HVIGOR_PROJECT_DEPENDENCIES_HOME=u.resolve(e.HVIGOR_PROJECT_CACHES_HOME,e.HVIGOR_PROJECT_NAME,"workspace"),e.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,e.DEFAULT_PACKAGE_JSON),e.HVIGOR_BOOT_JS_FILE_PATH=u.resolve(e.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js")}(b);var j={},$={};Object.defineProperty($,"__esModule",{value:!0}),$.logInfoPrintConsole=$.logErrorAndExit=void 0,$.logErrorAndExit=function(e){e instanceof Error?console.error(e.message):console.error(e),process.exit(-1)},$.logInfoPrintConsole=function(e){console.log(e)};var H=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),J=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),G=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&H(t,e,n);return J(t,e),t},V=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(j,"__esModule",{value:!0}),j.isFileExists=j.offlinePluginConversion=j.executeCommand=j.getNpmPath=j.hasNpmPackInPaths=void 0;const U=h.default,W=G(p.default),z=b,K=$,q=V(D.default);j.hasNpmPackInPaths=function(e,t){try{return require.resolve(e,{paths:[...t]}),!0}catch(e){return!1}},j.getNpmPath=function(){const e=process.execPath;return W.join(W.dirname(e),z.NPM_TOOL)},j.executeCommand=function(e,t,n){0!==(0,U.spawnSync)(e,t,n).status&&(0,K.logErrorAndExit)(`Error: ${e} ${t} execute failed.See above for details.`)},j.offlinePluginConversion=function(e,t){return t.startsWith("file:")||t.endsWith(".tgz")?W.resolve(e,z.HVIGOR,t.replace("file:","")):t},j.isFileExists=function(e){return q.default.existsSync(e)&&q.default.statSync(e).isFile()},function(e){var t=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var u in e)"default"!==u&&Object.prototype.hasOwnProperty.call(e,u)&&t(r,e,u);return n(r,e),r},u=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.executeInstallPnpm=e.isPnpmAvailable=e.environmentHandler=e.checkNpmConifg=e.PNPM_VERSION=void 0;const o=r(D.default),i=b,s=j,c=r(p.default),a=$,l=h.default,f=u(E.default);e.PNPM_VERSION="7.30.0",e.checkNpmConifg=function(){const e=c.resolve(i.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),t=c.resolve(f.default.homedir(),".npmrc");if((0,s.isFileExists)(e)||(0,s.isFileExists)(t))return;const n=(0,s.getNpmPath)(),r=(0,l.spawnSync)(n,["config","get","prefix"],{cwd:i.HVIGOR_PROJECT_ROOT_DIR});if(0!==r.status||!r.stdout)return void(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const u=c.resolve(`${r.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,s.isFileExists)(u)||(0,a.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},e.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},e.isPnpmAvailable=function(){return!!o.existsSync(i.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,s.hasNpmPackInPaths)("pnpm",[i.HVIGOR_WRAPPER_TOOLS_HOME])},e.executeInstallPnpm=function(){(0,a.logInfoPrintConsole)(`Installing pnpm@${e.PNPM_VERSION}...`);const t=(0,s.getNpmPath)();!function(){const t=c.resolve(i.HVIGOR_WRAPPER_TOOLS_HOME,i.DEFAULT_PACKAGE_JSON);try{o.existsSync(i.HVIGOR_WRAPPER_TOOLS_HOME)||o.mkdirSync(i.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const n={dependencies:{}};n.dependencies[i.PNPM]=e.PNPM_VERSION,o.writeFileSync(t,JSON.stringify(n))}catch(e){(0,a.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${t} failed.`)}}(),(0,s.executeCommand)(t,["install","pnpm"],{cwd:i.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,a.logInfoPrintConsole)("Pnpm install success.")}}(O);var Y={},X={},Z={},Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.Unicode=void 0;class ee{}Q.Unicode=ee,ee.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ee.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ee.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(Z,"__esModule",{value:!0}),Z.JudgeUtil=void 0;const te=Q;Z.JudgeUtil=class{static isIgnoreChar(e){return"string"==typeof e&&("\t"===e||"\v"===e||"\f"===e||" "===e||" "===e||"\ufeff"===e||"\n"===e||"\r"===e||"\u2028"===e||"\u2029"===e)}static isSpaceSeparator(e){return"string"==typeof e&&te.Unicode.Space_Separator.test(e)}static isIdStartChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||"$"===e||"_"===e||te.Unicode.ID_Start.test(e))}static isIdContinueChar(e){return"string"==typeof e&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||"$"===e||"_"===e||"‌"===e||"‍"===e||te.Unicode.ID_Continue.test(e))}static isDigitWithoutZero(e){return/[1-9]/.test(e)}static isDigit(e){return"string"==typeof e&&/[0-9]/.test(e)}static isHexDigit(e){return"string"==typeof e&&/[0-9A-Fa-f]/.test(e)}};var ne={},re={fromCallback:function(e){return Object.defineProperty((function(...t){if("function"!=typeof t[t.length-1])return new Promise(((n,r)=>{e.call(this,...t,((e,t)=>null!=e?r(e):n(t)))}));e.apply(this,t)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(...t){const n=t[t.length-1];if("function"!=typeof n)return e.apply(this,t);e.apply(this,t.slice(0,-1)).then((e=>n(null,e)),n)}),"name",{value:e.name})}},ue=y.default,oe=process.cwd,ie=null,se=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ie||(ie=oe.call(process)),ie};try{process.cwd()}catch(e){}if("function"==typeof process.chdir){var ce=process.chdir;process.chdir=function(e){ie=null,ce.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ce)}var ae=function(e){ue.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&function(e){e.lchmod=function(t,n,r){e.open(t,ue.O_WRONLY|ue.O_SYMLINK,n,(function(t,u){t?r&&r(t):e.fchmod(u,n,(function(t){e.close(u,(function(e){r&&r(t||e)}))}))}))},e.lchmodSync=function(t,n){var r,u=e.openSync(t,ue.O_WRONLY|ue.O_SYMLINK,n),o=!0;try{r=e.fchmodSync(u,n),o=!1}finally{if(o)try{e.closeSync(u)}catch(e){}else e.closeSync(u)}return r}}(e);e.lutimes||function(e){ue.hasOwnProperty("O_SYMLINK")&&e.futimes?(e.lutimes=function(t,n,r,u){e.open(t,ue.O_SYMLINK,(function(t,o){t?u&&u(t):e.futimes(o,n,r,(function(t){e.close(o,(function(e){u&&u(t||e)}))}))}))},e.lutimesSync=function(t,n,r){var u,o=e.openSync(t,ue.O_SYMLINK),i=!0;try{u=e.futimesSync(o,n,r),i=!1}finally{if(i)try{e.closeSync(o)}catch(e){}else e.closeSync(o)}return u}):e.futimes&&(e.lutimes=function(e,t,n,r){r&&process.nextTick(r)},e.lutimesSync=function(){})}(e);e.chown=r(e.chown),e.fchown=r(e.fchown),e.lchown=r(e.lchown),e.chmod=t(e.chmod),e.fchmod=t(e.fchmod),e.lchmod=t(e.lchmod),e.chownSync=u(e.chownSync),e.fchownSync=u(e.fchownSync),e.lchownSync=u(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=i(e.statSync),e.fstatSync=i(e.fstatSync),e.lstatSync=i(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(e,t,n){n&&process.nextTick(n)},e.lchmodSync=function(){});e.chown&&!e.lchown&&(e.lchown=function(e,t,n,r){r&&process.nextTick(r)},e.lchownSync=function(){});"win32"===se&&(e.rename="function"!=typeof e.rename?e.rename:function(t){function n(n,r,u){var o=Date.now(),i=0;t(n,r,(function s(c){if(c&&("EACCES"===c.code||"EPERM"===c.code||"EBUSY"===c.code)&&Date.now()-o<6e4)return setTimeout((function(){e.stat(r,(function(e,o){e&&"ENOENT"===e.code?t(n,r,s):u(c)}))}),i),void(i<100&&(i+=10));u&&u(c)}))}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.rename));function t(t){return t?function(n,r,u){return t.call(e,n,r,(function(e){s(e)&&(e=null),u&&u.apply(this,arguments)}))}:t}function n(t){return t?function(n,r){try{return t.call(e,n,r)}catch(e){if(!s(e))throw e}}:t}function r(t){return t?function(n,r,u,o){return t.call(e,n,r,u,(function(e){s(e)&&(e=null),o&&o.apply(this,arguments)}))}:t}function u(t){return t?function(n,r,u){try{return t.call(e,n,r,u)}catch(e){if(!s(e))throw e}}:t}function o(t){return t?function(n,r,u){function o(e,t){t&&(t.uid<0&&(t.uid+=4294967296),t.gid<0&&(t.gid+=4294967296)),u&&u.apply(this,arguments)}return"function"==typeof r&&(u=r,r=null),r?t.call(e,n,r,o):t.call(e,n,o)}:t}function i(t){return t?function(n,r){var u=r?t.call(e,n,r):t.call(e,n);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}:t}function s(e){return!e||("ENOSYS"===e.code||!(process.getuid&&0===process.getuid()||"EINVAL"!==e.code&&"EPERM"!==e.code))}e.read="function"!=typeof e.read?e.read:function(t){function n(n,r,u,o,i,s){var c;if(s&&"function"==typeof s){var a=0;c=function(l,f,d){if(l&&"EAGAIN"===l.code&&a<10)return a++,t.call(e,n,r,u,o,i,c);s.apply(this,arguments)}}return t.call(e,n,r,u,o,i,c)}return Object.setPrototypeOf&&Object.setPrototypeOf(n,t),n}(e.read),e.readSync="function"!=typeof e.readSync?e.readSync:(c=e.readSync,function(t,n,r,u,o){for(var i=0;;)try{return c.call(e,t,n,r,u,o)}catch(e){if("EAGAIN"===e.code&&i<10){i++;continue}throw e}});var c};var le=C.default.Stream,fe=function(e){return{ReadStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,r=r||{};for(var o=Object.keys(r),i=0,s=o.length;ithis.end)throw new Error("start must be <= end");this.pos=this.start}if(null!==this.fd)return void process.nextTick((function(){u._read()}));e.open(this.path,this.flags,this.mode,(function(e,t){if(e)return u.emit("error",e),void(u.readable=!1);u.fd=t,u.emit("open",t),u._read()}))},WriteStream:function t(n,r){if(!(this instanceof t))return new t(n,r);le.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var u=Object.keys(r),o=0,i=u.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],null===this.fd&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}};var de=function(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Object)var t={__proto__:De(e)};else t=Object.create(null);return Object.getOwnPropertyNames(e).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})),t},De=Object.getPrototypeOf||function(e){return e.__proto__};var pe,Ee,me=D.default,he=ae,ye=fe,Ce=de,Fe=F.default;function ge(e,t){Object.defineProperty(e,pe,{get:function(){return t}})}"function"==typeof Symbol&&"function"==typeof Symbol.for?(pe=Symbol.for("graceful-fs.queue"),Ee=Symbol.for("graceful-fs.previous")):(pe="___graceful-fs.queue",Ee="___graceful-fs.previous");var Ae=function(){};if(Fe.debuglog?Ae=Fe.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ae=function(){var e=Fe.format.apply(Fe,arguments);e="GFS4: "+e.split(/\n/).join("\nGFS4: "),console.error(e)}),!me[pe]){var ve=w[pe]||[];ge(me,ve),me.close=function(e){function t(t,n){return e.call(me,t,(function(e){e||_e(),"function"==typeof n&&n.apply(this,arguments)}))}return Object.defineProperty(t,Ee,{value:e}),t}(me.close),me.closeSync=function(e){function t(t){e.apply(me,arguments),_e()}return Object.defineProperty(t,Ee,{value:e}),t}(me.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",(function(){Ae(me[pe]),g.default.equal(me[pe].length,0)}))}w[pe]||ge(w,me[pe]);var Se,we=Oe(Ce(me));function Oe(e){he(e),e.gracefulify=Oe,e.createReadStream=function(t,n){return new e.ReadStream(t,n)},e.createWriteStream=function(t,n){return new e.WriteStream(t,n)};var t=e.readFile;e.readFile=function(e,n,r){"function"==typeof n&&(r=n,n=null);return function e(n,r,u,o){return t(n,r,(function(t){!t||"EMFILE"!==t.code&&"ENFILE"!==t.code?"function"==typeof u&&u.apply(this,arguments):be([e,[n,r,u],t,o||Date.now(),Date.now()])}))}(e,n,r)};var n=e.writeFile;e.writeFile=function(e,t,r,u){"function"==typeof r&&(u=r,r=null);return function e(t,r,u,o,i){return n(t,r,u,(function(n){!n||"EMFILE"!==n.code&&"ENFILE"!==n.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,r,u,o],n,i||Date.now(),Date.now()])}))}(e,t,r,u)};var r=e.appendFile;r&&(e.appendFile=function(e,t,n,u){"function"==typeof n&&(u=n,n=null);return function e(t,n,u,o,i){return r(t,n,u,(function(r){!r||"EMFILE"!==r.code&&"ENFILE"!==r.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,u,o],r,i||Date.now(),Date.now()])}))}(e,t,n,u)});var u=e.copyFile;u&&(e.copyFile=function(e,t,n,r){"function"==typeof n&&(r=n,n=0);return function e(t,n,r,o,i){return u(t,n,r,(function(u){!u||"EMFILE"!==u.code&&"ENFILE"!==u.code?"function"==typeof o&&o.apply(this,arguments):be([e,[t,n,r,o],u,i||Date.now(),Date.now()])}))}(e,t,n,r)});var o=e.readdir;e.readdir=function(e,t,n){"function"==typeof t&&(n=t,t=null);var r=i.test(process.version)?function(e,t,n,r){return o(e,u(e,t,n,r))}:function(e,t,n,r){return o(e,t,u(e,t,n,r))};return r(e,t,n);function u(e,t,n,u){return function(o,i){!o||"EMFILE"!==o.code&&"ENFILE"!==o.code?(i&&i.sort&&i.sort(),"function"==typeof n&&n.call(this,o,i)):be([r,[e,t,n],o,u||Date.now(),Date.now()])}}};var i=/^v[0-5]\./;if("v0.8"===process.version.substr(0,4)){var s=ye(e);d=s.ReadStream,D=s.WriteStream}var c=e.ReadStream;c&&(d.prototype=Object.create(c.prototype),d.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.autoClose&&e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n),e.read())}))});var a=e.WriteStream;a&&(D.prototype=Object.create(a.prototype),D.prototype.open=function(){var e=this;E(e.path,e.flags,e.mode,(function(t,n){t?(e.destroy(),e.emit("error",t)):(e.fd=n,e.emit("open",n))}))}),Object.defineProperty(e,"ReadStream",{get:function(){return d},set:function(e){d=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return D},set:function(e){D=e},enumerable:!0,configurable:!0});var l=d;Object.defineProperty(e,"FileReadStream",{get:function(){return l},set:function(e){l=e},enumerable:!0,configurable:!0});var f=D;function d(e,t){return this instanceof d?(c.apply(this,arguments),this):d.apply(Object.create(d.prototype),arguments)}function D(e,t){return this instanceof D?(a.apply(this,arguments),this):D.apply(Object.create(D.prototype),arguments)}Object.defineProperty(e,"FileWriteStream",{get:function(){return f},set:function(e){f=e},enumerable:!0,configurable:!0});var p=e.open;function E(e,t,n,r){return"function"==typeof n&&(r=n,n=null),function e(t,n,r,u,o){return p(t,n,r,(function(i,s){!i||"EMFILE"!==i.code&&"ENFILE"!==i.code?"function"==typeof u&&u.apply(this,arguments):be([e,[t,n,r,u],i,o||Date.now(),Date.now()])}))}(e,t,n,r)}return e.open=E,e}function be(e){Ae("ENQUEUE",e[0].name,e[1]),me[pe].push(e),Be()}function _e(){for(var e=Date.now(),t=0;t2&&(me[pe][t][3]=e,me[pe][t][4]=e);Be()}function Be(){if(clearTimeout(Se),Se=void 0,0!==me[pe].length){var e=me[pe].shift(),t=e[0],n=e[1],r=e[2],u=e[3],o=e[4];if(void 0===u)Ae("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-u>=6e4){Ae("TIMEOUT",t.name,n);var i=n.pop();"function"==typeof i&&i.call(null,r)}else{var s=Date.now()-o,c=Math.max(o-u,1);s>=Math.min(1.2*c,100)?(Ae("RETRY",t.name,n),t.apply(null,n.concat([u]))):me[pe].push(e)}void 0===Se&&(Se=setTimeout(Be,0))}}process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!me.__patched&&(we=Oe(me),me.__patched=!0),function(e){const t=re.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.assign(e,n),r.forEach((r=>{e[r]=t(n[r])})),e.realpath.native=t(n.realpath.native),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.writev&&(e.writev=function(e,t,...r){return"function"==typeof r[r.length-1]?n.writev(e,t,...r):new Promise(((u,o)=>{n.writev(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffers:n})}))}))})}(ne);var Pe={},ke={};const xe=p.default;ke.checkPath=function(e){if("win32"===process.platform){if(/[<>:"|?*]/.test(e.replace(xe.parse(e).root,""))){const t=new Error(`Path contains invalid characters: ${e}`);throw t.code="EINVAL",t}}};const Ne=ne,{checkPath:Ie}=ke,Te=e=>"number"==typeof e?e:{mode:511,...e}.mode;Pe.makeDir=async(e,t)=>(Ie(e),Ne.mkdir(e,{mode:Te(t),recursive:!0})),Pe.makeDirSync=(e,t)=>(Ie(e),Ne.mkdirSync(e,{mode:Te(t),recursive:!0}));const Re=re.fromPromise,{makeDir:Me,makeDirSync:Le}=Pe,je=Re(Me);var $e={mkdirs:je,mkdirsSync:Le,mkdirp:je,mkdirpSync:Le,ensureDir:je,ensureDirSync:Le};const He=re.fromPromise,Je=ne;var Ge={pathExists:He((function(e){return Je.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:Je.existsSync};const Ve=we;var Ue=function(e,t,n,r){Ve.open(e,"r+",((e,u)=>{if(e)return r(e);Ve.futimes(u,t,n,(e=>{Ve.close(u,(t=>{r&&r(e||t)}))}))}))},We=function(e,t,n){const r=Ve.openSync(e,"r+");return Ve.futimesSync(r,t,n),Ve.closeSync(r)};const ze=ne,Ke=p.default,qe=F.default;function Ye(e,t,n){const r=n.dereference?e=>ze.stat(e,{bigint:!0}):e=>ze.lstat(e,{bigint:!0});return Promise.all([r(e),r(t).catch((e=>{if("ENOENT"===e.code)return null;throw e}))]).then((([e,t])=>({srcStat:e,destStat:t})))}function Xe(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function Ze(e,t){const n=Ke.resolve(e).split(Ke.sep).filter((e=>e)),r=Ke.resolve(t).split(Ke.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function Qe(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var et={checkPaths:function(e,t,n,r,u){qe.callbackify(Ye)(e,t,r,((r,o)=>{if(r)return u(r);const{srcStat:i,destStat:s}=o;if(s){if(Xe(i,s)){const r=Ke.basename(e),o=Ke.basename(t);return"move"===n&&r!==o&&r.toLowerCase()===o.toLowerCase()?u(null,{srcStat:i,destStat:s,isChangingCase:!0}):u(new Error("Source and destination must not be the same."))}if(i.isDirectory()&&!s.isDirectory())return u(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!i.isDirectory()&&s.isDirectory())return u(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return i.isDirectory()&&Ze(e,t)?u(new Error(Qe(e,t,n))):u(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n,r){const{srcStat:u,destStat:o}=function(e,t,n){let r;const u=n.dereference?e=>ze.statSync(e,{bigint:!0}):e=>ze.lstatSync(e,{bigint:!0}),o=u(e);try{r=u(t)}catch(e){if("ENOENT"===e.code)return{srcStat:o,destStat:null};throw e}return{srcStat:o,destStat:r}}(e,t,r);if(o){if(Xe(u,o)){const r=Ke.basename(e),i=Ke.basename(t);if("move"===n&&r!==i&&r.toLowerCase()===i.toLowerCase())return{srcStat:u,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(u.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!u.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(u.isDirectory()&&Ze(e,t))throw new Error(Qe(e,t,n));return{srcStat:u,destStat:o}},checkParentPaths:function e(t,n,r,u,o){const i=Ke.resolve(Ke.dirname(t)),s=Ke.resolve(Ke.dirname(r));if(s===i||s===Ke.parse(s).root)return o();ze.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):Xe(n,c)?o(new Error(Qe(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=Ke.resolve(Ke.dirname(t)),i=Ke.resolve(Ke.dirname(r));if(i===o||i===Ke.parse(i).root)return;let s;try{s=ze.statSync(i,{bigint:!0})}catch(e){if("ENOENT"===e.code)return;throw e}if(Xe(n,s))throw new Error(Qe(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ze,areIdentical:Xe};const tt=we,nt=p.default,rt=$e.mkdirs,ut=Ge.pathExists,ot=Ue,it=et;function st(e,t,n,r,u){const o=nt.dirname(n);ut(o,((i,s)=>i?u(i):s?at(e,t,n,r,u):void rt(o,(o=>o?u(o):at(e,t,n,r,u)))))}function ct(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function at(e,t,n,r,u){(r.dereference?tt.stat:tt.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){return t?Dt(n,r,u,o):function(e,t,n,r,u){tt.mkdir(n,(o=>{if(o)return u(o);Dt(t,n,r,(t=>t?u(t):dt(n,e,u)))}))}(e.mode,n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();tt.unlink(n,(o=>o?u(o):lt(e,t,n,r,u)))}(e,n,r,u,o):lt(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){tt.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=nt.resolve(process.cwd(),o)),e?void tt.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?tt.symlink(o,n,u):u(t):(r.dereference&&(i=nt.resolve(process.cwd(),i)),it.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&it.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){tt.unlink(t,(r=>r?n(r):tt.symlink(e,t,n)))}(o,n,u)))):tt.symlink(o,n,u))))}(e,t,n,r,u):i.isSocket()?u(new Error(`Cannot copy a socket file: ${t}`)):i.isFIFO()?u(new Error(`Cannot copy a FIFO pipe: ${t}`)):u(new Error(`Unknown file: ${t}`))))}function lt(e,t,n,r,u){tt.copyFile(t,n,(o=>o?u(o):r.preserveTimestamps?function(e,t,n,r){if(function(e){return 0==(128&e)}(e))return function(e,t,n){return dt(e,128|t,n)}(n,e,(u=>u?r(u):ft(e,t,n,r)));return ft(e,t,n,r)}(e.mode,t,n,u):dt(n,e.mode,u)))}function ft(e,t,n,r){!function(e,t,n){tt.stat(e,((e,r)=>e?n(e):ot(t,r.atime,r.mtime,n)))}(t,n,(t=>t?r(t):dt(n,e,r)))}function dt(e,t,n){return tt.chmod(e,t,n)}function Dt(e,t,n,r){tt.readdir(e,((u,o)=>u?r(u):pt(o,e,t,n,r)))}function pt(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=nt.join(n,t),s=nt.join(r,t);it.checkPaths(i,s,"copy",u,((t,c)=>{if(t)return o(t);const{destStat:a}=c;!function(e,t,n,r,u){r.filter?ct(at,e,t,n,r,u):at(e,t,n,r,u)}(a,i,s,u,(t=>t?o(t):pt(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Et=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),it.checkPaths(e,t,"copy",n,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;it.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?ct(st,s,e,t,n,r):st(s,e,t,n,r)))}))};const mt=we,ht=p.default,yt=$e.mkdirsSync,Ct=We,Ft=et;function gt(e,t,n,r){const u=(r.dereference?mt.statSync:mt.lstatSync)(t);if(u.isDirectory())return function(e,t,n,r,u){return t?St(n,r,u):function(e,t,n,r){return mt.mkdirSync(n),St(t,n,r),vt(n,e)}(e.mode,n,r,u)}(u,e,t,n,r);if(u.isFile()||u.isCharacterDevice()||u.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return mt.unlinkSync(n),At(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):At(e,n,r,u)}(u,e,t,n,r);if(u.isSymbolicLink())return function(e,t,n,r){let u=mt.readlinkSync(t);r.dereference&&(u=ht.resolve(process.cwd(),u));if(e){let e;try{e=mt.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return mt.symlinkSync(u,n);throw e}if(r.dereference&&(e=ht.resolve(process.cwd(),e)),Ft.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(mt.statSync(n).isDirectory()&&Ft.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return mt.unlinkSync(t),mt.symlinkSync(e,t)}(u,n)}return mt.symlinkSync(u,n)}(e,t,n,r);if(u.isSocket())throw new Error(`Cannot copy a socket file: ${t}`);if(u.isFIFO())throw new Error(`Cannot copy a FIFO pipe: ${t}`);throw new Error(`Unknown file: ${t}`)}function At(e,t,n,r){return mt.copyFileSync(t,n),r.preserveTimestamps&&function(e,t,n){(function(e){return 0==(128&e)})(e)&&function(e,t){vt(e,128|t)}(n,e);(function(e,t){const n=mt.statSync(e);Ct(t,n.atime,n.mtime)})(t,n)}(e.mode,t,n),vt(n,e.mode)}function vt(e,t){return mt.chmodSync(e,t)}function St(e,t,n){mt.readdirSync(e).forEach((r=>function(e,t,n,r){const u=ht.join(t,e),o=ht.join(n,e),{destStat:i}=Ft.checkPathsSync(u,o,"copy",r);return function(e,t,n,r){if(!r.filter||r.filter(t,n))return gt(e,t,n,r)}(i,u,o,r)}(r,e,t,n)))}var wt=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=Ft.checkPathsSync(e,t,"copy",n);return Ft.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ht.dirname(n);mt.existsSync(u)||yt(u);return gt(e,t,n,r)}(u,e,t,n)};var Ot={copy:(0,re.fromCallback)(Et),copySync:wt};const bt=we,_t=p.default,Bt=g.default,Pt="win32"===process.platform;function kt(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||bt[t],e[t+="Sync"]=e[t]||bt[t]})),e.maxBusyTries=e.maxBusyTries||3}function xt(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt.strictEqual(typeof n,"function","rimraf: callback function required"),Bt(t,"rimraf: invalid options argument provided"),Bt.strictEqual(typeof t,"object","rimraf: options should be object"),kt(t),Nt(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rNt(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Nt(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&Pt?It(e,t,r,n):u&&u.isDirectory()?Rt(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return Pt?It(e,t,r,n):Rt(e,t,r,n);if("EISDIR"===r.code)return Rt(e,t,r,n)}return n(r)}))))}function It(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Rt(e,t,n,r):t.unlink(e,r)}))}))}function Tt(e,t,n){let r;Bt(e),Bt(t);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?Lt(e,t,n):t.unlinkSync(e)}function Rt(e,t,n,r){Bt(e),Bt(t),Bt("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Bt(e),Bt(t),Bt("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{xt(_t.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Mt(e,t){let n;kt(t=t||{}),Bt(e,"rimraf: missing path"),Bt.strictEqual(typeof e,"string","rimraf: path should be a string"),Bt(t,"rimraf: missing options"),Bt.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&Pt&&Tt(e,t,n)}try{n&&n.isDirectory()?Lt(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return Pt?Tt(e,t,n):Lt(e,t,n);if("EISDIR"!==n.code)throw n;Lt(e,t,n)}}function Lt(e,t,n){Bt(e),Bt(t);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Bt(e),Bt(t),t.readdirSync(e).forEach((n=>Mt(_t.join(e,n),t))),!Pt){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch{}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var jt=xt;xt.sync=Mt;const $t=we,Ht=re.fromCallback,Jt=jt;var Gt={remove:Ht((function(e,t){if($t.rm)return $t.rm(e,{recursive:!0,force:!0},t);Jt(e,t)})),removeSync:function(e){if($t.rmSync)return $t.rmSync(e,{recursive:!0,force:!0});Jt.sync(e)}};const Vt=re.fromPromise,Ut=ne,Wt=p.default,zt=$e,Kt=Gt,qt=Vt((async function(e){let t;try{t=await Ut.readdir(e)}catch{return zt.mkdirs(e)}return Promise.all(t.map((t=>Kt.remove(Wt.join(e,t)))))}));function Yt(e){let t;try{t=Ut.readdirSync(e)}catch{return zt.mkdirsSync(e)}t.forEach((t=>{t=Wt.join(e,t),Kt.removeSync(t)}))}var Xt={emptyDirSync:Yt,emptydirSync:Yt,emptyDir:qt,emptydir:qt};const Zt=re.fromCallback,Qt=p.default,en=we,tn=$e;var nn={createFile:Zt((function(e,t){function n(){en.writeFile(e,"",(e=>{if(e)return t(e);t()}))}en.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Qt.dirname(e);en.stat(o,((e,r)=>{if(e)return"ENOENT"===e.code?tn.mkdirs(o,(e=>{if(e)return t(e);n()})):t(e);r.isDirectory()?n():en.readdir(o,(e=>{if(e)return t(e)}))}))}))})),createFileSync:function(e){let t;try{t=en.statSync(e)}catch{}if(t&&t.isFile())return;const n=Qt.dirname(e);try{en.statSync(n).isDirectory()||en.readdirSync(n)}catch(e){if(!e||"ENOENT"!==e.code)throw e;tn.mkdirsSync(n)}en.writeFileSync(e,"")}};const rn=re.fromCallback,un=p.default,on=we,sn=$e,cn=Ge.pathExists,{areIdentical:an}=et;var ln={createLink:rn((function(e,t,n){function r(e,t){on.link(e,t,(e=>{if(e)return n(e);n(null)}))}on.lstat(t,((u,o)=>{on.lstat(e,((u,i)=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);if(o&&an(i,o))return n(null);const s=un.dirname(t);cn(s,((u,o)=>u?n(u):o?r(e,t):void sn.mkdirs(s,(u=>{if(u)return n(u);r(e,t)}))))}))}))})),createLinkSync:function(e,t){let n;try{n=on.lstatSync(t)}catch{}try{const t=on.lstatSync(e);if(n&&an(t,n))return}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const r=un.dirname(t);return on.existsSync(r)||sn.mkdirsSync(r),on.linkSync(e,t)}};const fn=p.default,dn=we,Dn=Ge.pathExists;var pn={symlinkPaths:function(e,t,n){if(fn.isAbsolute(e))return dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=fn.dirname(t),u=fn.join(r,e);return Dn(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):dn.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:fn.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(fn.isAbsolute(e)){if(n=dn.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=fn.dirname(t),u=fn.join(r,e);if(n=dn.existsSync(u),n)return{toCwd:u,toDst:e};if(n=dn.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:fn.relative(r,e)}}}};const En=we;var mn={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);En.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=En.lstatSync(e)}catch{return"file"}return n&&n.isDirectory()?"dir":"file"}};const hn=re.fromCallback,yn=p.default,Cn=ne,Fn=$e.mkdirs,gn=$e.mkdirsSync,An=pn.symlinkPaths,vn=pn.symlinkPathsSync,Sn=mn.symlinkType,wn=mn.symlinkTypeSync,On=Ge.pathExists,{areIdentical:bn}=et;function _n(e,t,n,r){An(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,Sn(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=yn.dirname(t);On(o,((n,i)=>n?r(n):i?Cn.symlink(e,t,u,r):void Fn(o,(n=>{if(n)return r(n);Cn.symlink(e,t,u,r)}))))}))}))}var Bn={createSymlink:hn((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Cn.lstat(t,((u,o)=>{!u&&o.isSymbolicLink()?Promise.all([Cn.stat(e),Cn.stat(t)]).then((([u,o])=>{if(bn(u,o))return r(null);_n(e,t,n,r)})):_n(e,t,n,r)}))})),createSymlinkSync:function(e,t,n){let r;try{r=Cn.lstatSync(t)}catch{}if(r&&r.isSymbolicLink()){const n=Cn.statSync(e),r=Cn.statSync(t);if(bn(n,r))return}const u=vn(e,t);e=u.toDst,n=wn(u.toCwd,n);const o=yn.dirname(t);return Cn.existsSync(o)||gn(o),Cn.symlinkSync(e,t,n)}};const{createFile:Pn,createFileSync:kn}=nn,{createLink:xn,createLinkSync:Nn}=ln,{createSymlink:In,createSymlinkSync:Tn}=Bn;var Rn={createFile:Pn,createFileSync:kn,ensureFile:Pn,ensureFileSync:kn,createLink:xn,createLinkSync:Nn,ensureLink:xn,ensureLinkSync:Nn,createSymlink:In,createSymlinkSync:Tn,ensureSymlink:In,ensureSymlinkSync:Tn};var Mn={stringify:function(e,{EOL:t="\n",finalEOL:n=!0,replacer:r=null,spaces:u}={}){const o=n?t:"";return JSON.stringify(e,r,u).replace(/\n/g,t)+o},stripBom:function(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}};let Ln;try{Ln=we}catch(e){Ln=D.default}const jn=re,{stringify:$n,stripBom:Hn}=Mn;const Jn=jn.fromPromise((async function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;let u,o=await jn.fromCallback(n.readFile)(e,t);o=Hn(o);try{u=JSON.parse(o,t?t.reviver:null)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}return u}));const Gn=jn.fromPromise((async function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);await jn.fromCallback(r.writeFile)(e,u,n)}));const Vn={readFile:Jn,readFileSync:function(e,t={}){"string"==typeof t&&(t={encoding:t});const n=t.fs||Ln,r=!("throws"in t)||t.throws;try{let r=n.readFileSync(e,t);return r=Hn(r),JSON.parse(r,t.reviver)}catch(t){if(r)throw t.message=`${e}: ${t.message}`,t;return null}},writeFile:Gn,writeFileSync:function(e,t,n={}){const r=n.fs||Ln,u=$n(t,n);return r.writeFileSync(e,u,n)}};var Un={readJson:Vn.readFile,readJsonSync:Vn.readFileSync,writeJson:Vn.writeFile,writeJsonSync:Vn.writeFileSync};const Wn=re.fromCallback,zn=we,Kn=p.default,qn=$e,Yn=Ge.pathExists;var Xn={outputFile:Wn((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Kn.dirname(e);Yn(u,((o,i)=>o?r(o):i?zn.writeFile(e,t,n,r):void qn.mkdirs(u,(u=>{if(u)return r(u);zn.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Kn.dirname(e);if(zn.existsSync(n))return zn.writeFileSync(e,...t);qn.mkdirsSync(n),zn.writeFileSync(e,...t)}};const{stringify:Zn}=Mn,{outputFile:Qn}=Xn;var er=async function(e,t,n={}){const r=Zn(t,n);await Qn(e,r,n)};const{stringify:tr}=Mn,{outputFileSync:nr}=Xn;var rr=function(e,t,n){const r=tr(t,n);nr(e,r,n)};const ur=re.fromPromise,or=Un;or.outputJson=ur(er),or.outputJsonSync=rr,or.outputJSON=or.outputJson,or.outputJSONSync=or.outputJsonSync,or.writeJSON=or.writeJson,or.writeJSONSync=or.writeJsonSync,or.readJSON=or.readJson,or.readJSONSync=or.readJsonSync;var ir=or;const sr=we,cr=p.default,ar=Ot.copy,lr=Gt.remove,fr=$e.mkdirp,dr=Ge.pathExists,Dr=et;function pr(e,t,n,r,u){return r?Er(e,t,n,u):n?lr(t,(r=>r?u(r):Er(e,t,n,u))):void dr(t,((r,o)=>r?u(r):o?u(new Error("dest already exists.")):Er(e,t,n,u)))}function Er(e,t,n,r){sr.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};ar(e,t,u,(t=>t?r(t):lr(e,r)))}(e,t,n,r):r()))}var mr=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;Dr.checkPaths(e,t,"move",n,((n,o)=>{if(n)return r(n);const{srcStat:i,isChangingCase:s=!1}=o;Dr.checkParentPaths(e,i,t,"move",(n=>n?r(n):function(e){const t=cr.dirname(e);return cr.parse(t).root===t}(t)?pr(e,t,u,s,r):void fr(cr.dirname(t),(n=>n?r(n):pr(e,t,u,s,r)))))}))};const hr=we,yr=p.default,Cr=Ot.copySync,Fr=Gt.removeSync,gr=$e.mkdirpSync,Ar=et;function vr(e,t,n){try{hr.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Cr(e,t,r),Fr(e)}(e,t,n)}}var Sr=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u,isChangingCase:o=!1}=Ar.checkPathsSync(e,t,"move",n);return Ar.checkParentPathsSync(e,u,t,"move"),function(e){const t=yr.dirname(e);return yr.parse(t).root===t}(t)||gr(yr.dirname(t)),function(e,t,n,r){if(r)return vr(e,t,n);if(n)return Fr(t),vr(e,t,n);if(hr.existsSync(t))throw new Error("dest already exists.");return vr(e,t,n)}(e,t,r,o)};var wr,Or,br,_r,Br,Pr={move:(0,re.fromCallback)(mr),moveSync:Sr},kr={...ne,...Ot,...Xt,...Rn,...ir,...$e,...Pr,...Xn,...Ge,...Gt},xr={},Nr={exports:{}},Ir={exports:{}};function Tr(){if(Or)return wr;Or=1;var e=1e3,t=60*e,n=60*t,r=24*n,u=7*r,o=365.25*r;function i(e,t,n,r){var u=t>=1.5*n;return Math.round(e/n)+" "+r+(u?"s":"")}return wr=function(s,c){c=c||{};var a=typeof s;if("string"===a&&s.length>0)return function(i){if((i=String(i)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*u;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===a&&isFinite(s))return c.long?function(u){var o=Math.abs(u);if(o>=r)return i(u,o,r,"day");if(o>=n)return i(u,o,n,"hour");if(o>=t)return i(u,o,t,"minute");if(o>=e)return i(u,o,e,"second");return u+" ms"}(s):function(u){var o=Math.abs(u);if(o>=r)return Math.round(u/r)+"d";if(o>=n)return Math.round(u/n)+"h";if(o>=t)return Math.round(u/t)+"m";if(o>=e)return Math.round(u/e)+"s";return u+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function Rr(){if(_r)return br;return _r=1,br=function(e){function t(e){let r,u,o,i=null;function s(...e){if(!s.enabled)return;const n=s,u=Number(new Date),o=u-(r||u);n.diff=o,n.prev=r,n.curr=u,r=u,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,u)=>{if("%%"===r)return"%";i++;const o=t.formatters[u];if("function"==typeof o){const t=e[i];r=o.call(n,t),e.splice(i,1),i--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(u!==t.namespaces&&(u=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),u=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{const n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),u=t.indexOf("--");return-1!==r&&(-1===u||r{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=function(){if($r)return jr;$r=1;const e=E.default,t=A.default,n=Vr(),{env:r}=process;let u;function o(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function i(t,o){if(0===u)return 0;if(n("color=16m")||n("color=full")||n("color=truecolor"))return 3;if(n("color=256"))return 2;if(t&&!o&&void 0===u)return 0;const i=u||0;if("dumb"===r.TERM)return i;if("win32"===process.platform){const t=e.release().split(".");return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in r)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in r))||"codeship"===r.CI_NAME?1:i;if("TEAMCITY_VERSION"in r)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if("truecolor"===r.COLORTERM)return 3;if("TERM_PROGRAM"in r){const e=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:i}return n("no-color")||n("no-colors")||n("color=false")||n("color=never")?u=0:(n("color")||n("colors")||n("color=true")||n("color=always"))&&(u=1),"FORCE_COLOR"in r&&(u="true"===r.FORCE_COLOR?1:"false"===r.FORCE_COLOR?0:0===r.FORCE_COLOR.length?1:Math.min(parseInt(r.FORCE_COLOR,10),3)),jr={supportsColor:function(e){return o(i(e,e&&e.isTTY))},stdout:o(i(!0,t.isatty(1))),stderr:o(i(!0,t.isatty(2)))}}();e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=Rr()(t);const{formatters:u}=e.exports;u.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},u.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}(Gr,Gr.exports)),Gr.exports}Jr=Nr,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?Jr.exports=(Br||(Br=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,u=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(u=r))})),t.splice(u,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Rr()(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ir,Ir.exports)),Ir.exports):Jr.exports=Ur();var Wr=function(e){return(e=e||{}).circles?function(e){var t=[],n=[];return e.proto?function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o}:function e(u){if("object"!=typeof u||null===u)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return r(u,e);if(u instanceof Map)return new Map(r(Array.from(u),e));if(u instanceof Set)return new Set(r(Array.from(u),e));var o={};for(var i in t.push(u),n.push(o),u)if(!1!==Object.hasOwnProperty.call(u,i)){var s=u[i];if("object"!=typeof s||null===s)o[i]=s;else if(s instanceof Date)o[i]=new Date(s);else if(s instanceof Map)o[i]=new Map(r(Array.from(s),e));else if(s instanceof Set)o[i]=new Set(r(Array.from(s),e));else if(ArrayBuffer.isView(s))o[i]=zr(s);else{var c=t.indexOf(s);o[i]=-1!==c?n[c]:e(s)}}return t.pop(),n.pop(),o};function r(e,r){for(var u=Object.keys(e),o=new Array(u.length),i=0;i!e,Qr=e=>e&&"object"==typeof e&&!Array.isArray(e),eu=(e,t,n)=>{(Array.isArray(t)?t:[t]).forEach((t=>{if(t)throw new Error(`Problem with log4js configuration: (${Kr.inspect(e,{depth:5})}) - ${n}`)}))};var tu={configure:e=>{qr("New configuration to be validated: ",e),eu(e,Zr(Qr(e)),"must be an object."),qr(`Calling pre-processing listeners (${Yr.length})`),Yr.forEach((t=>t(e))),qr("Configuration pre-processing finished."),qr(`Calling configuration listeners (${Xr.length})`),Xr.forEach((t=>t(e))),qr("Configuration finished.")},addListener:e=>{Xr.push(e),qr(`Added listener, now ${Xr.length} listeners`)},addPreProcessingListener:e=>{Yr.push(e),qr(`Added pre-processing listener, now ${Yr.length} listeners`)},throwExceptionIf:eu,anObject:Qr,anInteger:e=>e&&"number"==typeof e&&Number.isInteger(e),validIdentifier:e=>/^[A-Za-z][A-Za-z0-9_]*$/g.test(e),not:Zr},nu={exports:{}};!function(e){function t(e,t){for(var n=e.toString();n.length-1?s:c,l=n(u.getHours()),f=n(u.getMinutes()),d=n(u.getSeconds()),D=t(u.getMilliseconds(),3),p=function(e){var t=Math.abs(e),n=String(Math.floor(t/60)),r=String(t%60);return n=("0"+n).slice(-2),r=("0"+r).slice(-2),0===e?"Z":(e<0?"+":"-")+n+":"+r}(u.getTimezoneOffset());return r.replace(/dd/g,o).replace(/MM/g,i).replace(/y{1,4}/g,a).replace(/hh/g,l).replace(/mm/g,f).replace(/ss/g,d).replace(/SSS/g,D).replace(/O/g,p)}function u(e,t,n,r){e["set"+(r?"":"UTC")+t](n)}e.exports=r,e.exports.asString=r,e.exports.parse=function(t,n,r){if(!t)throw new Error("pattern must be supplied");return function(t,n,r){var o=t.indexOf("O")<0,i=!1,s=[{pattern:/y{1,4}/,regexp:"\\d{1,4}",fn:function(e,t){u(e,"FullYear",t,o)}},{pattern:/MM/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Month",t-1,o),e.getMonth()!==t-1&&(i=!0)}},{pattern:/dd/,regexp:"\\d{1,2}",fn:function(e,t){i&&u(e,"Month",e.getMonth()-1,o),u(e,"Date",t,o)}},{pattern:/hh/,regexp:"\\d{1,2}",fn:function(e,t){u(e,"Hours",t,o)}},{pattern:/mm/,regexp:"\\d\\d",fn:function(e,t){u(e,"Minutes",t,o)}},{pattern:/ss/,regexp:"\\d\\d",fn:function(e,t){u(e,"Seconds",t,o)}},{pattern:/SSS/,regexp:"\\d\\d\\d",fn:function(e,t){u(e,"Milliseconds",t,o)}},{pattern:/O/,regexp:"[+-]\\d{1,2}:?\\d{2}?|Z",fn:function(e,t){t="Z"===t?0:t.replace(":","");var n=Math.abs(t),r=(t>0?-1:1)*(n%100+60*Math.floor(n/100));e.setUTCMinutes(e.getUTCMinutes()+r)}}],c=s.reduce((function(e,t){return t.pattern.test(e.regexp)?(t.index=e.regexp.match(t.pattern).index,e.regexp=e.regexp.replace(t.pattern,"("+t.regexp+")")):t.index=-1,e}),{regexp:t,index:[]}),a=s.filter((function(e){return e.index>-1}));a.sort((function(e,t){return e.index-t.index}));var l=new RegExp(c.regexp).exec(n);if(l){var f=r||e.exports.now();return a.forEach((function(e,t){e.fn(f,l[t+1])})),f}throw new Error("String '"+n+"' could not be parsed as '"+t+"'")}(t,n,r)},e.exports.now=function(){return new Date},e.exports.ISO8601_FORMAT="yyyy-MM-ddThh:mm:ss.SSS",e.exports.ISO8601_WITH_TZ_OFFSET_FORMAT="yyyy-MM-ddThh:mm:ss.SSSO",e.exports.DATETIME_FORMAT="dd MM yyyy hh:mm:ss.SSS",e.exports.ABSOLUTETIME_FORMAT="hh:mm:ss.SSS"}(nu);const ru=nu.exports,uu=E.default,ou=F.default,iu=p.default,su={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[90,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[91,39],yellow:[33,39]};function cu(e){return e?`[${su[e][0]}m`:""}function au(e){return e?`[${su[e][1]}m`:""}function lu(e,t){return n=ou.format("[%s] [%s] %s - ",ru.asString(e.startTime),e.level.toString(),e.categoryName),cu(r=t)+n+au(r);var n,r}function fu(e){return lu(e)+ou.format(...e.data)}function du(e){return lu(e,e.level.colour)+ou.format(...e.data)}function Du(e){return ou.format(...e.data)}function pu(e){return e.data[0]}function Eu(e,t){const n=/%(-?[0-9]+)?(\.?-?[0-9]+)?([[\]cdhmnprzxXyflos%])(\{([^}]+)\})?|([^%]+)/;function r(e){return e&&e.pid?e.pid.toString():process.pid.toString()}e=e||"%r %p %c - %m%n";const u={c:function(e,t){let n=e.categoryName;if(t){const e=parseInt(t,10),r=n.split(".");ee&&(n=r.slice(-e).join(iu.sep))}return n},l:function(e){return e.lineNumber?`${e.lineNumber}`:""},o:function(e){return e.columnNumber?`${e.columnNumber}`:""},s:function(e){return e.callStack||""}};function o(e,t,n){return u[e](t,n)}function i(e,t,n){let r=e;return r=function(e,t){let n;return e?(n=parseInt(e.substr(1),10),n>0?t.slice(0,n):t.slice(n)):t}(t,r),r=function(e,t){let n;if(e)if("-"===e.charAt(0))for(n=parseInt(e.substr(1),10);t.lengthDu,basic:()=>fu,colored:()=>du,coloured:()=>du,pattern:e=>Eu(e&&e.pattern,e&&e.tokens),dummy:()=>pu};var hu={basicLayout:fu,messagePassThroughLayout:Du,patternLayout:Eu,colouredLayout:du,coloredLayout:du,dummyLayout:pu,addLayout(e,t){mu[e]=t},layout:(e,t)=>mu[e]&&mu[e](t)};const yu=tu,Cu=["white","grey","black","blue","cyan","green","magenta","red","yellow"];class Fu{constructor(e,t,n){this.level=e,this.levelStr=t,this.colour=n}toString(){return this.levelStr}static getLevel(e,t){return e?e instanceof Fu?e:(e instanceof Object&&e.levelStr&&(e=e.levelStr),Fu[e.toString().toUpperCase()]||t):t}static addLevels(e){if(e){Object.keys(e).forEach((t=>{const n=t.toUpperCase();Fu[n]=new Fu(e[t].value,n,e[t].colour);const r=Fu.levels.findIndex((e=>e.levelStr===n));r>-1?Fu.levels[r]=Fu[n]:Fu.levels.push(Fu[n])})),Fu.levels.sort(((e,t)=>e.level-t.level))}}isLessThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level<=e.level}isGreaterThanOrEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level>=e.level}isEqualTo(e){return"string"==typeof e&&(e=Fu.getLevel(e)),this.level===e.level}}Fu.levels=[],Fu.addLevels({ALL:{value:Number.MIN_VALUE,colour:"grey"},TRACE:{value:5e3,colour:"blue"},DEBUG:{value:1e4,colour:"cyan"},INFO:{value:2e4,colour:"green"},WARN:{value:3e4,colour:"yellow"},ERROR:{value:4e4,colour:"red"},FATAL:{value:5e4,colour:"magenta"},MARK:{value:9007199254740992,colour:"grey"},OFF:{value:Number.MAX_VALUE,colour:"grey"}}),yu.addListener((e=>{const t=e.levels;if(t){yu.throwExceptionIf(e,yu.not(yu.anObject(t)),"levels must be an object");Object.keys(t).forEach((n=>{yu.throwExceptionIf(e,yu.not(yu.validIdentifier(n)),`level name "${n}" is not a valid identifier (must start with a letter, only contain A-Z,a-z,0-9,_)`),yu.throwExceptionIf(e,yu.not(yu.anObject(t[n])),`level "${n}" must be an object`),yu.throwExceptionIf(e,yu.not(t[n].value),`level "${n}" must have a 'value' property`),yu.throwExceptionIf(e,yu.not(yu.anInteger(t[n].value)),`level "${n}".value must have an integer value`),yu.throwExceptionIf(e,yu.not(t[n].colour),`level "${n}" must have a 'colour' property`),yu.throwExceptionIf(e,yu.not(Cu.indexOf(t[n].colour)>-1),`level "${n}".colour must be one of ${Cu.join(", ")}`)}))}})),yu.addListener((e=>{Fu.addLevels(e.levels)}));var gu=Fu,Au={exports:{}},vu={};/*! (c) 2020 Andrea Giammarchi */ +const{parse:Su,stringify:wu}=JSON,{keys:Ou}=Object,bu=String,_u="string",Bu={},Pu="object",ku=(e,t)=>t,xu=e=>e instanceof bu?bu(e):e,Nu=(e,t)=>typeof t===_u?new bu(t):t,Iu=(e,t,n,r)=>{const u=[];for(let o=Ou(n),{length:i}=o,s=0;s{const r=bu(t.push(n)-1);return e.set(n,r),r},Ru=(e,t)=>{const n=Su(e,Nu).map(xu),r=n[0],u=t||ku,o=typeof r===Pu&&r?Iu(n,new Set,r,u):r;return u.call({"":o},"",o)};vu.parse=Ru;const Mu=(e,t,n)=>{const r=t&&typeof t===Pu?(e,n)=>""===e||-1Su(Mu(e));vu.fromJSON=e=>Ru(wu(e));const Lu=vu,ju=gu;class $u{constructor(e,t,n,r,u){this.startTime=new Date,this.categoryName=e,this.data=n,this.level=t,this.context=Object.assign({},r),this.pid=process.pid,u&&(this.functionName=u.functionName,this.fileName=u.fileName,this.lineNumber=u.lineNumber,this.columnNumber=u.columnNumber,this.callStack=u.callStack)}serialise(){const e=this.data.map((e=>(e&&e.message&&e.stack&&(e=Object.assign({message:e.message,stack:e.stack},e)),e)));return this.data=e,Lu.stringify(this)}static deserialise(e){let t;try{const n=Lu.parse(e);n.data=n.data.map((e=>{if(e&&e.message&&e.stack){const t=new Error(e);Object.keys(e).forEach((n=>{t[n]=e[n]})),e=t}return e})),t=new $u(n.categoryName,ju.getLevel(n.level.levelStr),n.data,n.context),t.startTime=new Date(n.startTime),t.pid=n.pid,t.cluster=n.cluster}catch(n){t=new $u("log4js",ju.ERROR,["Unable to parse log:",e,"because: ",n])}return t}}var Hu=$u;const Ju=Nr.exports("log4js:clustering"),Gu=Hu,Vu=tu;let Uu=!1,Wu=null;try{Wu=require("cluster")}catch(e){Ju("cluster module not present"),Uu=!0}const zu=[];let Ku=!1,qu="NODE_APP_INSTANCE";const Yu=()=>Ku&&"0"===process.env[qu],Xu=()=>Uu||Wu.isMaster||Yu(),Zu=e=>{zu.forEach((t=>t(e)))},Qu=(e,t)=>{if(Ju("cluster message received from worker ",e,": ",t),e.topic&&e.data&&(t=e,e=void 0),t&&t.topic&&"log4js:message"===t.topic){Ju("received message: ",t.data);const e=Gu.deserialise(t.data);Zu(e)}};Uu||Vu.addListener((e=>{zu.length=0,({pm2:Ku,disableClustering:Uu,pm2InstanceVar:qu="NODE_APP_INSTANCE"}=e),Ju(`clustering disabled ? ${Uu}`),Ju(`cluster.isMaster ? ${Wu&&Wu.isMaster}`),Ju(`pm2 enabled ? ${Ku}`),Ju(`pm2InstanceVar = ${qu}`),Ju(`process.env[${qu}] = ${process.env[qu]}`),Ku&&process.removeListener("message",Qu),Wu&&Wu.removeListener&&Wu.removeListener("message",Qu),Uu||e.disableClustering?Ju("Not listening for cluster messages, because clustering disabled."):Yu()?(Ju("listening for PM2 broadcast messages"),process.on("message",Qu)):Wu.isMaster?(Ju("listening for cluster messages"),Wu.on("message",Qu)):Ju("not listening for messages, because we are not a master process")}));var eo={onlyOnMaster:(e,t)=>Xu()?e():t,isMaster:Xu,send:e=>{Xu()?Zu(e):(Ku||(e.cluster={workerId:Wu.worker.id,worker:process.pid}),process.send({topic:"log4js:message",data:e.serialise()}))},onMessage:e=>{zu.push(e)}},to={};function no(e){if("number"==typeof e&&Number.isInteger(e))return e;const t={K:1024,M:1048576,G:1073741824},n=Object.keys(t),r=e.substr(e.length-1).toLocaleUpperCase(),u=e.substring(0,e.length-1).trim();if(n.indexOf(r)<0||!Number.isInteger(Number(u)))throw Error(`maxLogSize: "${e}" is invalid`);return u*t[r]}function ro(e){return function(e,t){const n=Object.assign({},t);return Object.keys(e).forEach((r=>{n[r]&&(n[r]=e[r](t[r]))})),n}({maxLogSize:no},e)}const uo={file:ro,fileSync:ro};to.modifyConfig=e=>uo[e.type]?uo[e.type](e):e;var oo={};const io=console.log.bind(console);oo.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{io(e(n,t))}}(n,e.timezoneOffset)};var so={};so.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stdout.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var co={};co.configure=function(e,t){let n=t.colouredLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){return n=>{process.stderr.write(`${e(n,t)}\n`)}}(n,e.timezoneOffset)};var ao={};ao.configure=function(e,t,n,r){const u=n(e.appender);return function(e,t,n,r){const u=r.getLevel(e),o=r.getLevel(t,r.FATAL);return e=>{const t=e.level;t.isGreaterThanOrEqualTo(u)&&t.isLessThanOrEqualTo(o)&&n(e)}}(e.level,e.maxLevel,u,r)};var lo={};const fo=Nr.exports("log4js:categoryFilter");lo.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return"string"==typeof e&&(e=[e]),n=>{fo(`Checking ${n.categoryName} against ${e}`),-1===e.indexOf(n.categoryName)&&(fo("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Do={};const po=Nr.exports("log4js:noLogFilter");Do.configure=function(e,t,n){const r=n(e.appender);return function(e,t){return n=>{po(`Checking data: ${n.data} against filters: ${e}`),"string"==typeof e&&(e=[e]),e=e.filter((e=>null!=e&&""!==e));const r=new RegExp(e.join("|"),"i");(0===e.length||n.data.findIndex((e=>r.test(e)))<0)&&(po("Not excluded, sending to appender"),t(n))}}(e.exclude,r)};var Eo={},mo={exports:{}},ho={},yo={fromCallback:function(e){return Object.defineProperty((function(){if("function"!=typeof arguments[arguments.length-1])return new Promise(((t,n)=>{arguments[arguments.length]=(e,r)=>{if(e)return n(e);t(r)},arguments.length++,e.apply(this,arguments)}));e.apply(this,arguments)}),"name",{value:e.name})},fromPromise:function(e){return Object.defineProperty((function(){const t=arguments[arguments.length-1];if("function"!=typeof t)return e.apply(this,arguments);e.apply(this,arguments).then((e=>t(null,e)),t)}),"name",{value:e.name})}};!function(e){const t=yo.fromCallback,n=we,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","lchmod","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter((e=>"function"==typeof n[e]));Object.keys(n).forEach((t=>{"promises"!==t&&(e[t]=n[t])})),r.forEach((r=>{e[r]=t(n[r])})),e.exists=function(e,t){return"function"==typeof t?n.exists(e,t):new Promise((t=>n.exists(e,t)))},e.read=function(e,t,r,u,o,i){return"function"==typeof i?n.read(e,t,r,u,o,i):new Promise(((i,s)=>{n.read(e,t,r,u,o,((e,t,n)=>{if(e)return s(e);i({bytesRead:t,buffer:n})}))}))},e.write=function(e,t,...r){return"function"==typeof r[r.length-1]?n.write(e,t,...r):new Promise(((u,o)=>{n.write(e,t,...r,((e,t,n)=>{if(e)return o(e);u({bytesWritten:t,buffer:n})}))}))},"function"==typeof n.realpath.native&&(e.realpath.native=t(n.realpath.native))}(ho);const Co=p.default;function Fo(e){return(e=Co.normalize(Co.resolve(e)).split(Co.sep)).length>0?e[0]:null}const go=/[<>:"|?*]/;var Ao=function(e){const t=Fo(e);return e=e.replace(t,""),go.test(e)};const vo=we,So=p.default,wo=Ao,Oo=parseInt("0777",8);var bo=function e(t,n,r,u){if("function"==typeof n?(r=n,n={}):n&&"object"==typeof n||(n={mode:n}),"win32"===process.platform&&wo(t)){const e=new Error(t+" contains invalid WIN32 path characters.");return e.code="EINVAL",r(e)}let o=n.mode;const i=n.fs||vo;void 0===o&&(o=Oo&~process.umask()),u||(u=null),r=r||function(){},t=So.resolve(t),i.mkdir(t,o,(o=>{if(!o)return r(null,u=u||t);if("ENOENT"===o.code){if(So.dirname(t)===t)return r(o);e(So.dirname(t),n,((u,o)=>{u?r(u,o):e(t,n,r,o)}))}else i.stat(t,((e,t)=>{e||!t.isDirectory()?r(o,u):r(null,u)}))}))};const _o=we,Bo=p.default,Po=Ao,ko=parseInt("0777",8);var xo=function e(t,n,r){n&&"object"==typeof n||(n={mode:n});let u=n.mode;const o=n.fs||_o;if("win32"===process.platform&&Po(t)){const e=new Error(t+" contains invalid WIN32 path characters.");throw e.code="EINVAL",e}void 0===u&&(u=ko&~process.umask()),r||(r=null),t=Bo.resolve(t);try{o.mkdirSync(t,u),r=r||t}catch(u){if("ENOENT"===u.code){if(Bo.dirname(t)===t)throw u;r=e(Bo.dirname(t),n,r),e(t,n,r)}else{let e;try{e=o.statSync(t)}catch(e){throw u}if(!e.isDirectory())throw u}}return r};const No=(0,yo.fromCallback)(bo);var Io={mkdirs:No,mkdirsSync:xo,mkdirp:No,mkdirpSync:xo,ensureDir:No,ensureDirSync:xo};const To=we;E.default,p.default;var Ro=function(e,t,n,r){To.open(e,"r+",((e,u)=>{if(e)return r(e);To.futimes(u,t,n,(e=>{To.close(u,(t=>{r&&r(e||t)}))}))}))},Mo=function(e,t,n){const r=To.openSync(e,"r+");return To.futimesSync(r,t,n),To.closeSync(r)};const Lo=we,jo=p.default,$o=10,Ho=5,Jo=0,Go=process.versions.node.split("."),Vo=Number.parseInt(Go[0],10),Uo=Number.parseInt(Go[1],10),Wo=Number.parseInt(Go[2],10);function zo(){if(Vo>$o)return!0;if(Vo===$o){if(Uo>Ho)return!0;if(Uo===Ho&&Wo>=Jo)return!0}return!1}function Ko(e,t){const n=jo.resolve(e).split(jo.sep).filter((e=>e)),r=jo.resolve(t).split(jo.sep).filter((e=>e));return n.reduce(((e,t,n)=>e&&r[n]===t),!0)}function qo(e,t,n){return`Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`}var Yo,Xo,Zo={checkPaths:function(e,t,n,r){!function(e,t,n){zo()?Lo.stat(e,{bigint:!0},((e,r)=>{if(e)return n(e);Lo.stat(t,{bigint:!0},((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))})):Lo.stat(e,((e,r)=>{if(e)return n(e);Lo.stat(t,((e,t)=>e?"ENOENT"===e.code?n(null,{srcStat:r,destStat:null}):n(e):n(null,{srcStat:r,destStat:t})))}))}(e,t,((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;return s&&s.ino&&s.dev&&s.ino===i.ino&&s.dev===i.dev?r(new Error("Source and destination must not be the same.")):i.isDirectory()&&Ko(e,t)?r(new Error(qo(e,t,n))):r(null,{srcStat:i,destStat:s})}))},checkPathsSync:function(e,t,n){const{srcStat:r,destStat:u}=function(e,t){let n,r;n=zo()?Lo.statSync(e,{bigint:!0}):Lo.statSync(e);try{r=zo()?Lo.statSync(t,{bigint:!0}):Lo.statSync(t)}catch(e){if("ENOENT"===e.code)return{srcStat:n,destStat:null};throw e}return{srcStat:n,destStat:r}}(e,t);if(u&&u.ino&&u.dev&&u.ino===r.ino&&u.dev===r.dev)throw new Error("Source and destination must not be the same.");if(r.isDirectory()&&Ko(e,t))throw new Error(qo(e,t,n));return{srcStat:r,destStat:u}},checkParentPaths:function e(t,n,r,u,o){const i=jo.resolve(jo.dirname(t)),s=jo.resolve(jo.dirname(r));if(s===i||s===jo.parse(s).root)return o();zo()?Lo.stat(s,{bigint:!0},((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o))):Lo.stat(s,((i,c)=>i?"ENOENT"===i.code?o():o(i):c.ino&&c.dev&&c.ino===n.ino&&c.dev===n.dev?o(new Error(qo(t,r,u))):e(t,n,s,u,o)))},checkParentPathsSync:function e(t,n,r,u){const o=jo.resolve(jo.dirname(t)),i=jo.resolve(jo.dirname(r));if(i===o||i===jo.parse(i).root)return;let s;try{s=zo()?Lo.statSync(i,{bigint:!0}):Lo.statSync(i)}catch(e){if("ENOENT"===e.code)return;throw e}if(s.ino&&s.dev&&s.ino===n.ino&&s.dev===n.dev)throw new Error(qo(t,r,u));return e(t,n,i,u)},isSrcSubdir:Ko};const Qo=we,ei=p.default,ti=Io.mkdirsSync,ni=Mo,ri=Zo;function ui(e,t,n,r){if(!r.filter||r.filter(t,n))return function(e,t,n,r){const u=r.dereference?Qo.statSync:Qo.lstatSync,o=u(t);if(o.isDirectory())return function(e,t,n,r,u){if(!t)return function(e,t,n,r){return Qo.mkdirSync(n),ii(t,n,r),Qo.chmodSync(n,e.mode)}(e,n,r,u);if(t&&!t.isDirectory())throw new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`);return ii(n,r,u)}(o,e,t,n,r);if(o.isFile()||o.isCharacterDevice()||o.isBlockDevice())return function(e,t,n,r,u){return t?function(e,t,n,r){if(r.overwrite)return Qo.unlinkSync(n),oi(e,t,n,r);if(r.errorOnExist)throw new Error(`'${n}' already exists`)}(e,n,r,u):oi(e,n,r,u)}(o,e,t,n,r);if(o.isSymbolicLink())return function(e,t,n,r){let u=Qo.readlinkSync(t);r.dereference&&(u=ei.resolve(process.cwd(),u));if(e){let e;try{e=Qo.readlinkSync(n)}catch(e){if("EINVAL"===e.code||"UNKNOWN"===e.code)return Qo.symlinkSync(u,n);throw e}if(r.dereference&&(e=ei.resolve(process.cwd(),e)),ri.isSrcSubdir(u,e))throw new Error(`Cannot copy '${u}' to a subdirectory of itself, '${e}'.`);if(Qo.statSync(n).isDirectory()&&ri.isSrcSubdir(e,u))throw new Error(`Cannot overwrite '${e}' with '${u}'.`);return function(e,t){return Qo.unlinkSync(t),Qo.symlinkSync(e,t)}(u,n)}return Qo.symlinkSync(u,n)}(e,t,n,r)}(e,t,n,r)}function oi(e,t,n,r){return"function"==typeof Qo.copyFileSync?(Qo.copyFileSync(t,n),Qo.chmodSync(n,e.mode),r.preserveTimestamps?ni(n,e.atime,e.mtime):void 0):function(e,t,n,r){const u=65536,o=(Xo?Yo:(Xo=1,Yo=function(e){if("function"==typeof Buffer.allocUnsafe)try{return Buffer.allocUnsafe(e)}catch(t){return new Buffer(e)}return new Buffer(e)}))(u),i=Qo.openSync(t,"r"),s=Qo.openSync(n,"w",e.mode);let c=0;for(;cfunction(e,t,n,r){const u=ei.join(t,e),o=ei.join(n,e),{destStat:i}=ri.checkPathsSync(u,o,"copy");return ui(i,u,o,r)}(r,e,t,n)))}var si=function(e,t,n){"function"==typeof n&&(n={filter:n}),(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269");const{srcStat:r,destStat:u}=ri.checkPathsSync(e,t,"copy");return ri.checkParentPathsSync(e,r,t,"copy"),function(e,t,n,r){if(r.filter&&!r.filter(t,n))return;const u=ei.dirname(n);Qo.existsSync(u)||ti(u);return ui(e,t,n,r)}(u,e,t,n)},ci={copySync:si};const ai=yo.fromPromise,li=ho;var fi={pathExists:ai((function(e){return li.access(e).then((()=>!0)).catch((()=>!1))})),pathExistsSync:li.existsSync};const di=we,Di=p.default,pi=Io.mkdirs,Ei=fi.pathExists,mi=Ro,hi=Zo;function yi(e,t,n,r,u){const o=Di.dirname(n);Ei(o,((i,s)=>i?u(i):s?Fi(e,t,n,r,u):void pi(o,(o=>o?u(o):Fi(e,t,n,r,u)))))}function Ci(e,t,n,r,u,o){Promise.resolve(u.filter(n,r)).then((i=>i?e(t,n,r,u,o):o()),(e=>o(e)))}function Fi(e,t,n,r,u){return r.filter?Ci(gi,e,t,n,r,u):gi(e,t,n,r,u)}function gi(e,t,n,r,u){(r.dereference?di.stat:di.lstat)(t,((o,i)=>o?u(o):i.isDirectory()?function(e,t,n,r,u,o){if(!t)return function(e,t,n,r,u){di.mkdir(n,(o=>{if(o)return u(o);Si(t,n,r,(t=>t?u(t):di.chmod(n,e.mode,u)))}))}(e,n,r,u,o);if(t&&!t.isDirectory())return o(new Error(`Cannot overwrite non-directory '${r}' with directory '${n}'.`));return Si(n,r,u,o)}(i,e,t,n,r,u):i.isFile()||i.isCharacterDevice()||i.isBlockDevice()?function(e,t,n,r,u,o){return t?function(e,t,n,r,u){if(!r.overwrite)return r.errorOnExist?u(new Error(`'${n}' already exists`)):u();di.unlink(n,(o=>o?u(o):Ai(e,t,n,r,u)))}(e,n,r,u,o):Ai(e,n,r,u,o)}(i,e,t,n,r,u):i.isSymbolicLink()?function(e,t,n,r,u){di.readlink(t,((t,o)=>t?u(t):(r.dereference&&(o=Di.resolve(process.cwd(),o)),e?void di.readlink(n,((t,i)=>t?"EINVAL"===t.code||"UNKNOWN"===t.code?di.symlink(o,n,u):u(t):(r.dereference&&(i=Di.resolve(process.cwd(),i)),hi.isSrcSubdir(o,i)?u(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`)):e.isDirectory()&&hi.isSrcSubdir(i,o)?u(new Error(`Cannot overwrite '${i}' with '${o}'.`)):function(e,t,n){di.unlink(t,(r=>r?n(r):di.symlink(e,t,n)))}(o,n,u)))):di.symlink(o,n,u))))}(e,t,n,r,u):void 0))}function Ai(e,t,n,r,u){return"function"==typeof di.copyFile?di.copyFile(t,n,(t=>t?u(t):vi(e,n,r,u))):function(e,t,n,r,u){const o=di.createReadStream(t);o.on("error",(e=>u(e))).once("open",(()=>{const t=di.createWriteStream(n,{mode:e.mode});t.on("error",(e=>u(e))).on("open",(()=>o.pipe(t))).once("close",(()=>vi(e,n,r,u)))}))}(e,t,n,r,u)}function vi(e,t,n,r){di.chmod(t,e.mode,(u=>u?r(u):n.preserveTimestamps?mi(t,e.atime,e.mtime,r):r()))}function Si(e,t,n,r){di.readdir(e,((u,o)=>u?r(u):wi(o,e,t,n,r)))}function wi(e,t,n,r,u){const o=e.pop();return o?function(e,t,n,r,u,o){const i=Di.join(n,t),s=Di.join(r,t);hi.checkPaths(i,s,"copy",((t,c)=>{if(t)return o(t);const{destStat:a}=c;Fi(a,i,s,u,(t=>t?o(t):wi(e,n,r,u,o)))}))}(e,o,t,n,r,u):u()}var Oi=function(e,t,n,r){"function"!=typeof n||r?"function"==typeof n&&(n={filter:n}):(r=n,n={}),r=r||function(){},(n=n||{}).clobber=!("clobber"in n)||!!n.clobber,n.overwrite="overwrite"in n?!!n.overwrite:n.clobber,n.preserveTimestamps&&"ia32"===process.arch&&console.warn("fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269"),hi.checkPaths(e,t,"copy",((u,o)=>{if(u)return r(u);const{srcStat:i,destStat:s}=o;hi.checkParentPaths(e,i,t,"copy",(u=>u?r(u):n.filter?Ci(yi,s,e,t,n,r):yi(s,e,t,n,r)))}))};var bi={copy:(0,yo.fromCallback)(Oi)};const _i=we,Bi=p.default,Pi=g.default,ki="win32"===process.platform;function xi(e){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach((t=>{e[t]=e[t]||_i[t],e[t+="Sync"]=e[t]||_i[t]})),e.maxBusyTries=e.maxBusyTries||3}function Ni(e,t,n){let r=0;"function"==typeof t&&(n=t,t={}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi.strictEqual(typeof n,"function","rimraf: callback function required"),Pi(t,"rimraf: invalid options argument provided"),Pi.strictEqual(typeof t,"object","rimraf: options should be object"),xi(t),Ii(e,t,(function u(o){if(o){if(("EBUSY"===o.code||"ENOTEMPTY"===o.code||"EPERM"===o.code)&&rIi(e,t,u)),100*r)}"ENOENT"===o.code&&(o=null)}n(o)}))}function Ii(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.lstat(e,((r,u)=>r&&"ENOENT"===r.code?n(null):r&&"EPERM"===r.code&&ki?Ti(e,t,r,n):u&&u.isDirectory()?Mi(e,t,r,n):void t.unlink(e,(r=>{if(r){if("ENOENT"===r.code)return n(null);if("EPERM"===r.code)return ki?Ti(e,t,r,n):Mi(e,t,r,n);if("EISDIR"===r.code)return Mi(e,t,r,n)}return n(r)}))))}function Ti(e,t,n,r){Pi(e),Pi(t),Pi("function"==typeof r),n&&Pi(n instanceof Error),t.chmod(e,438,(u=>{u?r("ENOENT"===u.code?null:n):t.stat(e,((u,o)=>{u?r("ENOENT"===u.code?null:n):o.isDirectory()?Mi(e,t,n,r):t.unlink(e,r)}))}))}function Ri(e,t,n){let r;Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.chmodSync(e,438)}catch(e){if("ENOENT"===e.code)return;throw n}try{r=t.statSync(e)}catch(e){if("ENOENT"===e.code)return;throw n}r.isDirectory()?ji(e,t,n):t.unlinkSync(e)}function Mi(e,t,n,r){Pi(e),Pi(t),n&&Pi(n instanceof Error),Pi("function"==typeof r),t.rmdir(e,(u=>{!u||"ENOTEMPTY"!==u.code&&"EEXIST"!==u.code&&"EPERM"!==u.code?u&&"ENOTDIR"===u.code?r(n):r(u):function(e,t,n){Pi(e),Pi(t),Pi("function"==typeof n),t.readdir(e,((r,u)=>{if(r)return n(r);let o,i=u.length;if(0===i)return t.rmdir(e,n);u.forEach((r=>{Ni(Bi.join(e,r),t,(r=>{if(!o)return r?n(o=r):void(0==--i&&t.rmdir(e,n))}))}))}))}(e,t,r)}))}function Li(e,t){let n;xi(t=t||{}),Pi(e,"rimraf: missing path"),Pi.strictEqual(typeof e,"string","rimraf: path should be a string"),Pi(t,"rimraf: missing options"),Pi.strictEqual(typeof t,"object","rimraf: options should be object");try{n=t.lstatSync(e)}catch(n){if("ENOENT"===n.code)return;"EPERM"===n.code&&ki&&Ri(e,t,n)}try{n&&n.isDirectory()?ji(e,t,null):t.unlinkSync(e)}catch(n){if("ENOENT"===n.code)return;if("EPERM"===n.code)return ki?Ri(e,t,n):ji(e,t,n);if("EISDIR"!==n.code)throw n;ji(e,t,n)}}function ji(e,t,n){Pi(e),Pi(t),n&&Pi(n instanceof Error);try{t.rmdirSync(e)}catch(r){if("ENOTDIR"===r.code)throw n;if("ENOTEMPTY"===r.code||"EEXIST"===r.code||"EPERM"===r.code)!function(e,t){if(Pi(e),Pi(t),t.readdirSync(e).forEach((n=>Li(Bi.join(e,n),t))),!ki){return t.rmdirSync(e,t)}{const n=Date.now();do{try{return t.rmdirSync(e,t)}catch(e){}}while(Date.now()-n<500)}}(e,t);else if("ENOENT"!==r.code)throw r}}var $i=Ni;Ni.sync=Li;const Hi=$i;var Ji={remove:(0,yo.fromCallback)(Hi),removeSync:Hi.sync};const Gi=yo.fromCallback,Vi=we,Ui=p.default,Wi=Io,zi=Ji,Ki=Gi((function(e,t){t=t||function(){},Vi.readdir(e,((n,r)=>{if(n)return Wi.mkdirs(e,t);r=r.map((t=>Ui.join(e,t))),function e(){const n=r.pop();if(!n)return t();zi.remove(n,(n=>{if(n)return t(n);e()}))}()}))}));function qi(e){let t;try{t=Vi.readdirSync(e)}catch(t){return Wi.mkdirsSync(e)}t.forEach((t=>{t=Ui.join(e,t),zi.removeSync(t)}))}var Yi={emptyDirSync:qi,emptydirSync:qi,emptyDir:Ki,emptydir:Ki};const Xi=yo.fromCallback,Zi=p.default,Qi=we,es=Io,ts=fi.pathExists;var ns={createFile:Xi((function(e,t){function n(){Qi.writeFile(e,"",(e=>{if(e)return t(e);t()}))}Qi.stat(e,((r,u)=>{if(!r&&u.isFile())return t();const o=Zi.dirname(e);ts(o,((e,r)=>e?t(e):r?n():void es.mkdirs(o,(e=>{if(e)return t(e);n()}))))}))})),createFileSync:function(e){let t;try{t=Qi.statSync(e)}catch(e){}if(t&&t.isFile())return;const n=Zi.dirname(e);Qi.existsSync(n)||es.mkdirsSync(n),Qi.writeFileSync(e,"")}};const rs=yo.fromCallback,us=p.default,os=we,is=Io,ss=fi.pathExists;var cs={createLink:rs((function(e,t,n){function r(e,t){os.link(e,t,(e=>{if(e)return n(e);n(null)}))}ss(t,((u,o)=>u?n(u):o?n(null):void os.lstat(e,(u=>{if(u)return u.message=u.message.replace("lstat","ensureLink"),n(u);const o=us.dirname(t);ss(o,((u,i)=>u?n(u):i?r(e,t):void is.mkdirs(o,(u=>{if(u)return n(u);r(e,t)}))))}))))})),createLinkSync:function(e,t){if(os.existsSync(t))return;try{os.lstatSync(e)}catch(e){throw e.message=e.message.replace("lstat","ensureLink"),e}const n=us.dirname(t);return os.existsSync(n)||is.mkdirsSync(n),os.linkSync(e,t)}};const as=p.default,ls=we,fs=fi.pathExists;var ds={symlinkPaths:function(e,t,n){if(as.isAbsolute(e))return ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:e})));{const r=as.dirname(t),u=as.join(r,e);return fs(u,((t,o)=>t?n(t):o?n(null,{toCwd:u,toDst:e}):ls.lstat(e,(t=>t?(t.message=t.message.replace("lstat","ensureSymlink"),n(t)):n(null,{toCwd:e,toDst:as.relative(r,e)})))))}},symlinkPathsSync:function(e,t){let n;if(as.isAbsolute(e)){if(n=ls.existsSync(e),!n)throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}{const r=as.dirname(t),u=as.join(r,e);if(n=ls.existsSync(u),n)return{toCwd:u,toDst:e};if(n=ls.existsSync(e),!n)throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:as.relative(r,e)}}}};const Ds=we;var ps={symlinkType:function(e,t,n){if(n="function"==typeof t?t:n,t="function"!=typeof t&&t)return n(null,t);Ds.lstat(e,((e,r)=>{if(e)return n(null,"file");t=r&&r.isDirectory()?"dir":"file",n(null,t)}))},symlinkTypeSync:function(e,t){let n;if(t)return t;try{n=Ds.lstatSync(e)}catch(e){return"file"}return n&&n.isDirectory()?"dir":"file"}};const Es=yo.fromCallback,ms=p.default,hs=we,ys=Io.mkdirs,Cs=Io.mkdirsSync,Fs=ds.symlinkPaths,gs=ds.symlinkPathsSync,As=ps.symlinkType,vs=ps.symlinkTypeSync,Ss=fi.pathExists;var ws={createSymlink:Es((function(e,t,n,r){r="function"==typeof n?n:r,n="function"!=typeof n&&n,Ss(t,((u,o)=>u?r(u):o?r(null):void Fs(e,t,((u,o)=>{if(u)return r(u);e=o.toDst,As(o.toCwd,n,((n,u)=>{if(n)return r(n);const o=ms.dirname(t);Ss(o,((n,i)=>n?r(n):i?hs.symlink(e,t,u,r):void ys(o,(n=>{if(n)return r(n);hs.symlink(e,t,u,r)}))))}))}))))})),createSymlinkSync:function(e,t,n){if(hs.existsSync(t))return;const r=gs(e,t);e=r.toDst,n=vs(r.toCwd,n);const u=ms.dirname(t);return hs.existsSync(u)||Cs(u),hs.symlinkSync(e,t,n)}};var Os,bs={createFile:ns.createFile,createFileSync:ns.createFileSync,ensureFile:ns.createFile,ensureFileSync:ns.createFileSync,createLink:cs.createLink,createLinkSync:cs.createLinkSync,ensureLink:cs.createLink,ensureLinkSync:cs.createLinkSync,createSymlink:ws.createSymlink,createSymlinkSync:ws.createSymlinkSync,ensureSymlink:ws.createSymlink,ensureSymlinkSync:ws.createSymlinkSync};try{Os=we}catch(e){Os=D.default}function _s(e,t){var n,r="\n";return"object"==typeof t&&null!==t&&(t.spaces&&(n=t.spaces),t.EOL&&(r=t.EOL)),JSON.stringify(e,t?t.replacer:null,n).replace(/\n/g,r)+r}function Bs(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e=e.replace(/^\uFEFF/,"")}var Ps={readFile:function(e,t,n){null==n&&(n=t,t={}),"string"==typeof t&&(t={encoding:t});var r=(t=t||{}).fs||Os,u=!0;"throws"in t&&(u=t.throws),r.readFile(e,t,(function(r,o){if(r)return n(r);var i;o=Bs(o);try{i=JSON.parse(o,t?t.reviver:null)}catch(t){return u?(t.message=e+": "+t.message,n(t)):n(null,null)}n(null,i)}))},readFileSync:function(e,t){"string"==typeof(t=t||{})&&(t={encoding:t});var n=t.fs||Os,r=!0;"throws"in t&&(r=t.throws);try{var u=n.readFileSync(e,t);return u=Bs(u),JSON.parse(u,t.reviver)}catch(t){if(r)throw t.message=e+": "+t.message,t;return null}},writeFile:function(e,t,n,r){null==r&&(r=n,n={});var u=(n=n||{}).fs||Os,o="";try{o=_s(t,n)}catch(e){return void(r&&r(e,null))}u.writeFile(e,o,n,r)},writeFileSync:function(e,t,n){var r=(n=n||{}).fs||Os,u=_s(t,n);return r.writeFileSync(e,u,n)}},ks=Ps;const xs=yo.fromCallback,Ns=ks;var Is={readJson:xs(Ns.readFile),readJsonSync:Ns.readFileSync,writeJson:xs(Ns.writeFile),writeJsonSync:Ns.writeFileSync};const Ts=p.default,Rs=Io,Ms=fi.pathExists,Ls=Is;var js=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=Ts.dirname(e);Ms(u,((o,i)=>o?r(o):i?Ls.writeJson(e,t,n,r):void Rs.mkdirs(u,(u=>{if(u)return r(u);Ls.writeJson(e,t,n,r)}))))};const $s=we,Hs=p.default,Js=Io,Gs=Is;var Vs=function(e,t,n){const r=Hs.dirname(e);$s.existsSync(r)||Js.mkdirsSync(r),Gs.writeJsonSync(e,t,n)};const Us=yo.fromCallback,Ws=Is;Ws.outputJson=Us(js),Ws.outputJsonSync=Vs,Ws.outputJSON=Ws.outputJson,Ws.outputJSONSync=Ws.outputJsonSync,Ws.writeJSON=Ws.writeJson,Ws.writeJSONSync=Ws.writeJsonSync,Ws.readJSON=Ws.readJson,Ws.readJSONSync=Ws.readJsonSync;var zs=Ws;const Ks=we,qs=p.default,Ys=ci.copySync,Xs=Ji.removeSync,Zs=Io.mkdirpSync,Qs=Zo;function ec(e,t,n){try{Ks.renameSync(e,t)}catch(r){if("EXDEV"!==r.code)throw r;return function(e,t,n){const r={overwrite:n,errorOnExist:!0};return Ys(e,t,r),Xs(e)}(e,t,n)}}var tc=function(e,t,n){const r=(n=n||{}).overwrite||n.clobber||!1,{srcStat:u}=Qs.checkPathsSync(e,t,"move");return Qs.checkParentPathsSync(e,u,t,"move"),Zs(qs.dirname(t)),function(e,t,n){if(n)return Xs(t),ec(e,t,n);if(Ks.existsSync(t))throw new Error("dest already exists.");return ec(e,t,n)}(e,t,r)},nc={moveSync:tc};const rc=we,uc=p.default,oc=bi.copy,ic=Ji.remove,sc=Io.mkdirp,cc=fi.pathExists,ac=Zo;function lc(e,t,n,r){rc.rename(e,t,(u=>u?"EXDEV"!==u.code?r(u):function(e,t,n,r){const u={overwrite:n,errorOnExist:!0};oc(e,t,u,(t=>t?r(t):ic(e,r)))}(e,t,n,r):r()))}var fc=function(e,t,n,r){"function"==typeof n&&(r=n,n={});const u=n.overwrite||n.clobber||!1;ac.checkPaths(e,t,"move",((n,o)=>{if(n)return r(n);const{srcStat:i}=o;ac.checkParentPaths(e,i,t,"move",(n=>{if(n)return r(n);sc(uc.dirname(t),(n=>n?r(n):function(e,t,n,r){if(n)return ic(t,(u=>u?r(u):lc(e,t,n,r)));cc(t,((u,o)=>u?r(u):o?r(new Error("dest already exists.")):lc(e,t,n,r)))}(e,t,u,r)))}))}))};var dc={move:(0,yo.fromCallback)(fc)};const Dc=yo.fromCallback,pc=we,Ec=p.default,mc=Io,hc=fi.pathExists;var yc={outputFile:Dc((function(e,t,n,r){"function"==typeof n&&(r=n,n="utf8");const u=Ec.dirname(e);hc(u,((o,i)=>o?r(o):i?pc.writeFile(e,t,n,r):void mc.mkdirs(u,(u=>{if(u)return r(u);pc.writeFile(e,t,n,r)}))))})),outputFileSync:function(e,...t){const n=Ec.dirname(e);if(pc.existsSync(n))return pc.writeFileSync(e,...t);mc.mkdirsSync(n),pc.writeFileSync(e,...t)}};!function(e){e.exports=Object.assign({},ho,ci,bi,Yi,bs,zs,Io,nc,dc,yc,fi,Ji);const t=D.default;Object.getOwnPropertyDescriptor(t,"promises")&&Object.defineProperty(e.exports,"promises",{get:()=>t.promises})}(mo);const Cc=Nr.exports("streamroller:fileNameFormatter"),Fc=p.default;const gc=Nr.exports("streamroller:fileNameParser"),Ac=nu.exports;const vc=Nr.exports("streamroller:moveAndMaybeCompressFile"),Sc=mo.exports,wc=v.default;var Oc=async(e,t,n)=>{if(n=function(e){const t={mode:parseInt("0600",8),compress:!1},n=Object.assign({},t,e);return vc(`_parseOption: moveAndMaybeCompressFile called with option=${JSON.stringify(n)}`),n}(n),e!==t){if(await Sc.pathExists(e))if(vc(`moveAndMaybeCompressFile: moving file from ${e} to ${t} ${n.compress?"with":"without"} compress`),n.compress)await new Promise(((r,u)=>{let o=!1;const i=Sc.createWriteStream(t,{mode:n.mode,flags:"wx"}).on("open",(()=>{o=!0;const t=Sc.createReadStream(e).on("open",(()=>{t.pipe(wc.createGzip()).pipe(i)})).on("error",(t=>{vc(`moveAndMaybeCompressFile: error reading ${e}`,t),i.destroy(t)}))})).on("finish",(()=>{vc(`moveAndMaybeCompressFile: finished compressing ${t}, deleting ${e}`),Sc.unlink(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error deleting ${e}, truncating instead`,t),Sc.truncate(e).then(r).catch((t=>{vc(`moveAndMaybeCompressFile: error truncating ${e}`,t),u(t)}))}))})).on("error",(e=>{o?(vc(`moveAndMaybeCompressFile: error writing ${t}, deleting`,e),Sc.unlink(t).then((()=>{u(e)})).catch((e=>{vc(`moveAndMaybeCompressFile: error deleting ${t}`,e),u(e)}))):(vc(`moveAndMaybeCompressFile: error creating ${t}`,e),u(e))}))})).catch((()=>{}));else{vc(`moveAndMaybeCompressFile: renaming ${e} to ${t}`);try{await Sc.move(e,t,{overwrite:!0})}catch(n){if(vc(`moveAndMaybeCompressFile: error renaming ${e} to ${t}`,n),"ENOENT"!==n.code){vc("moveAndMaybeCompressFile: trying copy+truncate instead");try{await Sc.copy(e,t,{overwrite:!0}),await Sc.truncate(e)}catch(e){vc("moveAndMaybeCompressFile: error copy+truncate",e)}}}}}else vc("moveAndMaybeCompressFile: source and target are the same, not doing anything")};const bc=Nr.exports("streamroller:RollingFileWriteStream"),_c=mo.exports,Bc=p.default,Pc=E.default,kc=()=>new Date,xc=nu.exports,{Writable:Nc}=C.default,Ic=({file:e,keepFileExt:t,needsIndex:n,alwaysIncludeDate:r,compress:u,fileNameSep:o})=>{let i=o||".";const s=Fc.join(e.dir,e.name),c=t=>t+e.ext,a=(e,t,r)=>!n&&r||!t?e:e+i+t,l=(e,t,n)=>(t>0||r)&&n?e+i+n:e,f=(e,t)=>t&&u?e+".gz":e,d=t?[l,a,c,f]:[c,l,a,f];return({date:e,index:t})=>(Cc(`_formatFileName: date=${e}, index=${t}`),d.reduce(((n,r)=>r(n,t,e)),s))},Tc=({file:e,keepFileExt:t,pattern:n,fileNameSep:r})=>{let u=r||".";const o="__NOT_MATCHING__";let i=[(e,t)=>e.endsWith(".gz")?(gc("it is gzipped"),t.isCompressed=!0,e.slice(0,-1*".gz".length)):e,t?t=>t.startsWith(e.name)&&t.endsWith(e.ext)?(gc("it starts and ends with the right things"),t.slice(e.name.length+1,-1*e.ext.length)):o:t=>t.startsWith(e.base)?(gc("it starts with the right things"),t.slice(e.base.length+1)):o,n?(e,t)=>{const r=e.split(u);let o=r[r.length-1];gc("items: ",r,", indexStr: ",o);let i=e;void 0!==o&&o.match(/^\d+$/)?(i=e.slice(0,-1*(o.length+1)),gc(`dateStr is ${i}`),n&&!i&&(i=o,o="0")):o="0";try{const r=Ac.parse(n,i,new Date(0,0));return Ac.asString(n,r)!==i?e:(t.index=parseInt(o,10),t.date=i,t.timestamp=r.getTime(),"")}catch(t){return gc(`Problem parsing ${i} as ${n}, error was: `,t),e}}:(e,t)=>e.match(/^\d+$/)?(gc("it has an index"),t.index=parseInt(e,10),""):e];return e=>{let t={filename:e,index:0,isCompressed:!1};return i.reduce(((e,n)=>n(e,t)),e)?null:t}},Rc=Oc;var Mc=class extends Nc{constructor(e,t){if(bc(`constructor: creating RollingFileWriteStream. path=${e}`),"string"!=typeof e||0===e.length)throw new Error(`Invalid filename: ${e}`);if(e.endsWith(Bc.sep))throw new Error(`Filename is a directory: ${e}`);0===e.indexOf(`~${Bc.sep}`)&&(e=e.replace("~",Pc.homedir())),super(t),this.options=this._parseOption(t),this.fileObject=Bc.parse(e),""===this.fileObject.dir&&(this.fileObject=Bc.parse(Bc.join(process.cwd(),e))),this.fileFormatter=Ic({file:this.fileObject,alwaysIncludeDate:this.options.alwaysIncludePattern,needsIndex:this.options.maxSize 0`)}else delete n.maxSize;if(n.numBackups||0===n.numBackups){if(n.numBackups<0)throw new Error(`options.numBackups (${n.numBackups}) should be >= 0`);if(n.numBackups>=Number.MAX_SAFE_INTEGER)throw new Error(`options.numBackups (${n.numBackups}) should be < Number.MAX_SAFE_INTEGER`);n.numToKeep=n.numBackups+1}else if(n.numToKeep<=0)throw new Error(`options.numToKeep (${n.numToKeep}) should be > 0`);return bc(`_parseOption: creating stream with option=${JSON.stringify(n)}`),n}_final(e){this.currentFileStream.end("",this.options.encoding,e)}_write(e,t,n){this._shouldRoll().then((()=>{bc(`_write: writing chunk. file=${this.currentFileStream.path} state=${JSON.stringify(this.state)} chunk=${e}`),this.currentFileStream.write(e,t,(t=>{this.state.currentSize+=e.length,n(t)}))}))}async _shouldRoll(){(this._dateChanged()||this._tooBig())&&(bc(`_shouldRoll: rolling because dateChanged? ${this._dateChanged()} or tooBig? ${this._tooBig()}`),await this._roll())}_dateChanged(){return this.state.currentDate&&this.state.currentDate!==xc(this.options.pattern,kc())}_tooBig(){return this.state.currentSize>=this.options.maxSize}_roll(){return bc("_roll: closing the current stream"),new Promise(((e,t)=>{this.currentFileStream.end("",this.options.encoding,(()=>{this._moveOldFiles().then(e).catch(t)}))}))}async _moveOldFiles(){const e=await this._getExistingFiles();for(let t=(this.state.currentDate?e.filter((e=>e.date===this.state.currentDate)):e).length;t>=0;t--){bc(`_moveOldFiles: i = ${t}`);const e=this.fileFormatter({date:this.state.currentDate,index:t}),n=this.fileFormatter({date:this.state.currentDate,index:t+1}),r={compress:this.options.compress&&0===t,mode:this.options.mode};await Rc(e,n,r)}this.state.currentSize=0,this.state.currentDate=this.state.currentDate?xc(this.options.pattern,kc()):null,bc(`_moveOldFiles: finished rolling files. state=${JSON.stringify(this.state)}`),this._renewWriteStream(),await new Promise(((e,t)=>{this.currentFileStream.write("","utf8",(()=>{this._clean().then(e).catch(t)}))}))}async _getExistingFiles(){const e=await _c.readdir(this.fileObject.dir).catch((()=>[]));bc(`_getExistingFiles: files=${e}`);const t=e.map((e=>this.fileNameParser(e))).filter((e=>e)),n=e=>(e.timestamp?e.timestamp:kc().getTime())-e.index;return t.sort(((e,t)=>n(e)-n(t))),t}_renewWriteStream(){const e=this.fileFormatter({date:this.state.currentDate,index:0}),t=e=>{try{return _c.mkdirSync(e,{recursive:!0})}catch(n){if("ENOENT"===n.code)return t(Bc.dirname(e)),t(e);if("EEXIST"!==n.code&&"EROFS"!==n.code)throw n;try{if(_c.statSync(e).isDirectory())return e;throw n}catch(e){throw n}}};t(this.fileObject.dir);const n={flags:this.options.flags,encoding:this.options.encoding,mode:this.options.mode};var r,u;_c.appendFileSync(e,"",(r={...n},u="flags",r["flag"]=r[u],delete r[u],r)),this.currentFileStream=_c.createWriteStream(e,n),this.currentFileStream.on("error",(e=>{this.emit("error",e)}))}async _clean(){const e=await this._getExistingFiles();if(bc(`_clean: numToKeep = ${this.options.numToKeep}, existingFiles = ${e.length}`),bc("_clean: existing files are: ",e),this._tooManyFiles(e.length)){const n=e.slice(0,e.length-this.options.numToKeep).map((e=>Bc.format({dir:this.fileObject.dir,base:e.filename})));await(t=n,bc(`deleteFiles: files to delete: ${t}`),Promise.all(t.map((e=>_c.unlink(e).catch((t=>{bc(`deleteFiles: error when unlinking ${e}, ignoring. Error was ${t}`)}))))))}var t}_tooManyFiles(e){return this.options.numToKeep>0&&e>this.options.numToKeep}};const Lc=Mc;var jc=class extends Lc{constructor(e,t,n,r){r||(r={}),t&&(r.maxSize=t),r.numBackups||0===r.numBackups||(n||0===n||(n=1),r.numBackups=n),super(e,r),this.backups=r.numBackups,this.size=this.options.maxSize}get theStream(){return this.currentFileStream}};const $c=Mc;var Hc={RollingFileWriteStream:Mc,RollingFileStream:jc,DateRollingFileStream:class extends $c{constructor(e,t,n){t&&"object"==typeof t&&(n=t,t=null),n||(n={}),t||(t="yyyy-MM-dd"),n.pattern=t,n.numBackups||0===n.numBackups?n.daysToKeep=n.numBackups:(n.daysToKeep||0===n.daysToKeep?process.emitWarning("options.daysToKeep is deprecated due to the confusion it causes when used together with file size rolling. Please use options.numBackups instead.","DeprecationWarning","streamroller-DEP0001"):n.daysToKeep=1,n.numBackups=n.daysToKeep),super(e,n),this.mode=this.options.mode}get theStream(){return this.currentFileStream}}};const Jc=Nr.exports("log4js:file"),Gc=p.default,Vc=Hc,Uc=E.default.EOL;let Wc=!1;const zc=new Set;function Kc(){zc.forEach((e=>{e.sighupHandler()}))}function qc(e,t,n,r){const u=new Vc.RollingFileStream(e,t,n,r);return u.on("error",(t=>{console.error("log4js.fileAppender - Writing to file %s, error happened ",e,t)})),u.on("drain",(()=>{process.emit("log4js:pause",!1)})),u}Eo.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.mode=e.mode||384,function(e,t,n,r,u,o){e=Gc.normalize(e),Jc("Creating file appender (",e,", ",n,", ",r=r||0===r?r:5,", ",u,", ",o,")");let i=qc(e,n,r,u);const s=function(e){if(i.writable){if(!0===u.removeColor){const t=/\x1b[[0-9;]*m/g;e.data=e.data.map((e=>"string"==typeof e?e.replace(t,""):e))}i.write(t(e,o)+Uc,"utf8")||process.emit("log4js:pause",!0)}};return s.reopen=function(){i.end((()=>{i=qc(e,n,r,u)}))},s.sighupHandler=function(){Jc("SIGHUP handler called."),s.reopen()},s.shutdown=function(e){zc.delete(s),0===zc.size&&Wc&&(process.removeListener("SIGHUP",Kc),Wc=!1),i.end("","utf-8",e)},zc.add(s),Wc||(process.on("SIGHUP",Kc),Wc=!0),s}(e.filename,n,e.maxLogSize,e.backups,e,e.timezoneOffset)};var Yc={};const Xc=Hc,Zc=E.default.EOL;function Qc(e,t,n,r,u){r.maxSize=r.maxLogSize;const o=function(e,t,n){const r=new Xc.DateRollingFileStream(e,t,n);return r.on("error",(t=>{console.error("log4js.dateFileAppender - Writing to file %s, error happened ",e,t)})),r.on("drain",(()=>{process.emit("log4js:pause",!1)})),r}(e,t,r),i=function(e){o.writable&&(o.write(n(e,u)+Zc,"utf8")||process.emit("log4js:pause",!0))};return i.shutdown=function(e){o.end("","utf-8",e)},i}Yc.configure=function(e,t){let n=t.basicLayout;return e.layout&&(n=t.layout(e.layout.type,e.layout)),e.alwaysIncludePattern||(e.alwaysIncludePattern=!1),e.mode=e.mode||384,Qc(e.filename,e.pattern,n,e,e.timezoneOffset)};var ea={};const ta=Nr.exports("log4js:fileSync"),na=p.default,ra=D.default,ua=E.default.EOL||"\n";function oa(e,t){if(ra.existsSync(e))return;const n=ra.openSync(e,t.flags,t.mode);ra.closeSync(n)}class ia{constructor(e,t,n,r){ta("In RollingFileStream"),function(){if(!e||!t||t<=0)throw new Error("You must specify a filename and file size")}(),this.filename=e,this.size=t,this.backups=n,this.options=r,this.currentSize=0,this.currentSize=function(e){let t=0;try{t=ra.statSync(e).size}catch(t){oa(e,r)}return t}(this.filename)}shouldRoll(){return ta("should roll with current size %d, and max size %d",this.currentSize,this.size),this.currentSize>=this.size}roll(e){const t=this,n=new RegExp(`^${na.basename(e)}`);function r(e){return n.test(e)}function u(t){return parseInt(t.substring(`${na.basename(e)}.`.length),10)||0}function o(e,t){return u(e)>u(t)?1:u(e) ${e}.${r+1}`),ra.renameSync(na.join(na.dirname(e),n),`${e}.${r+1}`)}}ta("Rolling, rolling, rolling"),ta("Renaming the old files"),ra.readdirSync(na.dirname(e)).filter(r).sort(o).reverse().forEach(i)}write(e,t){const n=this;ta("in write"),this.shouldRoll()&&(this.currentSize=0,this.roll(this.filename)),ta("writing the chunk to the file"),n.currentSize+=e.length,ra.appendFileSync(n.filename,e)}}ea.configure=function(e,t){let n=t.basicLayout;e.layout&&(n=t.layout(e.layout.type,e.layout));const r={flags:e.flags||"a",encoding:e.encoding||"utf8",mode:e.mode||384};return function(e,t,n,r,u,o){ta("fileSync appender created");const i=function(e,t,n){let r;var u;return t?r=new ia(e,t,n,o):(oa(u=e,o),r={write(e){ra.appendFileSync(u,e)}}),r}(e=na.normalize(e),n,r=r||0===r?r:5);return e=>{i.write(t(e,u)+ua)}}(e.filename,n,e.maxLogSize,e.backups,e.timezoneOffset,r)};var sa={};const ca=Nr.exports("log4js:tcp"),aa=S.default;sa.configure=function(e,t){ca(`configure with config = ${e}`);let n=function(e){return e.serialise()};return e.layout&&(n=t.layout(e.layout.type,e.layout)),function(e,t){let n=!1;const r=[];let u,o=3,i="__LOG4JS__";function s(e){ca("Writing log event to socket"),n=u.write(`${t(e)}${i}`,"utf8")}function c(){let e;for(ca("emptying buffer");e=r.shift();)s(e)}function a(e){n?s(e):(ca("buffering log event because it cannot write at the moment"),r.push(e))}return function t(){ca(`appender creating socket to ${e.host||"localhost"}:${e.port||5e3}`),i=`${e.endMsg||"__LOG4JS__"}`,u=aa.createConnection(e.port||5e3,e.host||"localhost"),u.on("connect",(()=>{ca("socket connected"),c(),n=!0})),u.on("drain",(()=>{ca("drain event received, emptying buffer"),n=!0,c()})),u.on("timeout",u.end.bind(u)),u.on("error",(e=>{ca("connection error",e),n=!1,c()})),u.on("close",t)}(),a.shutdown=function(e){ca("shutdown called"),r.length&&o?(ca("buffer has items, waiting 100ms to empty"),o-=1,setTimeout((()=>{a.shutdown(e)}),100)):(u.removeAllListeners("close"),u.end(e))},a}(e,n)};const la=p.default,fa=Nr.exports("log4js:appenders"),da=tu,Da=eo,pa=gu,Ea=hu,ma=to,ha=new Map;ha.set("console",oo),ha.set("stdout",so),ha.set("stderr",co),ha.set("logLevelFilter",ao),ha.set("categoryFilter",lo),ha.set("noLogFilter",Do),ha.set("file",Eo),ha.set("dateFile",Yc),ha.set("fileSync",ea),ha.set("tcp",sa);const ya=new Map,Ca=(e,t)=>{fa("Loading module from ",e);try{return require(e)}catch(n){return void da.throwExceptionIf(t,"MODULE_NOT_FOUND"!==n.code,`appender "${e}" could not be loaded (error was: ${n})`)}},Fa=new Set,ga=(e,t)=>{if(ya.has(e))return ya.get(e);if(!t.appenders[e])return!1;if(Fa.has(e))throw new Error(`Dependency loop detected for appender ${e}.`);Fa.add(e),fa(`Creating appender ${e}`);const n=Aa(e,t);return Fa.delete(e),ya.set(e,n),n},Aa=(e,t)=>{const n=t.appenders[e],r=n.type.configure?n.type:((e,t)=>ha.get(e)||Ca(`./${e}`,t)||Ca(e,t)||require.main&&Ca(la.join(la.dirname(require.main.filename),e),t)||Ca(la.join(process.cwd(),e),t))(n.type,t);return da.throwExceptionIf(t,da.not(r),`appender "${e}" is not valid (type "${n.type}" could not be found)`),r.appender&&fa(`DEPRECATION: Appender ${n.type} exports an appender function.`),r.shutdown&&fa(`DEPRECATION: Appender ${n.type} exports a shutdown function.`),fa(`${e}: clustering.isMaster ? ${Da.isMaster()}`),fa(`${e}: appenderModule is ${F.default.inspect(r)}`),Da.onlyOnMaster((()=>(fa(`calling appenderModule.configure for ${e} / ${n.type}`),r.configure(ma.modifyConfig(n),Ea,(e=>ga(e,t)),pa))),(()=>{}))},va=e=>{ya.clear(),Fa.clear();const t=[];Object.values(e.categories).forEach((e=>{t.push(...e.appenders)})),Object.keys(e.appenders).forEach((n=>{(t.includes(n)||"tcp-server"===e.appenders[n].type)&&ga(n,e)}))},Sa=()=>{va({appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"trace"}}})};Sa(),da.addListener((e=>{da.throwExceptionIf(e,da.not(da.anObject(e.appenders)),'must have a property "appenders" of type object.');const t=Object.keys(e.appenders);da.throwExceptionIf(e,da.not(t.length),"must define at least one appender."),t.forEach((t=>{da.throwExceptionIf(e,da.not(e.appenders[t].type),`appender "${t}" is not valid (must be an object with property "type")`)}))})),da.addListener(va),Au.exports=ya,Au.exports.init=Sa;var wa={exports:{}};!function(e){const t=Nr.exports("log4js:categories"),n=tu,r=gu,u=Au.exports,o=new Map;function i(e,t,n){if(!1===t.inherit)return;const r=n.lastIndexOf(".");if(r<0)return;const u=n.substring(0,r);let o=e.categories[u];o||(o={inherit:!0,appenders:[]}),i(e,o,u),!e.categories[u]&&o.appenders&&o.appenders.length&&o.level&&(e.categories[u]=o),t.appenders=t.appenders||[],t.level=t.level||o.level,o.appenders.forEach((e=>{t.appenders.includes(e)||t.appenders.push(e)})),t.parent=o}function s(e){if(!e.categories)return;Object.keys(e.categories).forEach((t=>{const n=e.categories[t];i(e,n,t)}))}n.addPreProcessingListener((e=>s(e))),n.addListener((e=>{n.throwExceptionIf(e,n.not(n.anObject(e.categories)),'must have a property "categories" of type object.');const t=Object.keys(e.categories);n.throwExceptionIf(e,n.not(t.length),"must define at least one category."),t.forEach((t=>{const o=e.categories[t];n.throwExceptionIf(e,[n.not(o.appenders),n.not(o.level)],`category "${t}" is not valid (must be an object with properties "appenders" and "level")`),n.throwExceptionIf(e,n.not(Array.isArray(o.appenders)),`category "${t}" is not valid (appenders must be an array of appender names)`),n.throwExceptionIf(e,n.not(o.appenders.length),`category "${t}" is not valid (appenders must contain at least one appender name)`),Object.prototype.hasOwnProperty.call(o,"enableCallStack")&&n.throwExceptionIf(e,"boolean"!=typeof o.enableCallStack,`category "${t}" is not valid (enableCallStack must be boolean type)`),o.appenders.forEach((r=>{n.throwExceptionIf(e,n.not(u.get(r)),`category "${t}" is not valid (appender "${r}" is not defined)`)})),n.throwExceptionIf(e,n.not(r.getLevel(o.level)),`category "${t}" is not valid (level "${o.level}" not recognised; valid levels are ${r.levels.join(", ")})`)})),n.throwExceptionIf(e,n.not(e.categories.default),'must define a "default" category.')}));const c=e=>{o.clear();Object.keys(e.categories).forEach((n=>{const i=e.categories[n],s=[];i.appenders.forEach((e=>{s.push(u.get(e)),t(`Creating category ${n}`),o.set(n,{appenders:s,level:r.getLevel(i.level),enableCallStack:i.enableCallStack||!1})}))}))},a=()=>{c({categories:{default:{appenders:["out"],level:"OFF"}}})};a(),n.addListener(c);const l=e=>(t(`configForCategory: searching for config for ${e}`),o.has(e)?(t(`configForCategory: ${e} exists in config, returning it`),o.get(e)):e.indexOf(".")>0?(t(`configForCategory: ${e} has hierarchy, searching for parents`),l(e.substring(0,e.lastIndexOf(".")))):(t("configForCategory: returning config for default category"),l("default")));e.exports=o,e.exports=Object.assign(e.exports,{appendersForCategory:e=>l(e).appenders,getLevelForCategory:e=>l(e).level,setLevelForCategory:(e,n)=>{let r=o.get(e);if(t(`setLevelForCategory: found ${r} for ${e}`),!r){const n=l(e);t(`setLevelForCategory: no config found for category, found ${n} for parents of ${e}`),r={appenders:n.appenders}}r.level=n,o.set(e,r)},getEnableCallStackForCategory:e=>!0===l(e).enableCallStack,setEnableCallStackForCategory:(e,t)=>{l(e).enableCallStack=t},init:a})}(wa);const Oa=Nr.exports("log4js:logger"),ba=Hu,_a=gu,Ba=eo,Pa=wa.exports,ka=tu,xa=/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/;function Na(e,t=4){const n=e.stack.split("\n").slice(t),r=xa.exec(n[0]);return r&&6===r.length?{functionName:r[1],fileName:r[2],lineNumber:parseInt(r[3],10),columnNumber:parseInt(r[4],10),callStack:n.join("\n")}:null}class Ia{constructor(e){if(!e)throw new Error("No category provided.");this.category=e,this.context={},this.parseCallStack=Na,Oa(`Logger created (${this.category}, ${this.level})`)}get level(){return _a.getLevel(Pa.getLevelForCategory(this.category),_a.TRACE)}set level(e){Pa.setLevelForCategory(this.category,_a.getLevel(e,this.level))}get useCallStack(){return Pa.getEnableCallStackForCategory(this.category)}set useCallStack(e){Pa.setEnableCallStackForCategory(this.category,!0===e)}log(e,...t){let n=_a.getLevel(e);n||(this._log(_a.WARN,"log4js:logger.log: invalid value for log-level as first parameter given: ",e),n=_a.INFO),this.isLevelEnabled(n)&&this._log(n,t)}isLevelEnabled(e){return this.level.isLessThanOrEqualTo(e)}_log(e,t){Oa(`sending log data (${e}) to appenders`);const n=new ba(this.category,e,t,this.context,this.useCallStack&&this.parseCallStack(new Error));Ba.send(n)}addContext(e,t){this.context[e]=t}removeContext(e){delete this.context[e]}clearContext(){this.context={}}setParseCallStackFunction(e){this.parseCallStack=e}}function Ta(e){const t=_a.getLevel(e),n=t.toString().toLowerCase().replace(/_([a-z])/g,(e=>e[1].toUpperCase())),r=n[0].toUpperCase()+n.slice(1);Ia.prototype[`is${r}Enabled`]=function(){return this.isLevelEnabled(t)},Ia.prototype[n]=function(...e){this.log(t,...e)}}_a.levels.forEach(Ta),ka.addListener((()=>{_a.levels.forEach(Ta)}));var Ra=Ia;const Ma=gu;function La(e){return e.originalUrl||e.url}function ja(e,t){for(let n=0;ne.source?e.source:e));t=new RegExp(n.join("|"))}return t}(t.nolog);return(e,i,s)=>{if(e._logging)return s();if(o&&o.test(e.originalUrl))return s();if(n.isLevelEnabled(r)||"auto"===t.level){const o=new Date,{writeHead:s}=i;e._logging=!0,i.writeHead=(e,t)=>{i.writeHead=s,i.writeHead(e,t),i.__statusCode=e,i.__headers=t||{}},i.on("finish",(()=>{i.responseTime=new Date-o,i.statusCode&&"auto"===t.level&&(r=Ma.INFO,i.statusCode>=300&&(r=Ma.WARN),i.statusCode>=400&&(r=Ma.ERROR)),r=function(e,t,n){let r=t;if(n){const t=n.find((t=>{let n=!1;return n=t.from&&t.to?e>=t.from&&e<=t.to:-1!==t.codes.indexOf(e),n}));t&&(r=Ma.getLevel(t.level,r))}return r}(i.statusCode,r,t.statusRules);const s=function(e,t,n){const r=[];return r.push({token:":url",replacement:La(e)}),r.push({token:":protocol",replacement:e.protocol}),r.push({token:":hostname",replacement:e.hostname}),r.push({token:":method",replacement:e.method}),r.push({token:":status",replacement:t.__statusCode||t.statusCode}),r.push({token:":response-time",replacement:t.responseTime}),r.push({token:":date",replacement:(new Date).toUTCString()}),r.push({token:":referrer",replacement:e.headers.referer||e.headers.referrer||""}),r.push({token:":http-version",replacement:`${e.httpVersionMajor}.${e.httpVersionMinor}`}),r.push({token:":remote-addr",replacement:e.headers["x-forwarded-for"]||e.ip||e._remoteAddress||e.socket&&(e.socket.remoteAddress||e.socket.socket&&e.socket.socket.remoteAddress)}),r.push({token:":user-agent",replacement:e.headers["user-agent"]}),r.push({token:":content-length",replacement:t.getHeader("content-length")||t.__headers&&t.__headers["Content-Length"]||"-"}),r.push({token:/:req\[([^\]]+)]/g,replacement:(t,n)=>e.headers[n.toLowerCase()]}),r.push({token:/:res\[([^\]]+)]/g,replacement:(e,n)=>t.getHeader(n.toLowerCase())||t.__headers&&t.__headers[n]}),(e=>{const t=e.concat();for(let e=0;eja(e,s)));t&&n.log(r,t)}else n.log(r,ja(u,s));t.context&&n.removeContext("res")}))}return s()}},nl=Va;let rl=!1;function ul(e){if(!rl)return;Ua("Received log event ",e);Za.appendersForCategory(e.categoryName).forEach((t=>{t(e)}))}function ol(e){rl&&il();let t=e;return"string"==typeof t&&(t=function(e){Ua(`Loading configuration from ${e}`);try{return JSON.parse(Wa.readFileSync(e,"utf8"))}catch(t){throw new Error(`Problem reading config from file "${e}". Error was ${t.message}`,t)}}(e)),Ua(`Configuration is ${t}`),Ka.configure(za(t)),el.onMessage(ul),rl=!0,sl}function il(e){Ua("Shutdown called. Disabling all log writing."),rl=!1;const t=Array.from(Xa.values());Xa.init(),Za.init();const n=t.reduceRight(((e,t)=>t.shutdown?e+1:e),0);if(0===n)return Ua("No appenders with shutdown functions found."),void 0!==e&&e();let r,u=0;function o(t){r=r||t,u+=1,Ua(`Appender shutdowns complete: ${u} / ${n}`),u>=n&&(Ua("All shutdown functions completed."),e&&e(r))}return Ua(`Found ${n} appenders with shutdown functions.`),t.filter((e=>e.shutdown)).forEach((e=>e.shutdown(o))),null}const sl={getLogger:function(e){return rl||ol(process.env.LOG4JS_CONFIG||{appenders:{out:{type:"stdout"}},categories:{default:{appenders:["out"],level:"OFF"}}}),new Qa(e||"default")},configure:ol,shutdown:il,connectLogger:tl,levels:Ya,addLayout:qa.addLayout,recording:function(){return nl}};var cl=sl,al={};Object.defineProperty(al,"__esModule",{value:!0}),al.levelMap=al.getLevel=al.setCategoriesLevel=al.getConfiguration=al.setConfiguration=void 0;const ll=cl;let fl={appenders:{debug:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %p %c %[%m%]"}},info:{type:"stdout",layout:{type:"pattern",pattern:"[%d] > hvigor %[%m%]"}},"no-pattern-info":{type:"stdout",layout:{type:"pattern",pattern:"%m"}},wrong:{type:"stderr",layout:{type:"pattern",pattern:"[%d] > hvigor %[%p: %m%]"}},"just-debug":{type:"logLevelFilter",appender:"debug",level:"debug",maxLevel:"debug"},"just-info":{type:"logLevelFilter",appender:"info",level:"info",maxLevel:"info"},"just-wrong":{type:"logLevelFilter",appender:"wrong",level:"warn",maxLevel:"error"}},categories:{default:{appenders:["just-debug","just-info","just-wrong"],level:"debug"},"no-pattern-info":{appenders:["no-pattern-info"],level:"info"}}};al.setConfiguration=e=>{fl=e};al.getConfiguration=()=>fl;let dl=ll.levels.DEBUG;al.setCategoriesLevel=(e,t)=>{dl=e;const n=fl.categories;for(const r in n)(null==t?void 0:t.includes(r))||Object.prototype.hasOwnProperty.call(n,r)&&(n[r].level=e.levelStr)};al.getLevel=()=>dl,al.levelMap=new Map([["ALL",ll.levels.ALL],["MARK",ll.levels.MARK],["TRACE",ll.levels.TRACE],["DEBUG",ll.levels.DEBUG],["INFO",ll.levels.INFO],["WARN",ll.levels.WARN],["ERROR",ll.levels.ERROR],["FATAL",ll.levels.FATAL],["OFF",ll.levels.OFF]]);var Dl=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),pl=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),El=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Dl(t,e,n);return pl(t,e),t};Object.defineProperty(xr,"__esModule",{value:!0}),xr.evaluateLogLevel=xr.HvigorLogger=void 0;const ml=El(cl),hl=cl,yl=El(F.default),Cl=al;class Fl{constructor(e){ml.configure((0,Cl.getConfiguration)()),this._logger=ml.getLogger(e),this._logger.level=(0,Cl.getLevel)()}static getLogger(e){return new Fl(e)}log(e,...t){this._logger.log(e,...t)}debug(e,...t){this._logger.debug(e,...t)}info(e,...t){this._logger.info(e,...t)}warn(e,...t){void 0!==e&&""!==e&&this._logger.warn(e,...t)}error(e,...t){this._logger.error(e,...t)}_printTaskExecuteInfo(e,t){this.info(`Finished :${e}... after ${t}`)}_printFailedTaskInfo(e){this.error(`Failed :${e}... `)}_printDisabledTaskInfo(e){this.info(`Disabled :${e}... `)}_printUpToDateTaskInfo(e){this.info(`UP-TO-DATE :${e}... `)}errorMessageExit(e,...t){throw new Error(yl.format(e,...t))}errorExit(e,t,...n){t&&this._logger.error(t,n),this._logger.error(e.stack)}setLevel(e,t){(0,Cl.setCategoriesLevel)(e,t),ml.shutdown(),ml.configure((0,Cl.getConfiguration)())}getLevel(){return this._logger.level}configure(e){const t=(0,Cl.getConfiguration)(),n={appenders:{...t.appenders,...e.appenders},categories:{...t.categories,...e.categories}};(0,Cl.setConfiguration)(n),ml.shutdown(),ml.configure(n)}}xr.HvigorLogger=Fl,xr.evaluateLogLevel=function(e,t){t.debug?e.setLevel(hl.levels.DEBUG):t.warn?e.setLevel(hl.levels.WARN):t.error?e.setLevel(hl.levels.ERROR):e.setLevel(hl.levels.INFO)};var gl=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.parseJsonText=X.parseJsonFile=void 0;const Al=Z,vl=gl(kr),Sl=gl(p.default),wl=gl(E.default),Ol=xr.HvigorLogger.getLogger("parse-json-util");var bl;!function(e){e[e.Char=0]="Char",e[e.EOF=1]="EOF",e[e.Identifier=2]="Identifier"}(bl||(bl={}));let _l,Bl,Pl,kl,xl,Nl,Il="start",Tl=[],Rl=0,Ml=1,Ll=0,jl=!1,$l="default",Hl="'",Jl=1;function Gl(e,t=!1){Bl=String(e),Il="start",Tl=[],Rl=0,Ml=1,Ll=0,kl=void 0,jl=t;do{_l=Vl(),Xl[Il]()}while("eof"!==_l.type);return kl}function Vl(){for($l="default",xl="",Hl="'",Jl=1;;){Nl=Ul();const e=zl[$l]();if(e)return e}}function Ul(){if(Bl[Rl])return String.fromCodePoint(Bl.codePointAt(Rl))}function Wl(){const e=Ul();return"\n"===e?(Ml++,Ll=0):e?Ll+=e.length:Ll++,e&&(Rl+=e.length),e}X.parseJsonFile=function(e,t=!1,n="utf-8"){const r=vl.default.readFileSync(Sl.default.resolve(e),{encoding:n});try{return Gl(r,t)}catch(t){if(t instanceof SyntaxError){const n=t.message.split("at");2===n.length&&Ol.errorMessageExit(`${n[0].trim()}${wl.default.EOL}\t at ${e}:${n[1].trim()}`)}Ol.errorMessageExit(`${e} is not in valid JSON/JSON5 format.`)}},X.parseJsonText=Gl;const zl={default(){switch(Nl){case"/":return Wl(),void($l="comment");case void 0:return Wl(),Kl("eof")}if(!Al.JudgeUtil.isIgnoreChar(Nl)&&!Al.JudgeUtil.isSpaceSeparator(Nl))return zl[Il]();Wl()},start(){$l="value"},beforePropertyName(){switch(Nl){case"$":case"_":return xl=Wl(),void($l="identifierName");case"\\":return Wl(),void($l="identifierNameStartEscape");case"}":return Kl("punctuator",Wl());case'"':case"'":return Hl=Nl,Wl(),void($l="string")}if(Al.JudgeUtil.isIdStartChar(Nl))return xl+=Wl(),void($l="identifierName");throw tf(bl.Char,Wl())},afterPropertyName(){if(":"===Nl)return Kl("punctuator",Wl());throw tf(bl.Char,Wl())},beforePropertyValue(){$l="value"},afterPropertyValue(){switch(Nl){case",":case"}":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},beforeArrayValue(){if("]"===Nl)return Kl("punctuator",Wl());$l="value"},afterArrayValue(){switch(Nl){case",":case"]":return Kl("punctuator",Wl())}throw tf(bl.Char,Wl())},end(){throw tf(bl.Char,Wl())},comment(){switch(Nl){case"*":return Wl(),void($l="multiLineComment");case"/":return Wl(),void($l="singleLineComment")}throw tf(bl.Char,Wl())},multiLineComment(){switch(Nl){case"*":return Wl(),void($l="multiLineCommentAsterisk");case void 0:throw tf(bl.Char,Wl())}Wl()},multiLineCommentAsterisk(){switch(Nl){case"*":return void Wl();case"/":return Wl(),void($l="default");case void 0:throw tf(bl.Char,Wl())}Wl(),$l="multiLineComment"},singleLineComment(){switch(Nl){case"\n":case"\r":case"\u2028":case"\u2029":return Wl(),void($l="default");case void 0:return Wl(),Kl("eof")}Wl()},value(){switch(Nl){case"{":case"[":return Kl("punctuator",Wl());case"n":return Wl(),ql("ull"),Kl("null",null);case"t":return Wl(),ql("rue"),Kl("boolean",!0);case"f":return Wl(),ql("alse"),Kl("boolean",!1);case"-":case"+":return"-"===Wl()&&(Jl=-1),void($l="numerical");case".":case"0":case"I":case"N":return void($l="numerical");case'"':case"'":return Hl=Nl,Wl(),xl="",void($l="string")}if(void 0===Nl||!Al.JudgeUtil.isDigitWithoutZero(Nl))throw tf(bl.Char,Wl());$l="numerical"},numerical(){switch(Nl){case".":return xl=Wl(),void($l="decimalPointLeading");case"0":return xl=Wl(),void($l="zero");case"I":return Wl(),ql("nfinity"),Kl("numeric",Jl*(1/0));case"N":return Wl(),ql("aN"),Kl("numeric",NaN)}if(void 0!==Nl&&Al.JudgeUtil.isDigitWithoutZero(Nl))return xl=Wl(),void($l="decimalInteger");throw tf(bl.Char,Wl())},zero(){switch(Nl){case".":case"e":case"E":return void($l="decimal");case"x":case"X":return xl+=Wl(),void($l="hexadecimal")}return Kl("numeric",0)},decimalInteger(){switch(Nl){case".":case"e":case"E":return void($l="decimal")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimal(){switch(Nl){case".":xl+=Wl(),$l="decimalFraction";break;case"e":case"E":xl+=Wl(),$l="decimalExponent"}},decimalPointLeading(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalFraction");throw tf(bl.Char,Wl())},decimalFraction(){switch(Nl){case"e":case"E":return xl+=Wl(),void($l="decimalExponent")}if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},decimalExponent(){switch(Nl){case"+":case"-":return xl+=Wl(),void($l="decimalExponentSign")}if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentSign(){if(Al.JudgeUtil.isDigit(Nl))return xl+=Wl(),void($l="decimalExponentInteger");throw tf(bl.Char,Wl())},decimalExponentInteger(){if(!Al.JudgeUtil.isDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},hexadecimal(){if(Al.JudgeUtil.isHexDigit(Nl))return xl+=Wl(),void($l="hexadecimalInteger");throw tf(bl.Char,Wl())},hexadecimalInteger(){if(!Al.JudgeUtil.isHexDigit(Nl))return Kl("numeric",Jl*Number(xl));xl+=Wl()},identifierNameStartEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":break;default:if(!Al.JudgeUtil.isIdStartChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},identifierName(){switch(Nl){case"$":case"_":case"‌":case"‍":return void(xl+=Wl());case"\\":return Wl(),void($l="identifierNameEscape")}if(!Al.JudgeUtil.isIdContinueChar(Nl))return Kl("identifier",xl);xl+=Wl()},identifierNameEscape(){if("u"!==Nl)throw tf(bl.Char,Wl());Wl();const e=Yl();switch(e){case"$":case"_":case"‌":case"‍":break;default:if(!Al.JudgeUtil.isIdContinueChar(e))throw tf(bl.Identifier)}xl+=e,$l="identifierName"},string(){switch(Nl){case"\\":return Wl(),void(xl+=function(){const e=Ul(),t=function(){switch(Ul()){case"b":return Wl(),"\b";case"f":return Wl(),"\f";case"n":return Wl(),"\n";case"r":return Wl(),"\r";case"t":return Wl(),"\t";case"v":return Wl(),"\v"}return}();if(t)return t;switch(e){case"0":if(Wl(),Al.JudgeUtil.isDigit(Ul()))throw tf(bl.Char,Wl());return"\0";case"x":return Wl(),function(){let e="",t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());if(e+=Wl(),t=Ul(),!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());return e+=Wl(),String.fromCodePoint(parseInt(e,16))}();case"u":return Wl(),Yl();case"\n":case"\u2028":case"\u2029":return Wl(),"";case"\r":return Wl(),"\n"===Ul()&&Wl(),""}if(void 0===e||Al.JudgeUtil.isDigitWithoutZero(e))throw tf(bl.Char,Wl());return Wl()}());case'"':case"'":if(Nl===Hl){const e=Kl("string",xl);return Wl(),e}return void(xl+=Wl());case"\n":case"\r":case void 0:throw tf(bl.Char,Wl());case"\u2028":case"\u2029":!function(e){Ol.warn(`JSON5: '${ef(e)}' in strings is not valid ECMAScript; consider escaping.`)}(Nl)}xl+=Wl()}};function Kl(e,t){return{type:e,value:t,line:Ml,column:Ll}}function ql(e){for(const t of e){if(Ul()!==t)throw tf(bl.Char,Wl());Wl()}}function Yl(){let e="",t=4;for(;t-- >0;){const t=Ul();if(!Al.JudgeUtil.isHexDigit(t))throw tf(bl.Char,Wl());e+=Wl()}return String.fromCodePoint(parseInt(e,16))}const Xl={start(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},beforePropertyName(){switch(_l.type){case"identifier":case"string":return Pl=_l.value,void(Il="afterPropertyName");case"punctuator":return void Ql();case"eof":throw tf(bl.EOF)}},afterPropertyName(){if("eof"===_l.type)throw tf(bl.EOF);Il="beforePropertyValue"},beforePropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);Zl()},afterPropertyValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforePropertyName");case"}":Ql()}},beforeArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);"punctuator"!==_l.type||"]"!==_l.value?Zl():Ql()},afterArrayValue(){if("eof"===_l.type)throw tf(bl.EOF);switch(_l.value){case",":return void(Il="beforeArrayValue");case"]":Ql()}},end(){}};function Zl(){const e=function(){let e;switch(_l.type){case"punctuator":switch(_l.value){case"{":e={};break;case"[":e=[]}break;case"null":case"boolean":case"numeric":case"string":e=_l.value}return e}();if(jl&&"object"==typeof e&&(e._line=Ml,e._column=Ll),void 0===kl)kl=e;else{const t=Tl[Tl.length-1];Array.isArray(t)?jl&&"object"!=typeof e?t.push({value:e,_line:Ml,_column:Ll}):t.push(e):t[Pl]=jl&&"object"!=typeof e?{value:e,_line:Ml,_column:Ll}:e}!function(e){if(e&&"object"==typeof e)Tl.push(e),Il=Array.isArray(e)?"beforeArrayValue":"beforePropertyName";else{const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}}(e)}function Ql(){Tl.pop();const e=Tl[Tl.length-1];Il=e?Array.isArray(e)?"afterArrayValue":"afterPropertyValue":"end"}function ef(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const t=e.charCodeAt(0).toString(16);return`\\x${`00${t}`.substring(t.length)}`}return e}function tf(e,t){let n="";switch(e){case bl.Char:n=void 0===t?`JSON5: invalid end of input at ${Ml}:${Ll}`:`JSON5: invalid character '${ef(t)}' at ${Ml}:${Ll}`;break;case bl.EOF:n=`JSON5: invalid end of input at ${Ml}:${Ll}`;break;case bl.Identifier:Ll-=5,n=`JSON5: invalid identifier character at ${Ml}:${Ll}`}const r=new nf(n);return r.lineNumber=Ml,r.columnNumber=Ll,r}class nf extends SyntaxError{}var rf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),uf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&rf(t,e,n);return uf(t,e),t};Object.defineProperty(Y,"__esModule",{value:!0});var sf=Y.cleanWorkSpace=Ff=Y.executeInstallHvigor=yf=Y.isHvigorInstalled=mf=Y.isAllDependenciesInstalled=void 0;const cf=of(D.default),af=of(p.default),lf=b,ff=j,df=$,Df=X;let pf,Ef;var mf=Y.isAllDependenciesInstalled=function(){function e(e){const t=null==e?void 0:e.dependencies;return void 0===t?0:Object.getOwnPropertyNames(t).length}if(pf=gf(),Ef=Af(),e(pf)+1!==e(Ef))return!1;for(const e in null==pf?void 0:pf.dependencies)if(!(0,ff.hasNpmPackInPaths)(e,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])||!hf(e,pf,Ef))return!1;return!0};function hf(e,t,n){return void 0!==n.dependencies&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,t.dependencies[e])===n.dependencies[e]}var yf=Y.isHvigorInstalled=function(){return pf=gf(),Ef=Af(),(0,ff.hasNpmPackInPaths)(lf.HVIGOR_ENGINE_PACKAGE_NAME,[lf.HVIGOR_PROJECT_DEPENDENCIES_HOME])&&(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion)===Ef.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]};const Cf={cwd:lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,stdio:["inherit","inherit","inherit"]};var Ff=Y.executeInstallHvigor=function(){(0,df.logInfoPrintConsole)("Hvigor installing...");const e={dependencies:{}};e.dependencies[lf.HVIGOR_ENGINE_PACKAGE_NAME]=(0,ff.offlinePluginConversion)(lf.HVIGOR_PROJECT_ROOT_DIR,pf.hvigorVersion);try{cf.mkdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,{recursive:!0});const t=af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,lf.DEFAULT_PACKAGE_JSON);cf.writeFileSync(t,JSON.stringify(e))}catch(e){(0,df.logErrorAndExit)(e)}!function(){const e=["config","set","store-dir",lf.HVIGOR_PNPM_STORE_PATH];(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,e,Cf)}(),(0,ff.executeCommand)(lf.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,["install"],Cf)};function gf(){const e=af.resolve(lf.HVIGOR_PROJECT_WRAPPER_HOME,lf.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);return cf.existsSync(e)||(0,df.logErrorAndExit)(`Error: Hvigor config file ${e} does not exist.`),(0,Df.parseJsonFile)(e)}function Af(){return cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH)?(0,Df.parseJsonFile)(lf.HVIGOR_PROJECT_DEPENDENCY_PACKAGE_JSON_PATH):{dependencies:{}}}sf=Y.cleanWorkSpace=function(){if((0,df.logInfoPrintConsole)("Hvigor cleaning..."),!cf.existsSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME))return;const e=cf.readdirSync(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME);if(e&&0!==e.length){cf.existsSync(lf.HVIGOR_BOOT_JS_FILE_PATH)&&(0,ff.executeCommand)(process.argv[0],[lf.HVIGOR_BOOT_JS_FILE_PATH,"--stop-daemon"],{});try{e.forEach((e=>{cf.rmSync(af.resolve(lf.HVIGOR_PROJECT_DEPENDENCIES_HOME,e),{recursive:!0})}))}catch(e){(0,df.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${lf.HVIGOR_PROJECT_DEPENDENCIES_HOME}.`)}}};var vf={},Sf=w&&w.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var u=Object.getOwnPropertyDescriptor(t,n);u&&!("get"in u?!t.__esModule:u.writable||u.configurable)||(u={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,u)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),wf=w&&w.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Of=w&&w.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Sf(t,e,n);return wf(t,e),t};Object.defineProperty(vf,"__esModule",{value:!0});var bf=vf.executeBuild=void 0;const _f=b,Bf=Of(D.default),Pf=Of(p.default),kf=$;bf=vf.executeBuild=function(){const e=Pf.resolve(_f.HVIGOR_PROJECT_DEPENDENCIES_HOME,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const t=Bf.realpathSync(e);require(t)}catch(t){(0,kf.logErrorAndExit)(`Error: ENOENT: no such file ${e},delete ${_f.HVIGOR_PROJECT_DEPENDENCIES_HOME} and retry.`)}},function(){if(O.checkNpmConifg(),O.environmentHandler(),O.isPnpmAvailable()||O.executeInstallPnpm(),yf()&&mf())bf();else{sf();try{Ff()}catch(e){return void sf()}bf()}}(); \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/hvigorfile.ts b/scenario/arkui/arkui_capi_demo/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..6478186902c0c1ad7c966a929c7d6b7d8ae7a9f3 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { appTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/hvigorw b/scenario/arkui/arkui_capi_demo/hvigorw new file mode 100644 index 0000000000000000000000000000000000000000..54aadd226b453397860013d328fd01031648fc31 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/hvigorw @@ -0,0 +1,48 @@ +#!/bin/bash + +# ---------------------------------------------------------------------------- +# Hvigor startup script, version 1.0.0 +# +# Required ENV vars: +# ------------------ +# NODE_HOME - location of a Node home dir +# or +# Add /usr/local/nodejs/bin to the PATH environment variable +# ---------------------------------------------------------------------------- + +HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) +HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js +warn() { + echo "" + echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +error() { + echo "" + echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +fail() { + error "$@" + exit 1 +} + +# Determine node to start hvigor wrapper script +if [ -n "${NODE_HOME}" ];then + EXECUTABLE_NODE="${NODE_HOME}/bin/node" + if [ ! -x "$EXECUTABLE_NODE" ];then + fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" + fi +else + EXECUTABLE_NODE="node" + which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" +fi + +# Check hvigor wrapper script +if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then + fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" +fi + +# start hvigor-wrapper script +exec "${EXECUTABLE_NODE}" \ + "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/scenario/arkui/arkui_capi_demo/hvigorw.bat b/scenario/arkui/arkui_capi_demo/hvigorw.bat new file mode 100644 index 0000000000000000000000000000000000000000..6861293e47dfd0186da380321b73be9033507e24 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/hvigorw.bat @@ -0,0 +1,64 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Hvigor startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js +set NODE_EXE=node.exe + +goto start + +:start +@rem Find node.exe +if defined NODE_HOME goto findNodeFromNodeHome + +%NODE_EXE% --version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:findNodeFromNodeHome +set NODE_HOME=%NODE_HOME:"=% +set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% + +if exist "%NODE_EXE_PATH%" goto execute +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:execute +@rem Execute hvigor +"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* + +if "%ERRORLEVEL%" == "0" goto hvigorwEnd + +:fail +exit /b 1 + +:hvigorwEnd +if "%OS%" == "Windows_NT" endlocal + +:end diff --git a/scenario/arkui/arkui_capi_demo/log.txt b/scenario/arkui/arkui_capi_demo/log.txt new file mode 100644 index 0000000000000000000000000000000000000000..c30becbf3cf835fb939a2032089d1445f7774299 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/log.txt differ diff --git a/scenario/arkui/arkui_capi_demo/oh-package-lock.json5 b/scenario/arkui/arkui_capi_demo/oh-package-lock.json5 new file mode 100644 index 0000000000000000000000000000000000000000..bc40219d5aa573d750a40c2948a91e8bc9a36abc --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/oh-package-lock.json5 @@ -0,0 +1,13 @@ +{ + "lockfileVersion": 1, + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", + "specifiers": { + "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6" + }, + "packages": { + "@ohos/hypium@1.0.6": { + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", + "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==" + } + } +} \ No newline at end of file diff --git a/scenario/arkui/arkui_capi_demo/oh-package.json5 b/scenario/arkui/arkui_capi_demo/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..4cfc1d91530a8c7871495a1becdeb4b56de63710 --- /dev/null +++ b/scenario/arkui/arkui_capi_demo/oh-package.json5 @@ -0,0 +1,12 @@ +{ + "license": "", + "devDependencies": { + "@ohos/hypium": "1.0.6" + }, + "author": "", + "name": "arkui_capi_demo", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dependencies": {} +} diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a9bf74043d881f5552c059b73fee3bac5409057 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4bdc116f014cfd3b3570335a28c1d3993c3294aa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonFontColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonFontColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a7a5ab32c50ffd3470decc094bd67097f3ba3aa5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonFontColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonFontSize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonFontSize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4251071c1982c2a34a3f3cde1403cb3c78a83a8a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonFontSize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonFontWeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonFontWeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f19515eb59053599ccc3a9253bf872856205940a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonFontWeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonOnClick001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonOnClick001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d4edb107f07d43b3c618e6df90ee6f7954bf3c60 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonOnClick001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonOnClick002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonOnClick002.webp new file mode 100644 index 0000000000000000000000000000000000000000..22923f1297f08c28559f991f839583a1d1d94e58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testButtonOnClick002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7a4cd78458f1ec9dd37407bcdd8fee7f42ee8977 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8a5361be4940a3cb61107cd81e2d5ab401720cab Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign003.webp new file mode 100644 index 0000000000000000000000000000000000000000..a21907664a87b3f66e381e1b75e24dd632d11f56 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign004.webp new file mode 100644 index 0000000000000000000000000000000000000000..6696a5a95c79572346b4c5efc4f979d4b4152da5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEdgeAlign004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEnabled001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEnabled001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cd2d1e00e77d0ffaf0e0b321b95db4a1b67ad808 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEnabled001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEnabled002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEnabled002.webp new file mode 100644 index 0000000000000000000000000000000000000000..99ffaa5d13a5a98b7d0798587c3efa198fcbb682 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEnabled002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEnabled003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEnabled003.webp new file mode 100644 index 0000000000000000000000000000000000000000..4a7680fb665265668ee1aacb2a60bb3ca60826b4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerEnabled003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerOnChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerOnChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c6e8d30a7f5d0b9df939fd744ae88acf0bdba7ed Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerOnChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerOnChange002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerOnChange002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6de769821c3f8de7f2e34c580f65b6546a512a65 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerOnChange002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerTextStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerTextStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cc4939c588243050a29904793523cb3d1d5bd6d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerTextStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..808e796254948a17daa415b7fc69eb742cc66ed0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a4c3f7411c4e27d8133289a63b20f62337dfc35b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCalendarPickerWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ecdce288e51b512fa3619f424a6e5619548a3bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxEnabled001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxEnabled001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6dca7cc176e96a03cac1ddc7ba4ab311894e636f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxEnabled001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxEnabled002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxEnabled002.webp new file mode 100644 index 0000000000000000000000000000000000000000..16321563771c033d39d5a2f559f4bf329ddb666b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxEnabled002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxEnabled003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxEnabled003.webp new file mode 100644 index 0000000000000000000000000000000000000000..685672249a3cbf4362cf2ca5bb04f599e1be0dd6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxEnabled003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c310278ea53763756d848a0a19ab880b4f488466 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..4ce37360f5da3e57e842874ce7f9586e952be347 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxMark001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxMark001.webp new file mode 100644 index 0000000000000000000000000000000000000000..fa5d7cad7d1f31196ab95e043189dae265e9579c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxMark001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxOnChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxOnChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..26fb78bdc8427b0f844eb0ef52a26fbc779a5910 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxOnChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxSelect001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxSelect001.webp new file mode 100644 index 0000000000000000000000000000000000000000..197d79c6b942c3956d90c4e655ade32a9fad638c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxSelect001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxSelectedColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxSelectedColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..aeb58a567e2c1e6c7452515a7dabbc6988bcada8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxSelectedColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxShape001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxShape001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cd603ad6c482eaf16be5ad9ff3ad2619aac0b7b4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxShape001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxUnselectedColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxUnselectedColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..8497f1d6b6ba40f63c232b3f525b241bc9d1dcb3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxUnselectedColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a48b1a9232adec299561f844a5544a852517e2af Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..fb283d98373bb7ecf3c51c72ea888233c069bbdb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCheckboxWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnForegroundBlurStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnForegroundBlurStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c5b1fed59f4c0d3eb7caa8d295fbaa3a2c515206 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnForegroundBlurStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..031e727365760f84f4abd36473e9fca64fa849de Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32a7126611d68cc2ac879c3e70dfbaaf7d796de9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnPadding001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnPadding001.webp new file mode 100644 index 0000000000000000000000000000000000000000..63838ea170440bd7bc8c548ffb4b4d052e9c243d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnPadding001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f40489da818eaffa5eb7eb55705f4f32782f2cee Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..4af450fee9f4e6c219091830de3fcf3eee8e001c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testColumnWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlign001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlign001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f0e360b5d4538ae895635355e5e2268ff16a0985 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlign001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent001.webp new file mode 100644 index 0000000000000000000000000000000000000000..457646ccd9459b37fb16c00c93598c08fc54f723 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent002.webp new file mode 100644 index 0000000000000000000000000000000000000000..331f41ec9bd05928f27ac848f7841c2dfff54ce7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent003.webp new file mode 100644 index 0000000000000000000000000000000000000000..cfd876c17a8a8c5dd9e870158b68ce5c3215ca23 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent004.webp new file mode 100644 index 0000000000000000000000000000000000000000..e74824705a04c1a5141f3544167aebb923a01d01 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent005.webp new file mode 100644 index 0000000000000000000000000000000000000000..79e3373d0a674bdcc733f59d9c23bbb9c70bb8e7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent006.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad1a3b3e499f97aea206a57e3e2562816d084895 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent007.webp new file mode 100644 index 0000000000000000000000000000000000000000..e180bf913d2db68ed64d7511415fc728f2023c11 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent008.webp new file mode 100644 index 0000000000000000000000000000000000000000..aee179931a92adbb91772a65568b23b6b23c1f1d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent009.webp new file mode 100644 index 0000000000000000000000000000000000000000..b317ad6f427cd6ade60abdd08c1b7e7ecf3c5bcf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignContent009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems001.webp new file mode 100644 index 0000000000000000000000000000000000000000..377f1869cf14c63fdd7aa8bc03f63c018ee7beaf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems002.webp new file mode 100644 index 0000000000000000000000000000000000000000..e42c85b167cf6adfaacb2eff2f36d9da12f12827 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems003.webp new file mode 100644 index 0000000000000000000000000000000000000000..d9e3073e0544a998875c4e127ebd78ac455ae44b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems004.webp new file mode 100644 index 0000000000000000000000000000000000000000..7744302781f2935600245fe7e429662e6a9f0cfc Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems005.webp new file mode 100644 index 0000000000000000000000000000000000000000..59705ed84183caf7e2be3a0cf5d0b0dab0ccca0b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems006.webp new file mode 100644 index 0000000000000000000000000000000000000000..092c7c4f1a95324817fdb1e046a006d983e4e532 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignItems006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d533731f6c9fc680e67c70ff6fa73ef9fccf5ef9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2fb02d451938477cbb2be6ae4b6e3ede25a382fa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf003.webp new file mode 100644 index 0000000000000000000000000000000000000000..1485fbe425b33d7c954cafbc4e778a60240529bd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf004.webp new file mode 100644 index 0000000000000000000000000000000000000000..60f16395d0c15b1b515ac1c3298921bc3b02f557 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf005.webp new file mode 100644 index 0000000000000000000000000000000000000000..d416c7ee0caf1ea426fb0e0b816ee8053650157d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf006.webp new file mode 100644 index 0000000000000000000000000000000000000000..ce2d1198d0ec58a6c2adcb326e9d351dae310f7c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf007.webp new file mode 100644 index 0000000000000000000000000000000000000000..d533731f6c9fc680e67c70ff6fa73ef9fccf5ef9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf008.webp new file mode 100644 index 0000000000000000000000000000000000000000..2fb02d451938477cbb2be6ae4b6e3ede25a382fa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf009.webp new file mode 100644 index 0000000000000000000000000000000000000000..1485fbe425b33d7c954cafbc4e778a60240529bd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf010.webp new file mode 100644 index 0000000000000000000000000000000000000000..60f16395d0c15b1b515ac1c3298921bc3b02f557 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf011.webp new file mode 100644 index 0000000000000000000000000000000000000000..d416c7ee0caf1ea426fb0e0b816ee8053650157d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf012.webp new file mode 100644 index 0000000000000000000000000000000000000000..ce2d1198d0ec58a6c2adcb326e9d351dae310f7c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf013.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf013.webp new file mode 100644 index 0000000000000000000000000000000000000000..d533731f6c9fc680e67c70ff6fa73ef9fccf5ef9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf013.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf014.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf014.webp new file mode 100644 index 0000000000000000000000000000000000000000..2fb02d451938477cbb2be6ae4b6e3ede25a382fa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf014.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf015.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf015.webp new file mode 100644 index 0000000000000000000000000000000000000000..1485fbe425b33d7c954cafbc4e778a60240529bd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf015.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf016.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf016.webp new file mode 100644 index 0000000000000000000000000000000000000000..60f16395d0c15b1b515ac1c3298921bc3b02f557 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf016.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf017.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf017.webp new file mode 100644 index 0000000000000000000000000000000000000000..d416c7ee0caf1ea426fb0e0b816ee8053650157d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf017.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf018.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf018.webp new file mode 100644 index 0000000000000000000000000000000000000000..ce2d1198d0ec58a6c2adcb326e9d351dae310f7c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf018.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf019.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf019.webp new file mode 100644 index 0000000000000000000000000000000000000000..d533731f6c9fc680e67c70ff6fa73ef9fccf5ef9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf019.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf020.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf020.webp new file mode 100644 index 0000000000000000000000000000000000000000..2fb02d451938477cbb2be6ae4b6e3ede25a382fa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf020.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf021.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf021.webp new file mode 100644 index 0000000000000000000000000000000000000000..1485fbe425b33d7c954cafbc4e778a60240529bd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf021.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf022.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf022.webp new file mode 100644 index 0000000000000000000000000000000000000000..60f16395d0c15b1b515ac1c3298921bc3b02f557 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf022.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf023.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf023.webp new file mode 100644 index 0000000000000000000000000000000000000000..d416c7ee0caf1ea426fb0e0b816ee8053650157d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf023.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf024.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf024.webp new file mode 100644 index 0000000000000000000000000000000000000000..ce2d1198d0ec58a6c2adcb326e9d351dae310f7c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf024.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf025.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf025.webp new file mode 100644 index 0000000000000000000000000000000000000000..d533731f6c9fc680e67c70ff6fa73ef9fccf5ef9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf025.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf026.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf026.webp new file mode 100644 index 0000000000000000000000000000000000000000..2fb02d451938477cbb2be6ae4b6e3ede25a382fa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf026.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf027.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf027.webp new file mode 100644 index 0000000000000000000000000000000000000000..1485fbe425b33d7c954cafbc4e778a60240529bd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf027.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf028.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf028.webp new file mode 100644 index 0000000000000000000000000000000000000000..60f16395d0c15b1b515ac1c3298921bc3b02f557 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf028.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf029.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf029.webp new file mode 100644 index 0000000000000000000000000000000000000000..d416c7ee0caf1ea426fb0e0b816ee8053650157d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf029.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf030.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf030.webp new file mode 100644 index 0000000000000000000000000000000000000000..ce2d1198d0ec58a6c2adcb326e9d351dae310f7c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf030.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf031.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf031.webp new file mode 100644 index 0000000000000000000000000000000000000000..d533731f6c9fc680e67c70ff6fa73ef9fccf5ef9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf031.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf032.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf032.webp new file mode 100644 index 0000000000000000000000000000000000000000..2fb02d451938477cbb2be6ae4b6e3ede25a382fa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf032.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf033.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf033.webp new file mode 100644 index 0000000000000000000000000000000000000000..1485fbe425b33d7c954cafbc4e778a60240529bd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf033.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf034.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf034.webp new file mode 100644 index 0000000000000000000000000000000000000000..60f16395d0c15b1b515ac1c3298921bc3b02f557 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf034.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf035.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf035.webp new file mode 100644 index 0000000000000000000000000000000000000000..d416c7ee0caf1ea426fb0e0b816ee8053650157d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf035.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf036.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf036.webp new file mode 100644 index 0000000000000000000000000000000000000000..ce2d1198d0ec58a6c2adcb326e9d351dae310f7c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsAlignSelf036.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..29abc68257aefc5c64e9cfad00c72303e641b922 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBlendMode001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBlendMode001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d24513873208c388d3f01bbc192133f7707d61c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBlendMode001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..8efd16a1f4d78c26636a26536e84a1bd5a419b0a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderRadius001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderRadius001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5c8aebe78ec4f77837f5ba936c59a4239f9eea74 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderRadius001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..291804c4942dddcbc4c9e543fceb18a693c03faf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..28e1a8a69fae61038f360d853ed1ed38796636cc Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsBorderWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1c5f0e95a3580e5832347dd73483ac8f022adb1e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip002.webp new file mode 100644 index 0000000000000000000000000000000000000000..183aaefdb77fe7db94a86defc4fddb6d79080d08 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip003.webp new file mode 100644 index 0000000000000000000000000000000000000000..f05346cbf8cbd67bf85fe6aee44dafe2a7f8f3eb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip004.webp new file mode 100644 index 0000000000000000000000000000000000000000..3998cb19c50582844d2ce30b41dd6b226b4c2963 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsClip004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..69d79f3b92bd54811198a3656809cf264dce2daf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a5ad94c252ffa9445a5adbf1b6e8897e6e8a3119 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize003.webp new file mode 100644 index 0000000000000000000000000000000000000000..d4a6f625d814467ab5e9367989818ee7c9bccbd2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize004.webp new file mode 100644 index 0000000000000000000000000000000000000000..a5ad94c252ffa9445a5adbf1b6e8897e6e8a3119 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize005.webp new file mode 100644 index 0000000000000000000000000000000000000000..4bed93aba31b971fa872f4d3d179d6760d3b25e0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize006.webp new file mode 100644 index 0000000000000000000000000000000000000000..d4a6f625d814467ab5e9367989818ee7c9bccbd2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsConstraintSize006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsContrast001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsContrast001.webp new file mode 100644 index 0000000000000000000000000000000000000000..65184544b500afc42b5821fb0946f48e22ef8482 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsContrast001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsDirection001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsDirection001.webp new file mode 100644 index 0000000000000000000000000000000000000000..94690f16e0f856e28b9689fb149c447ba866d26f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsDirection001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsEnabled001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsEnabled001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2db55e5735b3954ebc801a6f208ad8ab61a288e3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsEnabled001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsEnabled002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsEnabled002.webp new file mode 100644 index 0000000000000000000000000000000000000000..77d67f5abeb8e42b013d9b67f755350fdb834e6d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsEnabled002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a0019414fad56e54890291ac1831ec06efd0c4fc Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis002.webp new file mode 100644 index 0000000000000000000000000000000000000000..162aa2124f6286d31ede6a615320f685c3edc5e4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis003.webp new file mode 100644 index 0000000000000000000000000000000000000000..29d56259bc10b28227ba5a5d5e210ce1e19edc95 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis004.webp new file mode 100644 index 0000000000000000000000000000000000000000..d9b0fe9924dd069bcbbb83545a29ef4797ffd744 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis005.webp new file mode 100644 index 0000000000000000000000000000000000000000..25f14ec6618d955f5c0ace3059ef554f51856411 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis006.webp new file mode 100644 index 0000000000000000000000000000000000000000..21361419ae8a83a1753d93b1b4b6737abf529ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexBasis006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..99a408dc6d0ce0b295d7a2448ff2ab45cf6a22a7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow002.webp new file mode 100644 index 0000000000000000000000000000000000000000..79c0ccb8d40de4d59440d9c2e684cecc33c84bf0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c8ea0504d8c163ae3af98a6f211482322b4de67c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow004.webp new file mode 100644 index 0000000000000000000000000000000000000000..31366d7816a4f27c5b13da6657c097e1352fc332 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow005.webp new file mode 100644 index 0000000000000000000000000000000000000000..75131b025eda88c97fd788f873b0c6f9b10ea0c1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow006.webp new file mode 100644 index 0000000000000000000000000000000000000000..903c29d954e92250a300c81eccdb86a88c963875 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexGrow006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4b145f2a57ac0151862f99392239e1ad798f47fe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink002.webp new file mode 100644 index 0000000000000000000000000000000000000000..e2e1ee612417312fa001699e8742a1eb705d8514 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink003.webp new file mode 100644 index 0000000000000000000000000000000000000000..e8778b47b273f86967509c953575141dec9d9703 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink004.webp new file mode 100644 index 0000000000000000000000000000000000000000..e134c289e688c7d25d8de2e07f7ea7a30f16be84 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink005.webp new file mode 100644 index 0000000000000000000000000000000000000000..13d4de4eb43eb427609a3e258285d74121d7bda8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink006.webp new file mode 100644 index 0000000000000000000000000000000000000000..99ffa013e68c0f1caa629ea8c7d2f87ed9231075 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFlexShrink006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFocusable001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFocusable001.webp new file mode 100644 index 0000000000000000000000000000000000000000..00d1d730d027445e535d2d54b18d60681efca732 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFocusable001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFocusable002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFocusable002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6f139d64d4c680f2a671bd6c51532e9bcc85ccf2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFocusable002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFocusable003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFocusable003.webp new file mode 100644 index 0000000000000000000000000000000000000000..110f2e79e6349f8cdfc202fc05e9ed72dbedb423 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsFocusable003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsForegroundBlurStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsForegroundBlurStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c5b1fed59f4c0d3eb7caa8d295fbaa3a2c515206 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsForegroundBlurStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsGrayscale001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsGrayscale001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cb8e5c6e84e66c5c15cea1294feb39923329dcc7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsGrayscale001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1989aafb135a2e06e8ecb997ef2bed0688197a6d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsHitTestBehavior001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsHitTestBehavior001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2aaf651fbaf0b7caeb22bdb83837991ddafe86d5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsHitTestBehavior001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsId001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsId001.webp new file mode 100644 index 0000000000000000000000000000000000000000..46ed035db86bdbacbde19645e130886171903387 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsId001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsInvert001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsInvert001.webp new file mode 100644 index 0000000000000000000000000000000000000000..477963e588c5e07a8eb71fd18b2c53fa97f5a2ab Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsInvert001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e42c85b167cf6adfaacb2eff2f36d9da12f12827 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent002.webp new file mode 100644 index 0000000000000000000000000000000000000000..697693b236d72e4593850e5d75a7eca6cd468050 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent003.webp new file mode 100644 index 0000000000000000000000000000000000000000..43ec4dec6a8946383f313a95a00c3e373c1d15ca Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent004.webp new file mode 100644 index 0000000000000000000000000000000000000000..58359eef205e22fea18485d3a69d0a91eb746e31 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent005.webp new file mode 100644 index 0000000000000000000000000000000000000000..87afb317dd6c50522e1a6f63c0790671872ab709 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent006.webp new file mode 100644 index 0000000000000000000000000000000000000000..84b714d57e90b6c4d55d5774f34bde215a621d54 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent007.webp new file mode 100644 index 0000000000000000000000000000000000000000..59705ed84183caf7e2be3a0cf5d0b0dab0ccca0b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent008.webp new file mode 100644 index 0000000000000000000000000000000000000000..5c573e4900705dcb87578ec27f7c6da0452d8f35 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent009.webp new file mode 100644 index 0000000000000000000000000000000000000000..7bc3fc6bde78d2fdce335e9cdbee44a4f9f0cfa7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent010.webp new file mode 100644 index 0000000000000000000000000000000000000000..eabc152a8a32b2f8959f6440896b57e3e41db278 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent011.webp new file mode 100644 index 0000000000000000000000000000000000000000..850996b9b12a7a066569e5b6544638fc655b76ca Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent012.webp new file mode 100644 index 0000000000000000000000000000000000000000..15c757c22461a0d900c0099790af50c807f50c73 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsJustifyContent012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..125823694717d5046df77a01874c774068b5ee07 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient002.webp new file mode 100644 index 0000000000000000000000000000000000000000..578d847ee4a14876f88340318f7e2d9e2db86bd5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient003.webp new file mode 100644 index 0000000000000000000000000000000000000000..47a5c8e04812288c672a6c2219c3cee86a02342b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient004.webp new file mode 100644 index 0000000000000000000000000000000000000000..5385a15d6d7ac64e9d251fa2044fa3adc5bf359f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient005.webp new file mode 100644 index 0000000000000000000000000000000000000000..f0e12db4bdb93408be77d5fd0e6cc1047af77b2b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient006.webp new file mode 100644 index 0000000000000000000000000000000000000000..d0b7befe3e3388f4fc8d5ed209567646cff1ad0a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient007.webp new file mode 100644 index 0000000000000000000000000000000000000000..8adfe20f956aead17b125859223aeb3e9c096e8b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient008.webp new file mode 100644 index 0000000000000000000000000000000000000000..44cbec05176f525a567efbc1b94e772be6c6c741 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient009.webp new file mode 100644 index 0000000000000000000000000000000000000000..5385a15d6d7ac64e9d251fa2044fa3adc5bf359f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient010.webp new file mode 100644 index 0000000000000000000000000000000000000000..5385a15d6d7ac64e9d251fa2044fa3adc5bf359f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient011.webp new file mode 100644 index 0000000000000000000000000000000000000000..5385a15d6d7ac64e9d251fa2044fa3adc5bf359f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient012.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsLinearGradient012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b9ba80a06e36f3583a76a2071938ce20652732b2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2d94f9190c572f7f6eaf91109da40f9993eda4e3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin003.webp new file mode 100644 index 0000000000000000000000000000000000000000..b1b06f0f959bd4b50d58eb5a96754117c27cfa95 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin004.webp new file mode 100644 index 0000000000000000000000000000000000000000..8fceb4e59ce50f8d1f3894c679709f90ce87bb0b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMargin004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMask001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMask001.webp new file mode 100644 index 0000000000000000000000000000000000000000..fdc48f0ad3232f982da18ea2fde428d795a625e4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMask001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMask002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMask002.webp new file mode 100644 index 0000000000000000000000000000000000000000..bf1f70d0f5f3a87fa2d5c7b82d4b45c7b3b1a33a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsMask002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsOpacity001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsOpacity001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b7128105d2b140e3f0f0f8330bcc1e2d5736833 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsOpacity001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsPosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsPosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..454d13c264fe084a795af5d42e1832fc9a499fc2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsPosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsRadialGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsRadialGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5558ec74ff2836a3d1f829c72e3fbd83ddfb6a82 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsRadialGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9e2d19113e3654e5a76c38c87958c3a0e6052676 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32aeca966cb94524b4f388f58d9367e7577a0169 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c7d3a9834f6bbe5a168eac865b5aa297850be833 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale004.webp new file mode 100644 index 0000000000000000000000000000000000000000..df2224b004ead6f6e85ba9d29e3395a545a2a8b0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale005.webp new file mode 100644 index 0000000000000000000000000000000000000000..75694748f2d90284d11f0f87946f4c0b1483d23a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsScale005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsSepia001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsSepia001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b5b981b69ee5aa5b3b323874a1ad6781b61c4a56 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsSepia001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..19719fbaf96cd06235733da6f485eb1eef3c7a03 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow002.webp new file mode 100644 index 0000000000000000000000000000000000000000..0e9501b9da5beb9e58a214f3b039de6aa66ce602 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6a18211e4347bb81f394970844aedca660aa16d5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow004.webp new file mode 100644 index 0000000000000000000000000000000000000000..6641cedf1facb2233dcbbf65650289d4b25403b6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow005.webp new file mode 100644 index 0000000000000000000000000000000000000000..4a03fb63fe395260b5e9eaf3b268755e0d7cc805 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow006.webp new file mode 100644 index 0000000000000000000000000000000000000000..11b8e37e46b6d8d6eddf3c674ef5c082b0a2437c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow007.webp new file mode 100644 index 0000000000000000000000000000000000000000..cbf168c8a8ea2b7c9e8697264392b06d3d102f36 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow008.webp new file mode 100644 index 0000000000000000000000000000000000000000..cbf168c8a8ea2b7c9e8697264392b06d3d102f36 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsShadow008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsSweepGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsSweepGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9e96ce04d6aaaf1000fe7038b7e7486b2438100b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsSweepGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsTransform001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsTransform001.webp new file mode 100644 index 0000000000000000000000000000000000000000..da8f303fc7bb6b6ad8555519202fbbeb8ab4d0fa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsTransform001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsTransform002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsTransform002.webp new file mode 100644 index 0000000000000000000000000000000000000000..316d45e15397804dab9b0f0afb2173a2ef02e130 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsTransform002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7c2bc4226edb18b8558a72b53aec38243f8b36b8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonAttrsWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAppear001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAppear001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2bade6602dd92a6da30a9face3d33dcb017b2fca Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAppear001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..037ef0eabde79ebce1ff127396c7adc9b6a66cb7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8ede95574fa66df8a5884d801e69d68f623331a1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange003.webp new file mode 100644 index 0000000000000000000000000000000000000000..d914c31ecbfc997eb416b2eb921abeac7936ae1f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange004.webp new file mode 100644 index 0000000000000000000000000000000000000000..b008a412d78a9cc8fe093d05d5a2c9cbe3948fe5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnAreaChange004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnBlur001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnBlur001.webp new file mode 100644 index 0000000000000000000000000000000000000000..feef5847059bff4f070d8358855092022c4f0ab5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnBlur001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnBlur002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnBlur002.webp new file mode 100644 index 0000000000000000000000000000000000000000..eb3467f56dd39fd98131d1e0e6a6bbfe46ce60b4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnBlur002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnClick001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnClick001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ae29a809303ecf5930dbf359e7304105657972b9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnClick001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnClick002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnClick002.webp new file mode 100644 index 0000000000000000000000000000000000000000..53d5799a934fd10e9eca996e13e49c5314e24b0f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnClick002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnFocus001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnFocus001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6f202241ba28d384018ffaec42cb8629bd83f6bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnFocus001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnFocus002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnFocus002.webp new file mode 100644 index 0000000000000000000000000000000000000000..b956eb8db3ed27e7f46849de70d014c0986642ed Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnFocus002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnTouch001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnTouch001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c6b6b8726b5c5f7f2c06db96b90b27c9251cd7e6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnTouch001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnTouch002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnTouch002.webp new file mode 100644 index 0000000000000000000000000000000000000000..53d5799a934fd10e9eca996e13e49c5314e24b0f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCommonEventOnTouch002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlign001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlign001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0c59be574e65ef41059d336eb4e16cb0e86b9044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlign001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a92986b2252ba46cf3143ddb9f76b7a684c29c12 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a0ba06327fdc36597a7776bbe13cc3108a33b4c4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf003.webp new file mode 100644 index 0000000000000000000000000000000000000000..5bb7bf051ae7eb563a30ebaa1e1d5b0f4d958e9e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf004.webp new file mode 100644 index 0000000000000000000000000000000000000000..accdc107274dc9e848424370b0a47c2d19d4ef77 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf005.webp new file mode 100644 index 0000000000000000000000000000000000000000..9391477fcb6f7796e9cd7aaafc82570cf5addba2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf006.webp new file mode 100644 index 0000000000000000000000000000000000000000..7fbe69fc24cae766ec1ac7d06344535a51d42179 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf007.webp new file mode 100644 index 0000000000000000000000000000000000000000..a92986b2252ba46cf3143ddb9f76b7a684c29c12 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf008.webp new file mode 100644 index 0000000000000000000000000000000000000000..a0ba06327fdc36597a7776bbe13cc3108a33b4c4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf009.webp new file mode 100644 index 0000000000000000000000000000000000000000..5bb7bf051ae7eb563a30ebaa1e1d5b0f4d958e9e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf010.webp new file mode 100644 index 0000000000000000000000000000000000000000..accdc107274dc9e848424370b0a47c2d19d4ef77 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf011.webp new file mode 100644 index 0000000000000000000000000000000000000000..9391477fcb6f7796e9cd7aaafc82570cf5addba2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf012.webp new file mode 100644 index 0000000000000000000000000000000000000000..7fbe69fc24cae766ec1ac7d06344535a51d42179 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf013.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf013.webp new file mode 100644 index 0000000000000000000000000000000000000000..a92986b2252ba46cf3143ddb9f76b7a684c29c12 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf013.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf014.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf014.webp new file mode 100644 index 0000000000000000000000000000000000000000..a0ba06327fdc36597a7776bbe13cc3108a33b4c4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf014.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf015.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf015.webp new file mode 100644 index 0000000000000000000000000000000000000000..5bb7bf051ae7eb563a30ebaa1e1d5b0f4d958e9e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf015.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf016.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf016.webp new file mode 100644 index 0000000000000000000000000000000000000000..accdc107274dc9e848424370b0a47c2d19d4ef77 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf016.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf017.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf017.webp new file mode 100644 index 0000000000000000000000000000000000000000..9391477fcb6f7796e9cd7aaafc82570cf5addba2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf017.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf018.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf018.webp new file mode 100644 index 0000000000000000000000000000000000000000..7fbe69fc24cae766ec1ac7d06344535a51d42179 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf018.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf019.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf019.webp new file mode 100644 index 0000000000000000000000000000000000000000..a92986b2252ba46cf3143ddb9f76b7a684c29c12 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf019.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf020.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf020.webp new file mode 100644 index 0000000000000000000000000000000000000000..a0ba06327fdc36597a7776bbe13cc3108a33b4c4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf020.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf021.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf021.webp new file mode 100644 index 0000000000000000000000000000000000000000..5bb7bf051ae7eb563a30ebaa1e1d5b0f4d958e9e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf021.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf022.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf022.webp new file mode 100644 index 0000000000000000000000000000000000000000..accdc107274dc9e848424370b0a47c2d19d4ef77 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf022.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf023.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf023.webp new file mode 100644 index 0000000000000000000000000000000000000000..9391477fcb6f7796e9cd7aaafc82570cf5addba2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf023.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf024.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf024.webp new file mode 100644 index 0000000000000000000000000000000000000000..7fbe69fc24cae766ec1ac7d06344535a51d42179 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf024.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf025.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf025.webp new file mode 100644 index 0000000000000000000000000000000000000000..a92986b2252ba46cf3143ddb9f76b7a684c29c12 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf025.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf026.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf026.webp new file mode 100644 index 0000000000000000000000000000000000000000..a0ba06327fdc36597a7776bbe13cc3108a33b4c4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf026.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf027.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf027.webp new file mode 100644 index 0000000000000000000000000000000000000000..5bb7bf051ae7eb563a30ebaa1e1d5b0f4d958e9e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf027.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf028.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf028.webp new file mode 100644 index 0000000000000000000000000000000000000000..accdc107274dc9e848424370b0a47c2d19d4ef77 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf028.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf029.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf029.webp new file mode 100644 index 0000000000000000000000000000000000000000..9391477fcb6f7796e9cd7aaafc82570cf5addba2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf029.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf030.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf030.webp new file mode 100644 index 0000000000000000000000000000000000000000..7fbe69fc24cae766ec1ac7d06344535a51d42179 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf030.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf031.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf031.webp new file mode 100644 index 0000000000000000000000000000000000000000..a92986b2252ba46cf3143ddb9f76b7a684c29c12 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf031.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf032.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf032.webp new file mode 100644 index 0000000000000000000000000000000000000000..a0ba06327fdc36597a7776bbe13cc3108a33b4c4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf032.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf033.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf033.webp new file mode 100644 index 0000000000000000000000000000000000000000..5bb7bf051ae7eb563a30ebaa1e1d5b0f4d958e9e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf033.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf034.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf034.webp new file mode 100644 index 0000000000000000000000000000000000000000..accdc107274dc9e848424370b0a47c2d19d4ef77 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf034.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf035.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf035.webp new file mode 100644 index 0000000000000000000000000000000000000000..9391477fcb6f7796e9cd7aaafc82570cf5addba2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf035.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf036.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf036.webp new file mode 100644 index 0000000000000000000000000000000000000000..7fbe69fc24cae766ec1ac7d06344535a51d42179 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentAlignSelf036.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..29abc68257aefc5c64e9cfad00c72303e641b922 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBlendMode001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBlendMode001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d24513873208c388d3f01bbc192133f7707d61c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBlendMode001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..8efd16a1f4d78c26636a26536e84a1bd5a419b0a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderRadius001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderRadius001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5c8aebe78ec4f77837f5ba936c59a4239f9eea74 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderRadius001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..291804c4942dddcbc4c9e543fceb18a693c03faf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..28e1a8a69fae61038f360d853ed1ed38796636cc Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentBorderWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1c5f0e95a3580e5832347dd73483ac8f022adb1e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip002.webp new file mode 100644 index 0000000000000000000000000000000000000000..183aaefdb77fe7db94a86defc4fddb6d79080d08 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip003.webp new file mode 100644 index 0000000000000000000000000000000000000000..f05346cbf8cbd67bf85fe6aee44dafe2a7f8f3eb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip004.webp new file mode 100644 index 0000000000000000000000000000000000000000..3998cb19c50582844d2ce30b41dd6b226b4c2963 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentClip004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..69d79f3b92bd54811198a3656809cf264dce2daf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a5ad94c252ffa9445a5adbf1b6e8897e6e8a3119 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize003.webp new file mode 100644 index 0000000000000000000000000000000000000000..d4a6f625d814467ab5e9367989818ee7c9bccbd2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize004.webp new file mode 100644 index 0000000000000000000000000000000000000000..a5ad94c252ffa9445a5adbf1b6e8897e6e8a3119 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize005.webp new file mode 100644 index 0000000000000000000000000000000000000000..4bed93aba31b971fa872f4d3d179d6760d3b25e0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize006.webp new file mode 100644 index 0000000000000000000000000000000000000000..d4a6f625d814467ab5e9367989818ee7c9bccbd2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentConstraintSize006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentContrast001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentContrast001.webp new file mode 100644 index 0000000000000000000000000000000000000000..65184544b500afc42b5821fb0946f48e22ef8482 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentContrast001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentDirection001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentDirection001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5949876cac1a06dffc91c8858045f99b0efcd89e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentDirection001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentEnabled001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentEnabled001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d14e1c02cbfb00749e5f7ada04d07715ba7e4676 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentEnabled001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentEnabled002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentEnabled002.webp new file mode 100644 index 0000000000000000000000000000000000000000..54c2bb4dd83e48165d90621c28575f82abd4038e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentEnabled002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f082713232be65fdcb6c89b6b4068162c839f566 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6271421b527bf99548394dd7c68ade13055a8db9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis003.webp new file mode 100644 index 0000000000000000000000000000000000000000..9c7146a80b250ff43f349c8eb71631617828cb53 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis004.webp new file mode 100644 index 0000000000000000000000000000000000000000..279872b985736db56ade8c93a7db5c3f2cfb9d93 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis005.webp new file mode 100644 index 0000000000000000000000000000000000000000..9153b9c01aceeebbd47d97431c9ac097283f6e69 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis006.webp new file mode 100644 index 0000000000000000000000000000000000000000..2c0eaa391697108d3b881d9fd575803e02aa3066 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexBasis006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2e798f117c8ce6c608751856577140b7b3992c61 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3b2e4db997dc8edbbd8b85940840a1f5908f50e6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow003.webp new file mode 100644 index 0000000000000000000000000000000000000000..f1882897d4c5589abc879226366a5697227a740a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow004.webp new file mode 100644 index 0000000000000000000000000000000000000000..c4cc9df489ba7e2f492cce21eb231e91dac71cc6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow005.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c2c578ec626fd3452a7f13089aae5ae7b2ef0b6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow006.webp new file mode 100644 index 0000000000000000000000000000000000000000..e8134439cf8cf310f3f33f8c04f18f6c744b0185 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexGrow006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink001.webp new file mode 100644 index 0000000000000000000000000000000000000000..16b15839227d8e8ba252c6aa2291feea706cea9c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink002.webp new file mode 100644 index 0000000000000000000000000000000000000000..46faff745e04ca83afe223ff58bf06efef878c1e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink003.webp new file mode 100644 index 0000000000000000000000000000000000000000..3545c491cbb1fe15d2c7716a586b76819c124406 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ef6135b6fda400464a4fc25e04cda286e90f42b8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink005.webp new file mode 100644 index 0000000000000000000000000000000000000000..c941f1838e4a0280672c78001fde4503439f6153 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink006.webp new file mode 100644 index 0000000000000000000000000000000000000000..58ae9200cfb30c8b18dd5e00b277e8fb15f4ed3c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFlexShrink006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFocusable001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFocusable001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e5bece5c5f206fc20ef241337955664f1fa7b3a9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFocusable001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFocusable002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFocusable002.webp new file mode 100644 index 0000000000000000000000000000000000000000..e5bece5c5f206fc20ef241337955664f1fa7b3a9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentFocusable002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentForegroundBlurStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentForegroundBlurStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c5b1fed59f4c0d3eb7caa8d295fbaa3a2c515206 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentForegroundBlurStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentGrayscale001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentGrayscale001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0631fdb1fc85a000b1c5ea4b1d71c4da3410669f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentGrayscale001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ff28d1dd8ffeffc27df3450928a0e03c1fa6eae5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentHitTestBehavior001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentHitTestBehavior001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0c65c3055a3368575bb321e4b4bc9079fe9a92b8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentHitTestBehavior001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentId001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentId001.webp new file mode 100644 index 0000000000000000000000000000000000000000..46ed035db86bdbacbde19645e130886171903387 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentId001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentInvert001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentInvert001.webp new file mode 100644 index 0000000000000000000000000000000000000000..477963e588c5e07a8eb71fd18b2c53fa97f5a2ab Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentInvert001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..125823694717d5046df77a01874c774068b5ee07 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient002.webp new file mode 100644 index 0000000000000000000000000000000000000000..578d847ee4a14876f88340318f7e2d9e2db86bd5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient003.webp new file mode 100644 index 0000000000000000000000000000000000000000..47a5c8e04812288c672a6c2219c3cee86a02342b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient004.webp new file mode 100644 index 0000000000000000000000000000000000000000..5385a15d6d7ac64e9d251fa2044fa3adc5bf359f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient005.webp new file mode 100644 index 0000000000000000000000000000000000000000..f0e12db4bdb93408be77d5fd0e6cc1047af77b2b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient006.webp new file mode 100644 index 0000000000000000000000000000000000000000..d0b7befe3e3388f4fc8d5ed209567646cff1ad0a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient007.webp new file mode 100644 index 0000000000000000000000000000000000000000..8adfe20f956aead17b125859223aeb3e9c096e8b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient008.webp new file mode 100644 index 0000000000000000000000000000000000000000..44cbec05176f525a567efbc1b94e772be6c6c741 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient009.webp new file mode 100644 index 0000000000000000000000000000000000000000..5385a15d6d7ac64e9d251fa2044fa3adc5bf359f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient010.webp new file mode 100644 index 0000000000000000000000000000000000000000..5385a15d6d7ac64e9d251fa2044fa3adc5bf359f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient011.webp new file mode 100644 index 0000000000000000000000000000000000000000..5385a15d6d7ac64e9d251fa2044fa3adc5bf359f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient012.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentLinearGradient012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b9ba80a06e36f3583a76a2071938ce20652732b2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2d94f9190c572f7f6eaf91109da40f9993eda4e3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin003.webp new file mode 100644 index 0000000000000000000000000000000000000000..b1b06f0f959bd4b50d58eb5a96754117c27cfa95 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin004.webp new file mode 100644 index 0000000000000000000000000000000000000000..8fceb4e59ce50f8d1f3894c679709f90ce87bb0b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMargin004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMask001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMask001.webp new file mode 100644 index 0000000000000000000000000000000000000000..50290129d8130ee2f414d1db50ce449d661435b9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMask001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMask002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMask002.webp new file mode 100644 index 0000000000000000000000000000000000000000..84169aec7c473be3deefce27571f48a8be4355e6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentMask002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAppear001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAppear001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e6f826e9c3880b32f50bc5b990701288e3a9a7e8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAppear001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAreaChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAreaChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..69a93318b4fbf94744cd17c6a600f0b3548b7ba2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAreaChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAreaChange002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAreaChange002.webp new file mode 100644 index 0000000000000000000000000000000000000000..35536b06c9f38842077862dbf320ba1742a317a0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAreaChange002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAreaChange003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAreaChange003.webp new file mode 100644 index 0000000000000000000000000000000000000000..4d30a837b0ab513dd671fd5a5b5287591591c825 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnAreaChange003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnBlur001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnBlur001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9ad9c024363baea03521768ea082c747631c5662 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnBlur001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnBlur002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnBlur002.webp new file mode 100644 index 0000000000000000000000000000000000000000..c6ddb542a8ec068ca2cbca9f55791b95cf7dd0db Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnBlur002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnClick001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnClick001.webp new file mode 100644 index 0000000000000000000000000000000000000000..05da3976601a70602a83216e9e8ba8168e957c17 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnClick001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnClick002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnClick002.webp new file mode 100644 index 0000000000000000000000000000000000000000..53d5799a934fd10e9eca996e13e49c5314e24b0f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnClick002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnDraw001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnDraw001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f524d651ee7cc2380576aeedd0730d8bc6555e28 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnDraw001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnFocus001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnFocus001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7c03bba90a5f700c45108d13d8b3d97933406b7a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnFocus001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnFocus002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnFocus002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f4e1edf847ca717ecee09ebf9e4fefb82a20f6c8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnFocus002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnLayout001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnLayout001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b3b98a6358ce82726fc7baa9772e0483c9a52cf3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnLayout001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnMeasure001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnMeasure001.webp new file mode 100644 index 0000000000000000000000000000000000000000..285bf8c41d45493ca247740dd43aa0126a93caa9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnMeasure001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnTouch001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnTouch001.webp new file mode 100644 index 0000000000000000000000000000000000000000..05da3976601a70602a83216e9e8ba8168e957c17 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnTouch001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnTouch002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnTouch002.webp new file mode 100644 index 0000000000000000000000000000000000000000..53d5799a934fd10e9eca996e13e49c5314e24b0f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOnTouch002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOpacity001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOpacity001.webp new file mode 100644 index 0000000000000000000000000000000000000000..dfd25cf630322739ae9180a0eb3d07d1b997f205 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentOpacity001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentPosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentPosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3689dcb7273b4f89bf4e8e99e8f77bd7d9cb41bc Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentPosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentRadialGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentRadialGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5558ec74ff2836a3d1f829c72e3fbd83ddfb6a82 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentRadialGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9e2d19113e3654e5a76c38c87958c3a0e6052676 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32aeca966cb94524b4f388f58d9367e7577a0169 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c7d3a9834f6bbe5a168eac865b5aa297850be833 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale004.webp new file mode 100644 index 0000000000000000000000000000000000000000..df2224b004ead6f6e85ba9d29e3395a545a2a8b0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale005.webp new file mode 100644 index 0000000000000000000000000000000000000000..75694748f2d90284d11f0f87946f4c0b1483d23a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentScale005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentSepia001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentSepia001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b5b981b69ee5aa5b3b323874a1ad6781b61c4a56 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentSepia001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..19719fbaf96cd06235733da6f485eb1eef3c7a03 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow002.webp new file mode 100644 index 0000000000000000000000000000000000000000..0e9501b9da5beb9e58a214f3b039de6aa66ce602 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6a18211e4347bb81f394970844aedca660aa16d5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow004.webp new file mode 100644 index 0000000000000000000000000000000000000000..6641cedf1facb2233dcbbf65650289d4b25403b6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow005.webp new file mode 100644 index 0000000000000000000000000000000000000000..4a03fb63fe395260b5e9eaf3b268755e0d7cc805 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow006.webp new file mode 100644 index 0000000000000000000000000000000000000000..11b8e37e46b6d8d6eddf3c674ef5c082b0a2437c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow007.webp new file mode 100644 index 0000000000000000000000000000000000000000..cbf168c8a8ea2b7c9e8697264392b06d3d102f36 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow008.webp new file mode 100644 index 0000000000000000000000000000000000000000..cbf168c8a8ea2b7c9e8697264392b06d3d102f36 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentShadow008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentSweepGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentSweepGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9e96ce04d6aaaf1000fe7038b7e7486b2438100b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentSweepGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentTransform001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentTransform001.webp new file mode 100644 index 0000000000000000000000000000000000000000..da8f303fc7bb6b6ad8555519202fbbeb8ab4d0fa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentTransform001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentTransform002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentTransform002.webp new file mode 100644 index 0000000000000000000000000000000000000000..316d45e15397804dab9b0f0afb2173a2ef02e130 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentTransform002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cdfa6a2ecb8d542c3672f5a9a5307e81c9fd85e3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomComponentWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1b84391314d5485f47a8c6abecfa0805fc386f44 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f5bd7677525588ffebc5a9d47cf1a5880bea015a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment003.webp new file mode 100644 index 0000000000000000000000000000000000000000..cb02e1a885b460a61bc55dfaaefe54ee3e609df7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment004.webp new file mode 100644 index 0000000000000000000000000000000000000000..2116122bcdd8b54fbe5e6496f6bf59c16b600561 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment005.webp new file mode 100644 index 0000000000000000000000000000000000000000..9c19dd5db52775d62816c6ca70c76ec59838be88 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment006.webp new file mode 100644 index 0000000000000000000000000000000000000000..6576387293944a166df431cf7826bbd1e836778b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment007.webp new file mode 100644 index 0000000000000000000000000000000000000000..3007ab733a14062dee2e1f60b8322b7e177c9b59 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment008.webp new file mode 100644 index 0000000000000000000000000000000000000000..58c9a24ccc5f94bf185bcf5c7c3b80e20d1d3973 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment009.webp new file mode 100644 index 0000000000000000000000000000000000000000..069d7f34df079dbc2f733434b027b94111e1319c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment010.webp new file mode 100644 index 0000000000000000000000000000000000000000..7bb086abeef12c00bd4579ab52bff9589aa55bd8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogAlignment010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogClose001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogClose001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f8dc204c3dd76e8a68011a2f96156af52664ae88 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogClose001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogCustomStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogCustomStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca524d9c3aba9eed740e6031e5c1f41d8e99db31 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogCustomStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogMaskColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogMaskColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a52b7f6a499ff95b301b14ff0084b7b51e7d2b6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogMaskColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogOpen001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogOpen001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0370f310ca8f14cd5a61a9b7e59cf8a58786b033 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testCustomDialogOpen001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..c24b644cc675b1029bf3efe658802ebb1dba3175 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerDisappearTextStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerDisappearTextStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0f3bc8f7820e3744c316015d0a48d3cbebbff174 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerDisappearTextStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnabled001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnabled001.webp new file mode 100644 index 0000000000000000000000000000000000000000..dd88435373f6c611662d427c690b74faf9cdb375 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnabled001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnabled002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnabled002.webp new file mode 100644 index 0000000000000000000000000000000000000000..cff8b857338cf461861da8fb264c80b8eb5ee0a7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnabled002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnabled003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnabled003.webp new file mode 100644 index 0000000000000000000000000000000000000000..5d34a712f39a5b4e8c224ff3b4eb71caf2b4a022 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnabled003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnd001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnd001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b1da06fb9e6c9cce5427f04c532c585628acd387 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnd001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnd002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnd002.webp new file mode 100644 index 0000000000000000000000000000000000000000..de2b1ba4e7e2c75741b8ee298a74edfa2a1530f9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerEnd002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerLunar001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerLunar001.webp new file mode 100644 index 0000000000000000000000000000000000000000..68b5ed2daecea83aed326f88624190c9d042132b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerLunar001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerOnDateChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerOnDateChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0b36994dfe051057a0891f408ae28c1b323019b7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerOnDateChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerSelected001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerSelected001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c8080184c4e6e6cc524ef752a7dc5f28734021b3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerSelected001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerSelected002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerSelected002.webp new file mode 100644 index 0000000000000000000000000000000000000000..71ffe0835b3141200bd1cba77aa3163fd8d9b096 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerSelected002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerSelectedTextStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerSelectedTextStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..dd7216daf48d5fda4c7001429f2f1b3fb2b0e297 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerSelectedTextStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerStart001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerStart001.webp new file mode 100644 index 0000000000000000000000000000000000000000..42e57a6d89d64bf0936bbd56471b90d777b84e42 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerStart001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerStart002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerStart002.webp new file mode 100644 index 0000000000000000000000000000000000000000..e601fa31c202bc16ec2fffa1c18a7e0ed582748c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerStart002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerTextStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerTextStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f368167ae272ef5fc683ec8e10b2990a386729dd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerTextStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..713beb7844c4eb4043b45cd5dd5f317cfa2595a7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..288d1a4af702dd07d7fbedc55833ef7fc9d2591a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testDatePickerWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..20112976c7f5e1a1b8850aba0d89891c6a09413e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32a7126611d68cc2ac879c3e70dfbaaf7d796de9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e6c906ec1b4b1c79dc6885da0c556cb92cddec31 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..4af450fee9f4e6c219091830de3fcf3eee8e001c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testFlexWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageAlt001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageAlt001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d5786da567ed1924bda62a8b6cb0fabdc83fc3f8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageAlt001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageAutoResize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageAutoResize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e1f9781a90a0692907ea8a6b7ab223042897dc56 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageAutoResize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..35c1c1d1bc7ee4b6f3b317318b0bef9c732fe022 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBlur001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBlur001.webp new file mode 100644 index 0000000000000000000000000000000000000000..21546e153c4c707d3f420c2134c93061715ed600 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBlur001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a71676c7aa7816038585ee523c2a97e86f677044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderRadius001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderRadius001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2e8d9cb4423887e3f86025ff0fa284d7dfeb6247 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderRadius001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..555e65c9a6b9e172d087618a4810ed8aed66e220 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f192b2f0eeb7132bd2a6bf48aa46841b5feef733 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBorderWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBrightness001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBrightness001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c14d3051d760ec3cf8083656ace2a7e359a64365 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageBrightness001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c7a638403b7ec12fc605809a82ffd2c6370b4a04 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageColorFilter001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageColorFilter001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d41f40905db717e41f9a96189b891506eaf33baa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageColorFilter001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c4ed362fd4f168b130ec48063cc72bd9863386f4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..e5f96a1ca37d373518d48b2523e4c2bcda838fbb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageHitTestBehavior001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageHitTestBehavior001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2aaf651fbaf0b7caeb22bdb83837991ddafe86d5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageHitTestBehavior001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageId001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageId001.webp new file mode 100644 index 0000000000000000000000000000000000000000..46ed035db86bdbacbde19645e130886171903387 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageId001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageInterpolation001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageInterpolation001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a9746b26827f9c7e8e8b397c1d9fd13ca1513b59 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageInterpolation001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageLinearGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageLinearGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d91b7b13e83780b8d2688c823b1a85e59ed86839 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageLinearGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageObjectFit001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageObjectFit001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ffb9c70dc56e72b25ab1f998f380e623c0791499 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageObjectFit001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageObjectRepeat001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageObjectRepeat001.webp new file mode 100644 index 0000000000000000000000000000000000000000..fcb754f900aea0ebc5bc72d18857ab9e6439d656 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageObjectRepeat001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageOnComplete001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageOnComplete001.webp new file mode 100644 index 0000000000000000000000000000000000000000..46ed035db86bdbacbde19645e130886171903387 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageOnComplete001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageOnError001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageOnError001.webp new file mode 100644 index 0000000000000000000000000000000000000000..15030025b00f7070daf2949614769ba8179abf79 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageOnError001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageOpacity001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageOpacity001.webp new file mode 100644 index 0000000000000000000000000000000000000000..01ef80b7304a51197650a8f029e82da36ab4ab73 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageOpacity001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImagePosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImagePosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6b5bf396c6d0ebadb34a760ecc352244bea3d158 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImagePosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageRadialGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageRadialGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..dda069cc55a79ee92a4e8401b7c7a3a5753a69c8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageRadialGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageRotate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageRotate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a87fc01b5ad011ad4c5e0a0643b6eed99c6aabaf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageRotate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSaturate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSaturate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9a02d6bbe121405c95012c80d1db659b250fc68e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSaturate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageScale001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageScale001.webp new file mode 100644 index 0000000000000000000000000000000000000000..635357d4349b7f587245067ddcf3f60ace0b8d1d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageScale001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageShadow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageShadow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3fbcb06b6d119ac5fb36cd841dde5a3ac91cb407 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageShadow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ff0b5e618979cdb557a1bcdaf73f23e79cd54405 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32a7126611d68cc2ac879c3e70dfbaaf7d796de9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanObjectFit001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanObjectFit001.webp new file mode 100644 index 0000000000000000000000000000000000000000..571876a815b8b859d9fa44b5006861e060c9f7e1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanObjectFit001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanPadding001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanPadding001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5ac4dd20a01a849fe1444c7843ecd2afd511cf60 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanPadding001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanVerticalAlign001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanVerticalAlign001.webp new file mode 100644 index 0000000000000000000000000000000000000000..934927951f6235bdaf0ac46b1d7899cb3237c590 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanVerticalAlign001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b1e129d789970f09525797d1cb596856b4978297 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..4af450fee9f4e6c219091830de3fcf3eee8e001c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSpanWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSrc001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSrc001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d5786da567ed1924bda62a8b6cb0fabdc83fc3f8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSrc001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSweepGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSweepGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..15030025b00f7070daf2949614769ba8179abf79 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageSweepGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageTransform001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageTransform001.webp new file mode 100644 index 0000000000000000000000000000000000000000..20699c3c2999e2bf00e191e26639482d082e901e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageTransform001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageTranslate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageTranslate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7000ff94a72b4ed83e4af3f3a486090f1c66fa24 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageTranslate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3a8be05b0b1009343fc1edd1323cfa2d2c2a6782 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..d89b34ca34530d3dcee24193330b317e781cfee4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testImageWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..75694748f2d90284d11f0f87946f4c0b1483d23a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBackgroundColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBackgroundColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..bcec28651ce5226480ac775eae8e11999a1f5fc4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBackgroundColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBackgroundColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBackgroundColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..bcec28651ce5226480ac775eae8e11999a1f5fc4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBackgroundColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBlur001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBlur001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0b812bbebad1b85946c7ce23d7ef57664d0adf7c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBlur001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBlur002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBlur002.webp new file mode 100644 index 0000000000000000000000000000000000000000..1640782890a36f4998e8fcc04c475a845335d7c6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBlur002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBlur003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBlur003.webp new file mode 100644 index 0000000000000000000000000000000000000000..1640782890a36f4998e8fcc04c475a845335d7c6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBlur003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a7c0c832fa32d43df648a50f2b7f620093b0738a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7862cd453f0fe0ef84ce4038c750441415273168 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..dfa78836acac30aa265fe8ddf1c896ed28435c85 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor004.webp new file mode 100644 index 0000000000000000000000000000000000000000..dfa78836acac30aa265fe8ddf1c896ed28435c85 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderColor004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ef6f3fecaad4f67a6254af6de790a2879a1bf04a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius002.webp new file mode 100644 index 0000000000000000000000000000000000000000..eff673744df4aa3f539e6e04d90a5bcaec068a00 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius003.webp new file mode 100644 index 0000000000000000000000000000000000000000..a7c0c832fa32d43df648a50f2b7f620093b0738a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius004.webp new file mode 100644 index 0000000000000000000000000000000000000000..7eb088afc7ffbca6d174e5651211be16ced8bc92 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderRadius004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b8921ba9edd68d28698d76d6203ab1fdf96996ea Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..79a57047cdd1e5753f95ba5ae2b38c1b3a833c34 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth003.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth004.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBorderWidth004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness001.webp new file mode 100644 index 0000000000000000000000000000000000000000..91a7a9ede77029d26f2366d312524d603c19dd3b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness002.webp new file mode 100644 index 0000000000000000000000000000000000000000..e0f87901bee929d209acffcf7c748097b8820529 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness003.webp new file mode 100644 index 0000000000000000000000000000000000000000..91a7a9ede77029d26f2366d312524d603c19dd3b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness004.webp new file mode 100644 index 0000000000000000000000000000000000000000..e0f87901bee929d209acffcf7c748097b8820529 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListBrightness004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListCachedCount001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListCachedCount001.webp new file mode 100644 index 0000000000000000000000000000000000000000..67150526e4131ccce542fe2ac2a7ae0b6053504c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListCachedCount001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListCachedCount002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListCachedCount002.webp new file mode 100644 index 0000000000000000000000000000000000000000..67150526e4131ccce542fe2ac2a7ae0b6053504c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListCachedCount002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f8b457680e6c12aec507f188da69d14714c6320 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7a073e13382394ae1ddab76fc2a8a599f5ab66c8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip003.webp new file mode 100644 index 0000000000000000000000000000000000000000..1c5f0e95a3580e5832347dd73483ac8f022adb1e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip004.webp new file mode 100644 index 0000000000000000000000000000000000000000..183aaefdb77fe7db94a86defc4fddb6d79080d08 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip005.webp new file mode 100644 index 0000000000000000000000000000000000000000..f05346cbf8cbd67bf85fe6aee44dafe2a7f8f3eb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip006.webp new file mode 100644 index 0000000000000000000000000000000000000000..3998cb19c50582844d2ce30b41dd6b226b4c2963 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListClip006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect001.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect002.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect003.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect004.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect005.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEdgeEffect005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction001.webp new file mode 100644 index 0000000000000000000000000000000000000000..095fe8125ef17460d748409da5976a5e47ae3c92 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction002.webp new file mode 100644 index 0000000000000000000000000000000000000000..eeec29fafa32d80ea6a4ddca5c613bfa4e029272 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction003.webp new file mode 100644 index 0000000000000000000000000000000000000000..095fe8125ef17460d748409da5976a5e47ae3c92 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction004.webp new file mode 100644 index 0000000000000000000000000000000000000000..095fe8125ef17460d748409da5976a5e47ae3c92 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListEnableScrollInteraction004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListFriction001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListFriction001.webp new file mode 100644 index 0000000000000000000000000000000000000000..095fe8125ef17460d748409da5976a5e47ae3c92 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListFriction001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListFriction002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListFriction002.webp new file mode 100644 index 0000000000000000000000000000000000000000..02054d4e53d499ba97550b9c6a5f833f3513c662 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListFriction002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListFriction003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListFriction003.webp new file mode 100644 index 0000000000000000000000000000000000000000..095fe8125ef17460d748409da5976a5e47ae3c92 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListFriction003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..b61d7e72084e9f919efe804effe57377b4b66bae Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6328a671553b494a1567010bad8f4548fbd5d25b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight004.webp new file mode 100644 index 0000000000000000000000000000000000000000..fd591ce2661e52ce54ac2517b1174d3818b92703 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHeight004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cee9008bdbd5765aaba05f1ff163f031061c1869 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior002.webp new file mode 100644 index 0000000000000000000000000000000000000000..d024f6b4bc60a9c5dc2adf643af4692fbab46c32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior003.webp new file mode 100644 index 0000000000000000000000000000000000000000..e17d93d8fd3051374e95e7e2c96a628888961985 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior004.webp new file mode 100644 index 0000000000000000000000000000000000000000..01aa5d05e60c08a152cd244cbcef8e58ca92e9d5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListHitTestBehavior004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..75694748f2d90284d11f0f87946f4c0b1483d23a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBackgroundColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBackgroundColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBackgroundColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBackgroundColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBackgroundColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBackgroundColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBlur001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBlur001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4a2f75b976f364babcb08578cce21b603ba8e99e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBlur001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBlur002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBlur002.webp new file mode 100644 index 0000000000000000000000000000000000000000..34b0d6bd941d82a125016d27331c392910021c9a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBlur002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBlur003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBlur003.webp new file mode 100644 index 0000000000000000000000000000000000000000..34b0d6bd941d82a125016d27331c392910021c9a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBlur003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a7c0c832fa32d43df648a50f2b7f620093b0738a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7862cd453f0fe0ef84ce4038c750441415273168 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..e2214fcddb60df68d53689b79afb9a06751e121e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor004.webp new file mode 100644 index 0000000000000000000000000000000000000000..e2214fcddb60df68d53689b79afb9a06751e121e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderColor004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ef6f3fecaad4f67a6254af6de790a2879a1bf04a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius002.webp new file mode 100644 index 0000000000000000000000000000000000000000..eff673744df4aa3f539e6e04d90a5bcaec068a00 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius003.webp new file mode 100644 index 0000000000000000000000000000000000000000..a7c0c832fa32d43df648a50f2b7f620093b0738a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius004.webp new file mode 100644 index 0000000000000000000000000000000000000000..7eb088afc7ffbca6d174e5651211be16ced8bc92 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderRadius004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b8921ba9edd68d28698d76d6203ab1fdf96996ea Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..79a57047cdd1e5753f95ba5ae2b38c1b3a833c34 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth003.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth004.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBorderWidth004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2437ad797d6cbc495720b8de56da994bc8298784 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6401cd5f673071d260a074279833e87a5608954e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness003.webp new file mode 100644 index 0000000000000000000000000000000000000000..2437ad797d6cbc495720b8de56da994bc8298784 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness004.webp new file mode 100644 index 0000000000000000000000000000000000000000..6401cd5f673071d260a074279833e87a5608954e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemBrightness004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f8b457680e6c12aec507f188da69d14714c6320 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7a073e13382394ae1ddab76fc2a8a599f5ab66c8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip003.webp new file mode 100644 index 0000000000000000000000000000000000000000..1c5f0e95a3580e5832347dd73483ac8f022adb1e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip004.webp new file mode 100644 index 0000000000000000000000000000000000000000..183aaefdb77fe7db94a86defc4fddb6d79080d08 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip005.webp new file mode 100644 index 0000000000000000000000000000000000000000..f05346cbf8cbd67bf85fe6aee44dafe2a7f8f3eb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip006.webp new file mode 100644 index 0000000000000000000000000000000000000000..3998cb19c50582844d2ce30b41dd6b226b4c2963 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemClip006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect001.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect002.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect003.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect004.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect005.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemEdgeEffect005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..dd5ab62dfc8d0b3d907bdc600bf233bf67c86201 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6328a671553b494a1567010bad8f4548fbd5d25b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight004.webp new file mode 100644 index 0000000000000000000000000000000000000000..fd591ce2661e52ce54ac2517b1174d3818b92703 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHeight004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1a3b198864ff2ae5dd5af58df81d33ea0665b41a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f23eacb30198a03d51595d9cac084d0deb5cfbd4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior003.webp new file mode 100644 index 0000000000000000000000000000000000000000..1a3b198864ff2ae5dd5af58df81d33ea0665b41a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior004.webp new file mode 100644 index 0000000000000000000000000000000000000000..e12816af0f83c49ff72695c90232e90cbb8790b2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemHitTestBehavior004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d4a48ef5f8f88bfa083f631349c73989b58ba1da Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient002.webp new file mode 100644 index 0000000000000000000000000000000000000000..92ad2e0249fd9d1cbb84dc26ecdd6192fb150bac Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient003.webp new file mode 100644 index 0000000000000000000000000000000000000000..4ba85d197542eeac72bcef1d07196372f22537f6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient004.webp new file mode 100644 index 0000000000000000000000000000000000000000..bf3bdd056cf332fef7f88868b75382bbd90ea259 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient005.webp new file mode 100644 index 0000000000000000000000000000000000000000..299cfeb25de6a6eab51fdefc1938db386241cf49 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient006.webp new file mode 100644 index 0000000000000000000000000000000000000000..1d2a3d4a412e1c01d6fade3a5696c761ca43526a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient007.webp new file mode 100644 index 0000000000000000000000000000000000000000..a6344d51f7eb35ba7d722aa6e4a348ff7af9950b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient008.webp new file mode 100644 index 0000000000000000000000000000000000000000..4ee85d35300cf4283ef8432e28ae836d76ea05e1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient009.webp new file mode 100644 index 0000000000000000000000000000000000000000..bf3bdd056cf332fef7f88868b75382bbd90ea259 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient010.webp new file mode 100644 index 0000000000000000000000000000000000000000..bf3bdd056cf332fef7f88868b75382bbd90ea259 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient011.webp new file mode 100644 index 0000000000000000000000000000000000000000..bf3bdd056cf332fef7f88868b75382bbd90ea259 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient012.webp new file mode 100644 index 0000000000000000000000000000000000000000..eb6c65947624de81328039bad5f26fcf99a32654 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemLinearGradient012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity001.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6328a671553b494a1567010bad8f4548fbd5d25b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity003.webp new file mode 100644 index 0000000000000000000000000000000000000000..b7f72fa1b243140c22326485ea6132888fc37a0c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity004.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity005.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemOpacity005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2e85bba516ba2faf5f22828a24a395ae5141d0c0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate002.webp new file mode 100644 index 0000000000000000000000000000000000000000..358e7c644b0c0aea3fee71d680f62f73604582cb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate003.webp new file mode 100644 index 0000000000000000000000000000000000000000..42321e7a8d3bace2a164e09d30fddc171d26dadf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate004.webp new file mode 100644 index 0000000000000000000000000000000000000000..42321e7a8d3bace2a164e09d30fddc171d26dadf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate005.webp new file mode 100644 index 0000000000000000000000000000000000000000..42321e7a8d3bace2a164e09d30fddc171d26dadf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate006.webp new file mode 100644 index 0000000000000000000000000000000000000000..42321e7a8d3bace2a164e09d30fddc171d26dadf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemRotate006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ffa23c051da7f6f0f42442dee39dbd4bdc90af1d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate002.webp new file mode 100644 index 0000000000000000000000000000000000000000..eb6c65947624de81328039bad5f26fcf99a32654 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate003.webp new file mode 100644 index 0000000000000000000000000000000000000000..eb6c65947624de81328039bad5f26fcf99a32654 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate004.webp new file mode 100644 index 0000000000000000000000000000000000000000..eb6c65947624de81328039bad5f26fcf99a32654 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemSaturate004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9e2d19113e3654e5a76c38c87958c3a0e6052676 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32aeca966cb94524b4f388f58d9367e7577a0169 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale003.webp new file mode 100644 index 0000000000000000000000000000000000000000..02549c49dd64d62d055f89aad8c1686c2a602361 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale004.webp new file mode 100644 index 0000000000000000000000000000000000000000..75694748f2d90284d11f0f87946f4c0b1483d23a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale005.webp new file mode 100644 index 0000000000000000000000000000000000000000..75694748f2d90284d11f0f87946f4c0b1483d23a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemScale005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a5673a5bafe59d2899bb60930b38e9c6b30798b5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a339e514d780e34bd13f22be6254b516166c139a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow003.webp new file mode 100644 index 0000000000000000000000000000000000000000..293766ad145d26d5c74baa09c3b31e49ccc55036 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow004.webp new file mode 100644 index 0000000000000000000000000000000000000000..4e046f24ea4a2258676a43cc36cd7cc284313029 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow005.webp new file mode 100644 index 0000000000000000000000000000000000000000..1060e614f03ef1bb79c7380407ffe85bc33e0e1c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow006.webp new file mode 100644 index 0000000000000000000000000000000000000000..d9f1ecf827aa29b0aad5adb59125ba2a9b921916 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow007.webp new file mode 100644 index 0000000000000000000000000000000000000000..42e628afa53807dc13f6a91c83bb6eab0f6179fc Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow008.webp new file mode 100644 index 0000000000000000000000000000000000000000..42e628afa53807dc13f6a91c83bb6eab0f6179fc Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemShadow008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4297dde6b254d88171e896adcbf99ebb09df3eff Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate002.webp new file mode 100644 index 0000000000000000000000000000000000000000..750604a1cb2c4a9e30c91dcddb2baff6646c5843 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate003.webp new file mode 100644 index 0000000000000000000000000000000000000000..b81c3a6d761d10d5481ef89916b329a66babb4d2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate004.webp new file mode 100644 index 0000000000000000000000000000000000000000..1e281377f0d8833b49f8af7bb6e0b8e356ca3ef1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate005.webp new file mode 100644 index 0000000000000000000000000000000000000000..42321e7a8d3bace2a164e09d30fddc171d26dadf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate006.webp new file mode 100644 index 0000000000000000000000000000000000000000..42321e7a8d3bace2a164e09d30fddc171d26dadf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemTranslate006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..eb6c65947624de81328039bad5f26fcf99a32654 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..75694748f2d90284d11f0f87946f4c0b1483d23a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth003.webp new file mode 100644 index 0000000000000000000000000000000000000000..227eabb434169ae9599daab8ea73872d7850c913 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth004.webp new file mode 100644 index 0000000000000000000000000000000000000000..4ce367cb801b9f26883d1197fa0c568bd8827ff5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListItemWidth004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d347ff2c22bb7ba076cd1d9320c9965dd577794b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient002.webp new file mode 100644 index 0000000000000000000000000000000000000000..99a9006b5b78726195dc94181f688b84569fc768 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient003.webp new file mode 100644 index 0000000000000000000000000000000000000000..58451b0e29f8ea3d8f78754a9e1cf15d3e27f260 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ef3075cbcb2fe20e303703f771edbae223bdb7a7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient005.webp new file mode 100644 index 0000000000000000000000000000000000000000..f1db3a0a72564cdbb804cd486e1e0f45ff646484 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient006.webp new file mode 100644 index 0000000000000000000000000000000000000000..909c097ddf4ff84e5a0f9e7784bedfb8ae859f47 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient007.webp new file mode 100644 index 0000000000000000000000000000000000000000..d3a9cd33a8c980f0c1cde583efe5ff9cc2142a81 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient008.webp new file mode 100644 index 0000000000000000000000000000000000000000..b55e87c41189cc03263b87c093a77ddee6261a59 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient009.webp new file mode 100644 index 0000000000000000000000000000000000000000..ef3075cbcb2fe20e303703f771edbae223bdb7a7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient010.webp new file mode 100644 index 0000000000000000000000000000000000000000..ef3075cbcb2fe20e303703f771edbae223bdb7a7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient011.webp new file mode 100644 index 0000000000000000000000000000000000000000..ef3075cbcb2fe20e303703f771edbae223bdb7a7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient012.webp new file mode 100644 index 0000000000000000000000000000000000000000..fb9fa38cff70e944a7081b0688252faba1dc6045 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListLinearGradient012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5922e413cd72220ce9f81f9efdaa002c041848f7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection002.webp new file mode 100644 index 0000000000000000000000000000000000000000..888cefb818799df45a6f0626492c22627281e665 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection003.webp new file mode 100644 index 0000000000000000000000000000000000000000..5922e413cd72220ce9f81f9efdaa002c041848f7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection004.webp new file mode 100644 index 0000000000000000000000000000000000000000..5922e413cd72220ce9f81f9efdaa002c041848f7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListListDirection004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity001.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6328a671553b494a1567010bad8f4548fbd5d25b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity003.webp new file mode 100644 index 0000000000000000000000000000000000000000..b7f72fa1b243140c22326485ea6132888fc37a0c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity004.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity005.webp new file mode 100644 index 0000000000000000000000000000000000000000..81d0998887084c9bd40d1f6c843215d3c45f4bbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListOpacity005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..fb7ce626914291a9413ff40f5d37a0e514196846 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate002.webp new file mode 100644 index 0000000000000000000000000000000000000000..dcf8e7aee0d326974905e36403bec09f558a9a2a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate003.webp new file mode 100644 index 0000000000000000000000000000000000000000..750604a1cb2c4a9e30c91dcddb2baff6646c5843 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate004.webp new file mode 100644 index 0000000000000000000000000000000000000000..750604a1cb2c4a9e30c91dcddb2baff6646c5843 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate005.webp new file mode 100644 index 0000000000000000000000000000000000000000..750604a1cb2c4a9e30c91dcddb2baff6646c5843 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate006.webp new file mode 100644 index 0000000000000000000000000000000000000000..750604a1cb2c4a9e30c91dcddb2baff6646c5843 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListRotate006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..92bf34df2ff617e4f7129b7f234ac73bc04ede1d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate002.webp new file mode 100644 index 0000000000000000000000000000000000000000..fb9fa38cff70e944a7081b0688252faba1dc6045 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate003.webp new file mode 100644 index 0000000000000000000000000000000000000000..fb9fa38cff70e944a7081b0688252faba1dc6045 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate004.webp new file mode 100644 index 0000000000000000000000000000000000000000..fb9fa38cff70e944a7081b0688252faba1dc6045 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSaturate004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9e2d19113e3654e5a76c38c87958c3a0e6052676 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32aeca966cb94524b4f388f58d9367e7577a0169 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c7d3a9834f6bbe5a168eac865b5aa297850be833 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale004.webp new file mode 100644 index 0000000000000000000000000000000000000000..df2224b004ead6f6e85ba9d29e3395a545a2a8b0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale005.webp new file mode 100644 index 0000000000000000000000000000000000000000..75694748f2d90284d11f0f87946f4c0b1483d23a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScale005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar001.webp new file mode 100644 index 0000000000000000000000000000000000000000..bdeebf42cd6cf19051ed4c5a5cea5e8a5acc9484 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7e484cd6587d6775d4cc9e89c49a8bd134dd510b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar003.webp new file mode 100644 index 0000000000000000000000000000000000000000..f3f636b8f78f8c009ff72346d0af1caf434d49ff Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar004.webp new file mode 100644 index 0000000000000000000000000000000000000000..bdeebf42cd6cf19051ed4c5a5cea5e8a5acc9484 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar005.webp new file mode 100644 index 0000000000000000000000000000000000000000..bdeebf42cd6cf19051ed4c5a5cea5e8a5acc9484 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListScrollBar005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..19719fbaf96cd06235733da6f485eb1eef3c7a03 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow002.webp new file mode 100644 index 0000000000000000000000000000000000000000..0e9501b9da5beb9e58a214f3b039de6aa66ce602 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6a18211e4347bb81f394970844aedca660aa16d5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow004.webp new file mode 100644 index 0000000000000000000000000000000000000000..6641cedf1facb2233dcbbf65650289d4b25403b6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow005.webp new file mode 100644 index 0000000000000000000000000000000000000000..4a03fb63fe395260b5e9eaf3b268755e0d7cc805 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow006.webp new file mode 100644 index 0000000000000000000000000000000000000000..11b8e37e46b6d8d6eddf3c674ef5c082b0a2437c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow007.webp new file mode 100644 index 0000000000000000000000000000000000000000..cbf168c8a8ea2b7c9e8697264392b06d3d102f36 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow008.webp new file mode 100644 index 0000000000000000000000000000000000000000..cbf168c8a8ea2b7c9e8697264392b06d3d102f36 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListShadow008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e06765ae7ccd0ba8009d9c185491323202002126 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky002.webp new file mode 100644 index 0000000000000000000000000000000000000000..c9499eef64e686ed6e2e6e3d4d90abf9480b2c92 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky003.webp new file mode 100644 index 0000000000000000000000000000000000000000..9d4d3d752130fd5f9666fd5b920cca452af10f4b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky004.webp new file mode 100644 index 0000000000000000000000000000000000000000..1b198f852e5063182fe4734363a08da3e90715d8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky005.webp new file mode 100644 index 0000000000000000000000000000000000000000..e06765ae7ccd0ba8009d9c185491323202002126 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky006.webp new file mode 100644 index 0000000000000000000000000000000000000000..e06765ae7ccd0ba8009d9c185491323202002126 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListSticky006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a33e5c3be99529f107ada01cd4f99a89f7dd9886 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate002.webp new file mode 100644 index 0000000000000000000000000000000000000000..12743637660afd2601ac04d7346350e02afaae79 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate003.webp new file mode 100644 index 0000000000000000000000000000000000000000..42321e7a8d3bace2a164e09d30fddc171d26dadf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate004.webp new file mode 100644 index 0000000000000000000000000000000000000000..cf6a9b899d81f74c0d5ba3828dc4c0d26f2670f7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate005.webp new file mode 100644 index 0000000000000000000000000000000000000000..750604a1cb2c4a9e30c91dcddb2baff6646c5843 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate006.webp new file mode 100644 index 0000000000000000000000000000000000000000..750604a1cb2c4a9e30c91dcddb2baff6646c5843 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListTranslate006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..fb9fa38cff70e944a7081b0688252faba1dc6045 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..b89477dc2e86eb6b63d244e4b7e32f17ed3c20bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth003.webp new file mode 100644 index 0000000000000000000000000000000000000000..75694748f2d90284d11f0f87946f4c0b1483d23a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth004.webp new file mode 100644 index 0000000000000000000000000000000000000000..753d7246603c29460640adaf999161807712b6a7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testListWidth004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7a186645d4a3b16f888f396acce48c0183e65001 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3a50e811a052e2a31db1b38ac2170c538bcc770e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..0fa80b80558833ea17a66dcb0d4cd0dcc997540a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressEnableLoading001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressEnableLoading001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad7c1c23c94d7f926980fa765a9e6be7f4b3b254 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressEnableLoading001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressEnableLoading002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressEnableLoading002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f8dc204c3dd76e8a68011a2f96156af52664ae88 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testLoadingProgressEnableLoading002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..648e0c1f149dd08f8947ee924bc51d96e5a14e2c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..090ec9088ba7f731a95d0d3e3c50d316d978b25c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressBackgroundColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressBackgroundColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..68c4869cdb0b0823af1f3bde743d8cf74e1edb04 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressBackgroundColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressBackgroundColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressBackgroundColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6cc6432116a9c80b0f95f323df22d85676563e52 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressBackgroundColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d22e1719b890191fcb40d99b4f83556c011af70b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..d22e1719b890191fcb40d99b4f83556c011af70b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..d22e1719b890191fcb40d99b4f83556c011af70b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..090ec9088ba7f731a95d0d3e3c50d316d978b25c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..c4705c43eb019d5abb04b44e4229715508b1a491 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c8171b78ea5b16474de38baa01c6499547dd23a8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle004.webp new file mode 100644 index 0000000000000000000000000000000000000000..fb0c1e105cbeb8d57d29588daa8e7309354fc5cf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle005.webp new file mode 100644 index 0000000000000000000000000000000000000000..4566180a9623add4cac07170252f7d1b4c461a99 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testProgressStyle005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshOnRefreshing001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshOnRefreshing001.webp new file mode 100644 index 0000000000000000000000000000000000000000..694105d696f33f54a2135d5e1aa3264c6500eb5e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshOnRefreshing001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshOnStateChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshOnStateChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..058f8b4ec43991a9d7d83e22f556e9700478a002 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRefreshOnStateChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRowHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRowHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..031e727365760f84f4abd36473e9fca64fa849de Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRowHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRowHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRowHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32a7126611d68cc2ac879c3e70dfbaaf7d796de9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testRowHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBackgroundColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBackgroundColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..288b43910649efee1d50ce6691ebaf37e985c768 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBackgroundColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBackgroundColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBackgroundColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..76dbcb6ac1f052ae60bd419e10c19bea161252a5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBackgroundColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBlur001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBlur001.webp new file mode 100644 index 0000000000000000000000000000000000000000..36bac07ea260a178367a79f4f0fdee4c63db162f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBlur001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBlur002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBlur002.webp new file mode 100644 index 0000000000000000000000000000000000000000..506ab14e413010879d403ee6c592b1275555eaab Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBlur002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1f51bf0ff632fb7e54b44cb90525d18e0e01f38c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a141d9212ec8b98bb3b0cbbe4d1a2dddfaff32a7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..a141d9212ec8b98bb3b0cbbe4d1a2dddfaff32a7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderRadius001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderRadius001.webp new file mode 100644 index 0000000000000000000000000000000000000000..066fea9b975813d8bdcb08c9f4e6200a55bbcc4a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderRadius001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderRadius002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderRadius002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca093fcf6b4e83ba925eb4ed65e8a3a3d3addedf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderRadius002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderRadius003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderRadius003.webp new file mode 100644 index 0000000000000000000000000000000000000000..05e2ec0e5266ea1d4d73af76e40b1ad363ee26d0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderRadius003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..8454d0ae616d0fca2af7614575fcc2b85c2fd752 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca093fcf6b4e83ba925eb4ed65e8a3a3d3addedf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderWidth003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderWidth003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c2346393455ac232be55e673f968961d43b9a028 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBorderWidth003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness002.webp new file mode 100644 index 0000000000000000000000000000000000000000..d47ee6765c516aadcf05f0fcfbb190e60c85a227 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness003.webp new file mode 100644 index 0000000000000000000000000000000000000000..d47ee6765c516aadcf05f0fcfbb190e60c85a227 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness004.webp new file mode 100644 index 0000000000000000000000000000000000000000..44ed0bba9093c90a331548cedad449154c8afbde Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollBrightness004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollClip002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollClip002.webp new file mode 100644 index 0000000000000000000000000000000000000000..07f168c71deab1cdc77a2a3cd66ee007a81b9340 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollClip002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollClip003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollClip003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca093fcf6b4e83ba925eb4ed65e8a3a3d3addedf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollClip003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset001.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset002.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset003.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset004.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset005.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset006.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset007.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset008.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset009.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset010.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset011.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset012.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset013.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset013.webp new file mode 100644 index 0000000000000000000000000000000000000000..dc6e2b3de976efe8624ba3756ff2a7bf47ea716a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollCurrentOffset013.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEdgeEffect001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEdgeEffect001.webp new file mode 100644 index 0000000000000000000000000000000000000000..617ae69952c1d8ed30f8fc1c8b2832875a51e3ac Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEdgeEffect001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEdgeEffect002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEdgeEffect002.webp new file mode 100644 index 0000000000000000000000000000000000000000..617ae69952c1d8ed30f8fc1c8b2832875a51e3ac Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEdgeEffect002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEdgeEffect003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEdgeEffect003.webp new file mode 100644 index 0000000000000000000000000000000000000000..617ae69952c1d8ed30f8fc1c8b2832875a51e3ac Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEdgeEffect003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEnableScrollInteraction001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEnableScrollInteraction001.webp new file mode 100644 index 0000000000000000000000000000000000000000..617ae69952c1d8ed30f8fc1c8b2832875a51e3ac Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEnableScrollInteraction001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEnableScrollInteraction002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEnableScrollInteraction002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6ee24a7342eb33834dc4e51292586044a158e929 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEnableScrollInteraction002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEnableScrollInteraction003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEnableScrollInteraction003.webp new file mode 100644 index 0000000000000000000000000000000000000000..617ae69952c1d8ed30f8fc1c8b2832875a51e3ac Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollEnableScrollInteraction003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollFriction001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollFriction001.webp new file mode 100644 index 0000000000000000000000000000000000000000..617ae69952c1d8ed30f8fc1c8b2832875a51e3ac Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollFriction001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollFriction002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollFriction002.webp new file mode 100644 index 0000000000000000000000000000000000000000..edc5599a7b2e58afc60fb52c950c0aa95e442f86 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollFriction002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollFriction003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollFriction003.webp new file mode 100644 index 0000000000000000000000000000000000000000..2c997b511324fcf80d15c2e475a574b83e7cb9fe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollFriction003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6fd9cbd9f7d9ea0fd9bf951a425612009fef86b9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8c0774b2643ff7be7bac63d0f36dfc62f5f69157 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollHitTestBehavior001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollHitTestBehavior001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2aaf651fbaf0b7caeb22bdb83837991ddafe86d5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollHitTestBehavior001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c99730b9513fb73e6d7076e0fa5ac9bb2058f42d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient002.webp new file mode 100644 index 0000000000000000000000000000000000000000..d3952fa990cfa8a4d54216b18f1c09dd2ba65006 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient003.webp new file mode 100644 index 0000000000000000000000000000000000000000..221e9db4a860e02a42511f8801a6f75a861d31ea Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient004.webp new file mode 100644 index 0000000000000000000000000000000000000000..608422282ea42ddcd15163f37a3f96162d213b28 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient005.webp new file mode 100644 index 0000000000000000000000000000000000000000..78e0e6bd69a2890a51f4f7316c3635cd0df47b80 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient006.webp new file mode 100644 index 0000000000000000000000000000000000000000..e6dfa6f383b3c3402dd36924800b7ed0f19d5bf0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient007.webp new file mode 100644 index 0000000000000000000000000000000000000000..2a8dd2ccdd1a335ca44bf35411150b3488a5219f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient008.webp new file mode 100644 index 0000000000000000000000000000000000000000..4d34a3fdc09a3a6bf38e9aacd535ddc9e72732c2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient009.webp new file mode 100644 index 0000000000000000000000000000000000000000..608422282ea42ddcd15163f37a3f96162d213b28 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollLinearGradient009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ddc77566d1a0df7f4549b390950072e0bb5864f7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll002.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c9de461d32a0876e1741fe326360222eca7d4f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll003.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c9de461d32a0876e1741fe326360222eca7d4f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll004.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c9de461d32a0876e1741fe326360222eca7d4f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll005.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c9de461d32a0876e1741fe326360222eca7d4f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll006.webp new file mode 100644 index 0000000000000000000000000000000000000000..ddc77566d1a0df7f4549b390950072e0bb5864f7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll007.webp new file mode 100644 index 0000000000000000000000000000000000000000..ddc77566d1a0df7f4549b390950072e0bb5864f7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll008.webp new file mode 100644 index 0000000000000000000000000000000000000000..ddc77566d1a0df7f4549b390950072e0bb5864f7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollNestedScroll008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnAppear001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnAppear001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a7084667f415099f98a64ef9197d0d761bff1707 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnAppear001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScroll001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScroll001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cf78f312d81666e5f07c4b99d0c01bb6fcf34e85 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScroll001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScroll002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScroll002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8076713ad7087347a5150ee9da09b618d0ae716c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScroll002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollEdge001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollEdge001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cf78f312d81666e5f07c4b99d0c01bb6fcf34e85 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollEdge001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollEdge002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollEdge002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8076713ad7087347a5150ee9da09b618d0ae716c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollEdge002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollFrameBegin001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollFrameBegin001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cf78f312d81666e5f07c4b99d0c01bb6fcf34e85 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollFrameBegin001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollFrameBegin002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollFrameBegin002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8076713ad7087347a5150ee9da09b618d0ae716c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollFrameBegin002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStart001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStart001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cf78f312d81666e5f07c4b99d0c01bb6fcf34e85 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStart001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStart002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStart002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8076713ad7087347a5150ee9da09b618d0ae716c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStart002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStop001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStop001.webp new file mode 100644 index 0000000000000000000000000000000000000000..cf78f312d81666e5f07c4b99d0c01bb6fcf34e85 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStop001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStop002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStop002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8076713ad7087347a5150ee9da09b618d0ae716c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOnScrollStop002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7a073e13382394ae1ddab76fc2a8a599f5ab66c8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity002.webp new file mode 100644 index 0000000000000000000000000000000000000000..296e7f87d76e4dbfc33e9c371a68bd89c0cd8b78 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity003.webp new file mode 100644 index 0000000000000000000000000000000000000000..d60645c363825a57b222c72d3c94ded2a1adbf4d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity004.webp new file mode 100644 index 0000000000000000000000000000000000000000..89fbe0b082ae2b9670150baaaafab5bd57a9ae60 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOpacity004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1c4f918c2b2d12c215744aa6d9bba4473df8ed1a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3a4248552907cb5ee1ca0807d2efd66875443dac Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay003.webp new file mode 100644 index 0000000000000000000000000000000000000000..90683156932817e7a3b7fa258484eb85a2bebe04 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay004.webp new file mode 100644 index 0000000000000000000000000000000000000000..e92808934cd3fd57ee89f529a997eaf09f487a77 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay005.webp new file mode 100644 index 0000000000000000000000000000000000000000..870898a60d25cad6778dae3491e3d4f6613a7a64 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay006.webp new file mode 100644 index 0000000000000000000000000000000000000000..86d4c87a9f5064a3aa3f81d1668be37d3ef1f7cf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay007.webp new file mode 100644 index 0000000000000000000000000000000000000000..766ee3310a640eb845ba14620796594fda5bc2e0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay008.webp new file mode 100644 index 0000000000000000000000000000000000000000..a8da581cde9e97d894c92e57d817bfb5707442a4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay009.webp new file mode 100644 index 0000000000000000000000000000000000000000..2abfd5926db93ec3dd50ab6cebd49139ac75ae00 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollOverlay009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollPageEnable001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollPageEnable001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d5abdaa0e56c7b0bbb3a149001588be5b61597bf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollPageEnable001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollPageEnable002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollPageEnable002.webp new file mode 100644 index 0000000000000000000000000000000000000000..301fa4a057d3d5e960005dc5c981219ef751df8c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollPageEnable002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollPosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollPosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..8888c0d75fe72495b17e18f9d7e80391267a1661 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollPosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollRotate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollRotate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollRotate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollRotate002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollRotate002.webp new file mode 100644 index 0000000000000000000000000000000000000000..d51713d916bbf2b52d450a88c14eb737660e8266 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollRotate002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollRotate003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollRotate003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c44bff68cef14ea36fc9081e6fe865dd86eba178 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollRotate003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate002.webp new file mode 100644 index 0000000000000000000000000000000000000000..09ce3364f1dd770bd6f822485694bb70885013e7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate003.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate004.webp new file mode 100644 index 0000000000000000000000000000000000000000..8f179303f881cdaec2ed4b7ba8f02b8520711fa7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollSaturate004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScale001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScale001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScale001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScale002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScale002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca7fecaeb656914a2499ab91729f780a9b571ca1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScale002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScale003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScale003.webp new file mode 100644 index 0000000000000000000000000000000000000000..4e56a097110c127de574a314202f12e461289318 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScale003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ec362f6d31601a9b6d0a95104c36419f4bce08e6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..e445181d3237cc55dbe6c272121e29a83d147ad9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca093fcf6b4e83ba925eb4ed65e8a3a3d3addedf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor005.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca093fcf6b4e83ba925eb4ed65e8a3a3d3addedf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollBarColor005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a7084667f415099f98a64ef9197d0d761bff1707 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge002.webp new file mode 100644 index 0000000000000000000000000000000000000000..53b7b0511dbfc8427433fa9d2c7d21d82bf8b170 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ac5fce4ccd040bd34be80f291e00cd9da6cb7cc6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ac5fce4ccd040bd34be80f291e00cd9da6cb7cc6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollEdge004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1f2f80f7a2d9f4379216e23949beca3218d8f39b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap002.webp new file mode 100644 index 0000000000000000000000000000000000000000..89b75fc5d2b4fcb0e954671f78e8378ad0fcce82 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap003.webp new file mode 100644 index 0000000000000000000000000000000000000000..dcc9064449fdce237bcf5c00754db320d8656957 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap004.webp new file mode 100644 index 0000000000000000000000000000000000000000..006860c18c36e45521854cf64887bd84efdea4c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap005.webp new file mode 100644 index 0000000000000000000000000000000000000000..7196aaaa302116d81ab7368185afddc5fed1e540 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap006.webp new file mode 100644 index 0000000000000000000000000000000000000000..2e39988fa18bffaf89caf96d96fdf9ca3675c754 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollSnap006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo003.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo004.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo005.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo006.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo007.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo008.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo009.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo010.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo011.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo012.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo013.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo013.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f2fc0da27101615e9c3a633c4adbae226bbe8d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollTo013.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable002.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable003.webp new file mode 100644 index 0000000000000000000000000000000000000000..53458ee790f9dcd41cc0146651eb1f23f8e5912a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca093fcf6b4e83ba925eb4ed65e8a3a3d3addedf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollable004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70c93fdab0e61b8f7ef6ee98f69d631defd03f58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar002.webp new file mode 100644 index 0000000000000000000000000000000000000000..617ae69952c1d8ed30f8fc1c8b2832875a51e3ac Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca093fcf6b4e83ba925eb4ed65e8a3a3d3addedf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca093fcf6b4e83ba925eb4ed65e8a3a3d3addedf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollScrollbar004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca340d4a879428e4bd0d3fd617506f0d484addf1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow002.webp new file mode 100644 index 0000000000000000000000000000000000000000..c104bcee0637dec09cbffd6c360a4bc045e1dc67 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6a1ed1f9b5f518900b8cc97ac7c9e5a8d14f2ccf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow004.webp new file mode 100644 index 0000000000000000000000000000000000000000..564c90bb7f78e0f7e5ed3bd66202cbf4634f49c4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow005.webp new file mode 100644 index 0000000000000000000000000000000000000000..6077d451f094f7e6996fa095fbf9721a85b5f9ee Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow006.webp new file mode 100644 index 0000000000000000000000000000000000000000..c5e6d60170d51f5a3be88a611a0be611fda752f9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollShadow006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollTranslate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollTranslate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..213fc2192c8db515d45635360087a5243cf869ab Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollTranslate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollTranslate002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollTranslate002.webp new file mode 100644 index 0000000000000000000000000000000000000000..506ab14e413010879d403ee6c592b1275555eaab Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollTranslate002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd4a4b93163eb215e3a4a9457f18938f33ca3a51 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ba036f0bc52ff08af1cfa6a7d5259d0619c666cd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testScrollWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b4db714a7f0c7bbfa0c5f70a2949a6cef29b3c7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderBlockColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderBlockColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..854eb72001691ddcf35d5e1734e4e1c414fba952 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderBlockColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderBlockStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderBlockStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..db0ccdbe7f06a754f415458e8a87cc4f074415db Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderBlockStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderBlockStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderBlockStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f2a88cc82eb7fa1d6442f7dccb762811b9f188ec Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderBlockStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderDirection001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderDirection001.webp new file mode 100644 index 0000000000000000000000000000000000000000..fec68f2d636169c0101834fcb26513e40d5102b6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderDirection001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderDirection002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderDirection002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderDirection002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderEnabled001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderEnabled001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4ca9bc4a44783f81d2f2454e5ebf56029bd07c55 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderEnabled001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderEnabled002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderEnabled002.webp new file mode 100644 index 0000000000000000000000000000000000000000..4caae981c1061ef967511079e4c65d7253fad520 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderEnabled002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderEnabled003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderEnabled003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c278a440df2829a13d17cbb5a800e94a9f0e08bd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderEnabled003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..17fde89a59c47eb80bb07ff814d4379d56025401 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..11de3a8436093f315f122b3f9432345ca26637d6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax003.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax004.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMax004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMin001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMin001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMin001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMin002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMin002.webp new file mode 100644 index 0000000000000000000000000000000000000000..61c6faa4e0b5ce6b97fb1e56e7622f4cab21591e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMin002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMin003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMin003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad611c712b31d741139fcbcb8179b32a511edc5c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderMin003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderOnChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderOnChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f012e9d9c35bafe57252ec2581cb43b8c0edfbd0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderOnChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderReverse001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderReverse001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e463cb924e22817a7dd962013dc67d1093c2bd32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderReverse001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderReverse002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderReverse002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderReverse002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderReverse003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderReverse003.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderReverse003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderSelectedColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderSelectedColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..de92cacc1e6beb7b451daa734d3a4ed28b72bf21 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderSelectedColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderShowSteps001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderShowSteps001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4af0ba0cc06cac1321813ca8c365ae2ed7f58a8d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderShowSteps001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderShowSteps002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderShowSteps002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderShowSteps002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ed039d83aa89759fbe5a507264cb007343d2e6c2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep002.webp new file mode 100644 index 0000000000000000000000000000000000000000..114058d221af41ac6a5a1f9f5c9bbcd91966eb84 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep003.webp new file mode 100644 index 0000000000000000000000000000000000000000..64441669b7dcc9dcc0453324c4495ee2a9ed7479 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep004.webp new file mode 100644 index 0000000000000000000000000000000000000000..87b94cb4c5ad218cdbe6e67162c93b24a663bcda Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStep004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..46f70c0faf5db7e5cf7a010998801e9fb4b8e81c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStyle003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStyle003.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderStyle003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderTrackColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderTrackColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..86d8162b353634a6cf9ad06b9b7f03404c61e218 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderTrackColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderValue001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderValue001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b0025de5cf105caa194163638621fe8fa6515318 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderValue001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderValue002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderValue002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a98c08c8faffda22b7c1416c581e48b3534b9e70 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderValue002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderValue003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderValue003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad611c712b31d741139fcbcb8179b32a511edc5c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderValue003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..348d68f17d04b717ffc9e7621b94200ba4b3251c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..c0d393e63fce0c55edbdbf6e2b509d52945ace3c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSliderWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanDecoration001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanDecoration001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6a062d04b4c51f0030af87602527e1493fa67989 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanDecoration001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..80a5020dda4277fe9b9771dd0167efc74dd431e6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontSize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontSize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..39a1b4e77863e763bdb31eb8d6c7f555541bb7b4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontSize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3210809ff05e46a8833ef8e25ae9710b21ff5431 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontWeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontWeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..95bbcb033827edf33847c78586dec68d3ced59f4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanFontWeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanLetterSpacing001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanLetterSpacing001.webp new file mode 100644 index 0000000000000000000000000000000000000000..19d5c6bf481bbef9e8a273543a2c57e405ae23da Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanLetterSpacing001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanLineHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanLineHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..81146254299f629bfac8b327ba895c8967a4fa43 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanLineHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanTextCase001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanTextCase001.webp new file mode 100644 index 0000000000000000000000000000000000000000..443cbd7820553e9a0b0106daee0ea9d7b0c2b104 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSpanTextCase001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackAlign001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackAlign001.webp new file mode 100644 index 0000000000000000000000000000000000000000..232d2adff75b76d9fc4000ce5ce157ade07f5efe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackAlign001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundBlurStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundBlurStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3933fa48d98d2ad1ae9808d36e5686bd2b549665 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundBlurStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7460a865d863d0a713661dc62eb275ee01c1816b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundImage001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundImage001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2b8df7b30d25ca5091a0e946c47985119c546612 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundImage001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundImagePosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundImagePosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..da882849ee0397c956b6766dcddc4e93fbbf58c0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundImagePosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundImageSize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundImageSize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..bed2d05cf236a32d94727bed1b684ccb3d811d02 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBackgroundImageSize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e658ed36c412d2084c5843a84ff0c68a0a487689 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderRadius001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderRadius001.webp new file mode 100644 index 0000000000000000000000000000000000000000..8ecfe007b45557e529867a52322aca77dc247313 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderRadius001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c74715c4c0f905acadf6ff2e6eca129e9683d36b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a4dd910aa5598af6d94a9d205597ab345dff2d3d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBorderWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBrightness001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBrightness001.webp new file mode 100644 index 0000000000000000000000000000000000000000..223e2a68bf3c52d9c843c865fbef4b4a2a859213 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackBrightness001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70410d6da302efc6ba95675c6ea521709661152e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..031e727365760f84f4abd36473e9fca64fa849de Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32a7126611d68cc2ac879c3e70dfbaaf7d796de9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackHitTestBehavior001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackHitTestBehavior001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2aaf651fbaf0b7caeb22bdb83837991ddafe86d5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackHitTestBehavior001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackId001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackId001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a9fd7a8ce3a5e9096a5ef399522c16fb8771eb81 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackId001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackLinearGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackLinearGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3269790e3cc1641c7549f238d6e7a297647a4017 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackLinearGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackMargin001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackMargin001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d67a541fff41bc0f79f2cfbbb6c65b81fce90586 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackMargin001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnAreaChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnAreaChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6763b6349861b278298ce764b715afa7b3d6e7d9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnAreaChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnAreaChange002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnAreaChange002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3cf143072813a1c1805342d0718c3c919b5daefa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnAreaChange002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnAreaChange003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnAreaChange003.webp new file mode 100644 index 0000000000000000000000000000000000000000..dd1d53e2e74739d32571c673d9d856e7f191154c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnAreaChange003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnTouch001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnTouch001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c6b6b8726b5c5f7f2c06db96b90b27c9251cd7e6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnTouch001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnTouch002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnTouch002.webp new file mode 100644 index 0000000000000000000000000000000000000000..53d5799a934fd10e9eca996e13e49c5314e24b0f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOnTouch002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOpacity001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOpacity001.webp new file mode 100644 index 0000000000000000000000000000000000000000..681a917d0dfed113c6eda3cd6e544e541b2983f3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackOpacity001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackPosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackPosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..492955d5280dd04d8571569fdccd1b30e012f2fe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackPosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackRotate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackRotate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b2a105f0fd4c943a2e4f73e668f569bfd6b7c1f6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackRotate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackSaturate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackSaturate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b0c6fbcc719ea77985e2258e2952676f67689373 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackSaturate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackScale001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackScale001.webp new file mode 100644 index 0000000000000000000000000000000000000000..968a51d1b2202c49a91abf9e499cc6723165c29b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackScale001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackShadow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackShadow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..501e7dfb1118c6618f49550f869314a02b9a6a1d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackShadow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackTransform001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackTransform001.webp new file mode 100644 index 0000000000000000000000000000000000000000..73d3dc06082a604420ebc22bb3380b6494b60567 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackTransform001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackTransition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackTransition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1424c61f5d88612e56ecda5e842e2d7785053760 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackTransition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackTranslate001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackTranslate001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e90a195abc8c51b21d4a1d99e32a55de0ea34323 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackTranslate001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f40489da818eaffa5eb7eb55705f4f32782f2cee Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..4af450fee9f4e6c219091830de3fcf3eee8e001c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testStackWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6c749ab0fd27aa5a304fd323945676909e9ccbbe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAutoPlay001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAutoPlay001.webp new file mode 100644 index 0000000000000000000000000000000000000000..83f06ec20adad82c27665cc3b5fd89c6147a2916 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAutoPlay001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAutoPlay002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAutoPlay002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8f5e7ff78db82b4444d773599a32e7577ac8d4df Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAutoPlay002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAutoPlay003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAutoPlay003.webp new file mode 100644 index 0000000000000000000000000000000000000000..8f5e7ff78db82b4444d773599a32e7577ac8d4df Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperAutoPlay003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..167d5c254cc0326b0494aac7f2842c1270bb7a33 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperBackgroundImage001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperBackgroundImage001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5890d67982f9080a6906f2086be98d1affcf2e66 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperBackgroundImage001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperCachedCount001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperCachedCount001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d078a68b523498575097c7575355f72733f0e796 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperCachedCount001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..81801252ab576c24a9f06e5a1d61fe4af18fd278 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperCurve001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperCurve001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6b1dc36a31feef0c46dc08270861bc8bb4862972 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperCurve001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDisableSwipe001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDisableSwipe001.webp new file mode 100644 index 0000000000000000000000000000000000000000..78531365a46cc6ea374e7825d7c7e2a409c56cbd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDisableSwipe001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDisplayArrow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDisplayArrow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a905be78ee8616da6bb580367b92c12cc4807266 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDisplayArrow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDisplayCount001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDisplayCount001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9e459b226a44185270ebed07b18364750df3ae0d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDisplayCount001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDuration001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDuration001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0833d941ce010b88a40171baed67ed65107efc15 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperDuration001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..358a486efdb3dd6ad0297a48b47f6f837f4eeb77 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6f674b90e98a25379074a575454331d906cb7a20 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperIndex001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperIndex001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f300e5df17be5d06ad49d510702870e808bef48e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperIndex001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperIndicator001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperIndicator001.webp new file mode 100644 index 0000000000000000000000000000000000000000..99778372156cf805f5f239c512a7487a98a90639 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperIndicator001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperInterval001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperInterval001.webp new file mode 100644 index 0000000000000000000000000000000000000000..17c98e01d5cf14484aca7b223ae4a9b89ab87aad Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperInterval001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperItemSpace001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperItemSpace001.webp new file mode 100644 index 0000000000000000000000000000000000000000..8f15e29e6e3439026bc10d75195acd423764d8bb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperItemSpace001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperLoop001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperLoop001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2b4eb24441db253997504570df4ea2449f198a52 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperLoop001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperPosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperPosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b5719131f37f80388684452558f50951dd014a28 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperPosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperVertical001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperVertical001.webp new file mode 100644 index 0000000000000000000000000000000000000000..dd23bf00604bd3477d19452b0fe5bd8b1d693891 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperVertical001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b623775fc614492deb716fe1ff94de295ab6d318 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..edc545754bb411641488bc4532cb2616de892a12 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testSwiperWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad6825b185de786dfc282eb8f808deb5eb5d9cf6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAlign001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAlign001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9af10ab5870512bd97452199b671257ec7a1eaa4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAlign001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAlignRules001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAlignRules001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5a3eb53848105312ef6d46652d6fe1b65e66c416 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAlignRules001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f0448d9ae540e823f5454707b22afe7a3b209891 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBackgroundColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBackgroundColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..71ababc6905443a002557c603f95010b06bf81eb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBackgroundColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBackgroundColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBackgroundColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..23d320eee0fa1d3c64f770a5fa0f0bc9d050a35b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBackgroundColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBorderRadius001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBorderRadius001.webp new file mode 100644 index 0000000000000000000000000000000000000000..27fa3bb73a29f2471a46a9e1b41bb5c99a479859 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBorderRadius001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBorderRadius002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBorderRadius002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3cd690171b5130d67427aabfd84dd4ea3b4f1f08 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBorderRadius002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBorderRadius003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBorderRadius003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ab7ff24054ca5a3a8485593c06874e6db73bfded Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaBorderRadius003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaCaretColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaCaretColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..bc4ea4f21ee8970e3809238b18c662998e7d1af7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaCaretColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaCaretColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaCaretColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..1a856ce3de7ee46172e5190a0ca22e13696ce58f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaCaretColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaCaretColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaCaretColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..8608b59bb144bfcd4844629c4845afb50aa11ff8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaCaretColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus001.webp new file mode 100644 index 0000000000000000000000000000000000000000..52a6603b94f80453486a5d74609d54e55f7da59a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f707694b411784b74b93230731aa18eb99083f24 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus003.webp new file mode 100644 index 0000000000000000000000000000000000000000..f707694b411784b74b93230731aa18eb99083f24 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus004.webp new file mode 100644 index 0000000000000000000000000000000000000000..209618c29b8ccb47781be9f2dc410e2280e2a14b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus005.webp new file mode 100644 index 0000000000000000000000000000000000000000..52a6603b94f80453486a5d74609d54e55f7da59a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus006.webp new file mode 100644 index 0000000000000000000000000000000000000000..3ffa6926980f6b85896609529e949bd2272f8d30 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaDefaultFocus006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaEnabled001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaEnabled001.webp new file mode 100644 index 0000000000000000000000000000000000000000..22ca99796ed8989add722bca0ab505218ae48f60 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaEnabled001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaEnabled002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaEnabled002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8e84e4ac2a9b845f7281c813d7a26050caf26a61 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaEnabled002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaEnabled003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaEnabled003.webp new file mode 100644 index 0000000000000000000000000000000000000000..97af78791689fb905cfdaffa13579a1107063428 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaEnabled003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ab7ff24054ca5a3a8485593c06874e6db73bfded Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ab7ff24054ca5a3a8485593c06874e6db73bfded Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ab7ff24054ca5a3a8485593c06874e6db73bfded Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontFamily001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontFamily001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d855962116635f0acfb4efe35a44e13a1c8a1cff Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontFamily001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontFamily002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontFamily002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7d8a8e1f3fefbc11686c32ff78cbcc582a7cfff2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontFamily002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontSize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontSize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..537671d1d32a35c1682399e2d981f9ed98f4861d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontSize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontSize002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontSize002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ab7ff24054ca5a3a8485593c06874e6db73bfded Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontSize002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontSize003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontSize003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c246f3480454fa5cd1e478c7937507a581b01d2a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontSize003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d82307dc9ee6c97825b8ced91f7d8c1b34ecb299 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..5f9693e325eb589f074bbb243d9632c2fe60d1e8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f8f6c7bf3a17692ba23891e297aa9de155323c20 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..86c7fc3d7e7a0c189859066c032f51af8fc1d3e9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight003.webp new file mode 100644 index 0000000000000000000000000000000000000000..48302d48db9ba1881e9e9ffd3fe2913d7a9be60c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight004.webp new file mode 100644 index 0000000000000000000000000000000000000000..b08fb4d2aa776e2dd14e164a873381a95b78c96c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight005.webp new file mode 100644 index 0000000000000000000000000000000000000000..69da8338fc87bce8f475aed77ce787755234cbb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight006.webp new file mode 100644 index 0000000000000000000000000000000000000000..c2ac39841be343e5ca5f6e147d6aff58f5f3f702 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight007.webp new file mode 100644 index 0000000000000000000000000000000000000000..239627420b13cc62fc90034ed5ee2e3f7868c92a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight008.webp new file mode 100644 index 0000000000000000000000000000000000000000..2993bbb3c7399026ba4e5a5101e9803874dd55cf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight009.webp new file mode 100644 index 0000000000000000000000000000000000000000..cd7ea05e7ff426ef425b9347bc1e5fd054745346 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight010.webp new file mode 100644 index 0000000000000000000000000000000000000000..239627420b13cc62fc90034ed5ee2e3f7868c92a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight011.webp new file mode 100644 index 0000000000000000000000000000000000000000..b08fb4d2aa776e2dd14e164a873381a95b78c96c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight012.webp new file mode 100644 index 0000000000000000000000000000000000000000..cd7ea05e7ff426ef425b9347bc1e5fd054745346 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight013.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight013.webp new file mode 100644 index 0000000000000000000000000000000000000000..f8f6c7bf3a17692ba23891e297aa9de155323c20 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight013.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight014.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight014.webp new file mode 100644 index 0000000000000000000000000000000000000000..69da8338fc87bce8f475aed77ce787755234cbb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight014.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight015.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight015.webp new file mode 100644 index 0000000000000000000000000000000000000000..b08fb4d2aa776e2dd14e164a873381a95b78c96c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight015.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight016.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight016.webp new file mode 100644 index 0000000000000000000000000000000000000000..86c7fc3d7e7a0c189859066c032f51af8fc1d3e9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaFontWeight016.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0189cb5283e0e33b31f7f9fa85878a3002c160fa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..56a4da7ef6390d914d3705fd2ef1cab348fc8fce Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaKey001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaKey001.webp new file mode 100644 index 0000000000000000000000000000000000000000..88fc526f8629658075696bf6b26f6e73b77b9c71 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaKey001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaLineHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaLineHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f58d970cc894834557b116d3b58292aabafb0026 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaLineHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaLineHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaLineHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..d4452490e710abd4dd3f8651594ad82f74a9f490 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaLineHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaMaxLength001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaMaxLength001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2700bf9f4bd1f5ea72355f1cb9ad218f44dacd26 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaMaxLength001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaMaxLength002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaMaxLength002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ab7ff24054ca5a3a8485593c06874e6db73bfded Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaMaxLength002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaMaxLength003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaMaxLength003.webp new file mode 100644 index 0000000000000000000000000000000000000000..ffbc84a9c25c834c411b075a054bcd5ece836c7a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaMaxLength003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaOnBlur001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaOnBlur001.webp new file mode 100644 index 0000000000000000000000000000000000000000..02c2bfe21326fdaf5f05f9413e2c953b9bb44a1d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaOnBlur001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaOnChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaOnChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..8be6159ceda43e8d90b20f70e4509a4a9200bc32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaOnChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaOnFocus001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaOnFocus001.webp new file mode 100644 index 0000000000000000000000000000000000000000..02c2bfe21326fdaf5f05f9413e2c953b9bb44a1d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaOnFocus001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPadding001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPadding001.webp new file mode 100644 index 0000000000000000000000000000000000000000..98bf6e449d174d412f819ef77a46beac53105e50 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPadding001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPadding002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPadding002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ec23203ccc99e486b5adcb9615a33aa75d9da815 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPadding002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..88c8c503a3ee0e94d4d3e677142e7ce928456463 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..4370f61fb8055deaaa2391b9d8cf9edfe02faae7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..1d55c32b54e853d97e88c6bfdde648081d0310d0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont001.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd259ffcf7033a3234d169bab21900ca642f5a3f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont002.webp new file mode 100644 index 0000000000000000000000000000000000000000..b57e29ae544145ef324d730433404f1474268bb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont003.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd259ffcf7033a3234d169bab21900ca642f5a3f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont004.webp new file mode 100644 index 0000000000000000000000000000000000000000..b57e29ae544145ef324d730433404f1474268bb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont005.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd259ffcf7033a3234d169bab21900ca642f5a3f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont006.webp new file mode 100644 index 0000000000000000000000000000000000000000..b57e29ae544145ef324d730433404f1474268bb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont007.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd259ffcf7033a3234d169bab21900ca642f5a3f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont008.webp new file mode 100644 index 0000000000000000000000000000000000000000..b57e29ae544145ef324d730433404f1474268bb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont009.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd259ffcf7033a3234d169bab21900ca642f5a3f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont010.webp new file mode 100644 index 0000000000000000000000000000000000000000..b57e29ae544145ef324d730433404f1474268bb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont011.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd259ffcf7033a3234d169bab21900ca642f5a3f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont012.webp new file mode 100644 index 0000000000000000000000000000000000000000..b57e29ae544145ef324d730433404f1474268bb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont013.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont013.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd259ffcf7033a3234d169bab21900ca642f5a3f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont013.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont014.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont014.webp new file mode 100644 index 0000000000000000000000000000000000000000..b57e29ae544145ef324d730433404f1474268bb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont014.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont015.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont015.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd259ffcf7033a3234d169bab21900ca642f5a3f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont015.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont016.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont016.webp new file mode 100644 index 0000000000000000000000000000000000000000..b57e29ae544145ef324d730433404f1474268bb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont016.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont017.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont017.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd259ffcf7033a3234d169bab21900ca642f5a3f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont017.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont018.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont018.webp new file mode 100644 index 0000000000000000000000000000000000000000..b57e29ae544145ef324d730433404f1474268bb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont018.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont019.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont019.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd259ffcf7033a3234d169bab21900ca642f5a3f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont019.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont020.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont020.webp new file mode 100644 index 0000000000000000000000000000000000000000..b57e29ae544145ef324d730433404f1474268bb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPlaceholderFont020.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..68406c7fbe571b2cc9b2be1c0305283fb50a2135 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaPosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaResponseRegion001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaResponseRegion001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b60f005ddb8c8166e993e411f0609f694e824852 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaResponseRegion001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaResponseRegion002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaResponseRegion002.webp new file mode 100644 index 0000000000000000000000000000000000000000..88fc526f8629658075696bf6b26f6e73b77b9c71 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaResponseRegion002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing001.webp new file mode 100644 index 0000000000000000000000000000000000000000..093e8f39b25b973c69b48a5b87c22f4abeef5eb6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ab7ff24054ca5a3a8485593c06874e6db73bfded Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing003.webp new file mode 100644 index 0000000000000000000000000000000000000000..093e8f39b25b973c69b48a5b87c22f4abeef5eb6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing004.webp new file mode 100644 index 0000000000000000000000000000000000000000..093e8f39b25b973c69b48a5b87c22f4abeef5eb6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing005.webp new file mode 100644 index 0000000000000000000000000000000000000000..8a5171f32a10c8c44d0b4deb330a18083cebaa3a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing006.webp new file mode 100644 index 0000000000000000000000000000000000000000..093e8f39b25b973c69b48a5b87c22f4abeef5eb6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaStopEditing006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign001.webp new file mode 100644 index 0000000000000000000000000000000000000000..7d8a8e1f3fefbc11686c32ff78cbcc582a7cfff2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a5b3ad682cc84b2432516cc9e26d9fdb84855df5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c87604f1ba1d2d86beec678d154e242b46f25f86 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign004.webp new file mode 100644 index 0000000000000000000000000000000000000000..c246f3480454fa5cd1e478c7937507a581b01d2a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign005.webp new file mode 100644 index 0000000000000000000000000000000000000000..d855962116635f0acfb4efe35a44e13a1c8a1cff Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaTextAlign005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..eefda4c0b965b3f8ac8d0bbe0abc09ebb4437e82 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..1546f751d0d198b86b875dda32e7de1915d9ba67 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextAreaWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1629eb71df10461ce3a1c42a457c074d5f61264b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBackgroundImage001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBackgroundImage001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6e77aa9a8c7add9a82bfd0e8b2b65e7967fd8ff2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBackgroundImage001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBaselineOffset001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBaselineOffset001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4cf44ba93130aa7db5961285390fd25d6331200f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBaselineOffset001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBorderColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBorderColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..023b4f3eba03d7539de63975222601a1c85b0242 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBorderColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBorderRadius001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBorderRadius001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0aeef4a0fdd7d9361a191be1a1f12bb2bbff2eb2 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBorderRadius001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBorderWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBorderWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d6f34780cae38e181a1b752e6f11528eca67ed5f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextBorderWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1f41d3eb4252a78c1ca6e7cc862602e98438524e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextCopyOption001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextCopyOption001.webp new file mode 100644 index 0000000000000000000000000000000000000000..79b8df4685df2fc077ddff8f07982e0a572dfc7a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextCopyOption001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextDecoration001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextDecoration001.webp new file mode 100644 index 0000000000000000000000000000000000000000..855e8d3005da78250ce1b687d7d598280a6eb38e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextDecoration001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextEnabled001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextEnabled001.webp new file mode 100644 index 0000000000000000000000000000000000000000..026023bdd5c6b45bb73df9fafbe095ea41cc9fda Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextEnabled001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextEnabled002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextEnabled002.webp new file mode 100644 index 0000000000000000000000000000000000000000..d126025c450c5051388ad152acaefd20cb403a23 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextEnabled002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextEnabled003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextEnabled003.webp new file mode 100644 index 0000000000000000000000000000000000000000..36ed4aaf6458a2207595720902ab07f1efc25d48 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextEnabled003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFont001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFont001.webp new file mode 100644 index 0000000000000000000000000000000000000000..503b537336f423c6f9490769ad211007576f2df9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFont001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..aa966f17d2770f908a422ba973008a0bf879cd4d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontFamily001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontFamily001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6de8e77474dfa7aeaadea157c78c4f3aacafb563 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontFamily001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontSize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontSize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0cacbe6239f04b2ef6fb47f98b578aeb4185aa4f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontSize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c37e9baeb9dfe154a070b3e95cbe4aed63a8a817 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontWeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontWeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ade90ad9584d59364b3a7c16e95b0a8377c531e7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextFontWeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..031e727365760f84f4abd36473e9fca64fa849de Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32a7126611d68cc2ac879c3e70dfbaaf7d796de9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextHeightAdaptivePolicy001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextHeightAdaptivePolicy001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad9265711c3374b1c85238601242531abb9ab170 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextHeightAdaptivePolicy001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f96c515d56fe660c683a6d50938a498f211f7ba3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..254657cf22d233b8c5811e97c95695f35ffef23d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputBackgroundImage001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputBackgroundImage001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9a6ba18e2907c00bd1c9e7d542dea270b4625440 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputBackgroundImage001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1a1b020dff5ce3fea95a225360650ab2d33611e6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..da11eb3a3119a044be371b6cabded398f0bf787b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e1ecc820e010a73eb89f0c5082c1128f0349b6f8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..e370537ce8cfe5ea7dd002cc72f35183ded5c704 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle003.webp new file mode 100644 index 0000000000000000000000000000000000000000..4d9598437a3ae2cf39e95e59debc979a3f26c382 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle004.webp new file mode 100644 index 0000000000000000000000000000000000000000..bfe637724fc0a3a1979fe4604350b362d3450f8f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputCaretStyle004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2e558333a9365fea8e39a0e3fcfb73a26168bb64 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode002.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca3f41456df0055dc284aaa5bcc4ab05f69f4357 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode003.webp new file mode 100644 index 0000000000000000000000000000000000000000..9b7570b23c1c6a391e4fdde602a682494cffbb3c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ca3f41456df0055dc284aaa5bcc4ab05f69f4357 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClearButtonMode004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e86c6ed97cd33e4c9fb0db5855595ad9bad2cd1f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e3ae5ca081275155daa6a24764e898a2c710ff5b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus002.webp new file mode 100644 index 0000000000000000000000000000000000000000..68abbb1dca739e98f6baa2a306886b2d0179014c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus003.webp new file mode 100644 index 0000000000000000000000000000000000000000..68abbb1dca739e98f6baa2a306886b2d0179014c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus004.webp new file mode 100644 index 0000000000000000000000000000000000000000..22a8518494500390c339d86752af6df06932368c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus005.webp new file mode 100644 index 0000000000000000000000000000000000000000..e3ae5ca081275155daa6a24764e898a2c710ff5b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus006.webp new file mode 100644 index 0000000000000000000000000000000000000000..68abbb1dca739e98f6baa2a306886b2d0179014c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputDefaultFocus006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnableKeyboardOnFocus001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnableKeyboardOnFocus001.webp new file mode 100644 index 0000000000000000000000000000000000000000..95d994be97daeb9415f260e7e16b2701d42fcaa5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnableKeyboardOnFocus001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnableKeyboardOnFocus002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnableKeyboardOnFocus002.webp new file mode 100644 index 0000000000000000000000000000000000000000..a493f6f0bda9dd1bbc2008ef6cbca93811bd4c50 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnableKeyboardOnFocus002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnableKeyboardOnFocus003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnableKeyboardOnFocus003.webp new file mode 100644 index 0000000000000000000000000000000000000000..95d994be97daeb9415f260e7e16b2701d42fcaa5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnableKeyboardOnFocus003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnabled001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnabled001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c77c5543f549a94e03b75606b33974f350a414c5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnabled001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnabled002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnabled002.webp new file mode 100644 index 0000000000000000000000000000000000000000..fb5954e45db47ae1a9d1efc7c56bc567b5c74b58 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnabled002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnabled003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnabled003.webp new file mode 100644 index 0000000000000000000000000000000000000000..c92a38457080f9fab7aca44611e9dee505488055 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnabled003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3d86159ca21a17a748296825436393b23169c70a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType002.webp new file mode 100644 index 0000000000000000000000000000000000000000..4699f012e63c31f85e3be578944d1206fc1fafb6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType003.webp new file mode 100644 index 0000000000000000000000000000000000000000..88227ce6eca41682f74dec425e33c6fe7bebac38 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType004.webp new file mode 100644 index 0000000000000000000000000000000000000000..81fc0e8603a5ecce186f3b2337dea64f4259934b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType005.webp new file mode 100644 index 0000000000000000000000000000000000000000..81fc0e8603a5ecce186f3b2337dea64f4259934b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType006.webp new file mode 100644 index 0000000000000000000000000000000000000000..81fc0e8603a5ecce186f3b2337dea64f4259934b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType007.webp new file mode 100644 index 0000000000000000000000000000000000000000..71b5f151d33c8323037ff836eebb242df1ac6058 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType008.webp new file mode 100644 index 0000000000000000000000000000000000000000..5a4b82e197a226945a1bf045e587425a9973101e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputEnterKeyType008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b0d6aba821273a81f12da608ab291a37661263a5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontFamily001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontFamily001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5338e5124548b2a5f8d78518f76f12c6efe68f17 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontFamily001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontFamily002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontFamily002.webp new file mode 100644 index 0000000000000000000000000000000000000000..5338e5124548b2a5f8d78518f76f12c6efe68f17 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontFamily002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontSize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontSize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..667b74e78efe5680db4542b20bf3085a316c2766 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontSize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..404e393259db5e96e6ef2c2832ad5517f3c214ca Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontWeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontWeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..13b7c7500d9ef4dcb7ab23aa4f50cc4f727535dd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputFontWeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70f5b5ef5d7e55ed81894f5cf7c80b55d9131d56 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..20bd1b8762ba017039aff0a8e1b56471e2a7db67 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputKey001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputKey001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e3ae5ca081275155daa6a24764e898a2c710ff5b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputKey001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputLineHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputLineHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3c76c02b66a09a37f6d6ca0c72e7616770245f0c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputLineHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputLineHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputLineHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..404e7909119dbb873123832c5f9ec362e73112c1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputLineHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputMaxLength001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputMaxLength001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b31e6e0c9f34fe032b2b17ede14934452f188365 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputMaxLength001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputMaxLength002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputMaxLength002.webp new file mode 100644 index 0000000000000000000000000000000000000000..739a72d2d16a5a143e1fb905c84fa753a82f92be Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputMaxLength002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputMaxLength003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputMaxLength003.webp new file mode 100644 index 0000000000000000000000000000000000000000..5338e5124548b2a5f8d78518f76f12c6efe68f17 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputMaxLength003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnBlur001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnBlur001.webp new file mode 100644 index 0000000000000000000000000000000000000000..790e90aebf8039f616fcfbe4e7262433832e8c7a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnBlur001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnBlur002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnBlur002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2b55b99578bb00a3e0f273805ae343bf6ce17737 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnBlur002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4b37a7e0e2906adc842ee6e71aef7cb63c6052e1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnChange002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnChange002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f464cea994bd039e39bb9d023aed879342f3e7ff Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnChange002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnCut001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnCut001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ad55caba3476c9bfb53428819fe61871d68ccbec Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnCut001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnFocus001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnFocus001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3d13baac835885341f13d03e48740326ec20b055 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnFocus001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnFocus002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnFocus002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f6961ed68f3a8db24964282bcf09d60dffa29ceb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnFocus002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnPaste001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnPaste001.webp new file mode 100644 index 0000000000000000000000000000000000000000..65a7f00bfa65054ecafcfd0b015b57c2284980f5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnPaste001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnSubmit001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnSubmit001.webp new file mode 100644 index 0000000000000000000000000000000000000000..115830794f8d58ab4c2a6ed12b8e110b5226ce8c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputOnSubmit001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPadding001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPadding001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ccd8467da65002684e473d71235e42c0e01e64f1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPadding001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..75b5b07f5894d0606cad706cc2c37c240c92eda3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..24a2b80cc500f25a684873ca5fba6562e8778f6f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d10ee3eab39151d729dceb37e31a4bff06aa5e6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0dd6a118c6823fd0b3df089e38573d0057b1c044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont002.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d9051e0179bb4a992c99a5f689a5f81b010705f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont003.webp new file mode 100644 index 0000000000000000000000000000000000000000..0dd6a118c6823fd0b3df089e38573d0057b1c044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont004.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d9051e0179bb4a992c99a5f689a5f81b010705f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont005.webp new file mode 100644 index 0000000000000000000000000000000000000000..0dd6a118c6823fd0b3df089e38573d0057b1c044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont006.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d9051e0179bb4a992c99a5f689a5f81b010705f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont007.webp new file mode 100644 index 0000000000000000000000000000000000000000..0dd6a118c6823fd0b3df089e38573d0057b1c044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont008.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont008.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d9051e0179bb4a992c99a5f689a5f81b010705f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont008.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont009.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont009.webp new file mode 100644 index 0000000000000000000000000000000000000000..0dd6a118c6823fd0b3df089e38573d0057b1c044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont009.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont010.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont010.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d9051e0179bb4a992c99a5f689a5f81b010705f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont010.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont011.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont011.webp new file mode 100644 index 0000000000000000000000000000000000000000..0dd6a118c6823fd0b3df089e38573d0057b1c044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont011.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont012.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont012.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d9051e0179bb4a992c99a5f689a5f81b010705f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont012.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont013.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont013.webp new file mode 100644 index 0000000000000000000000000000000000000000..0dd6a118c6823fd0b3df089e38573d0057b1c044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont013.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont014.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont014.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d9051e0179bb4a992c99a5f689a5f81b010705f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont014.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont015.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont015.webp new file mode 100644 index 0000000000000000000000000000000000000000..0dd6a118c6823fd0b3df089e38573d0057b1c044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont015.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont016.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont016.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d9051e0179bb4a992c99a5f689a5f81b010705f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont016.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont017.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont017.webp new file mode 100644 index 0000000000000000000000000000000000000000..0dd6a118c6823fd0b3df089e38573d0057b1c044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont017.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont018.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont018.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d9051e0179bb4a992c99a5f689a5f81b010705f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont018.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont019.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont019.webp new file mode 100644 index 0000000000000000000000000000000000000000..0dd6a118c6823fd0b3df089e38573d0057b1c044 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont019.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont020.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont020.webp new file mode 100644 index 0000000000000000000000000000000000000000..6d9051e0179bb4a992c99a5f689a5f81b010705f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPlaceholderFont020.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..20f8d14ecc3eb7f2201225351f2e452f6adc6c56 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputPosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputResponseRegion001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputResponseRegion001.webp new file mode 100644 index 0000000000000000000000000000000000000000..72d0b65954db86d57ebaa5214c219fe2e4691afa Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputResponseRegion001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputResponseRegion002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputResponseRegion002.webp new file mode 100644 index 0000000000000000000000000000000000000000..359c69767fe1373b6698cc312110f89d7617dbd5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputResponseRegion002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0a1f9f11a1eaa0a7e653575dfe961d45e2f35615 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor002.webp new file mode 100644 index 0000000000000000000000000000000000000000..7abbc9a6ce751004d8b77df04bc64c2ed9bfabda Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor003.webp new file mode 100644 index 0000000000000000000000000000000000000000..df10a7f856d2920e85710b1569f0aefd4cc00edf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor004.webp new file mode 100644 index 0000000000000000000000000000000000000000..d9aed5d8e12ec453f9ff1aff8b491ab10a73e8c3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputSelectedBackgroundColor004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputShowPasswordIcon001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputShowPasswordIcon001.webp new file mode 100644 index 0000000000000000000000000000000000000000..d2318292d326f0d4bcfe5e81e8ae26de94fa47ef Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputShowPasswordIcon001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputShowUnderLine001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputShowUnderLine001.webp new file mode 100644 index 0000000000000000000000000000000000000000..70d6efc255d023590f6f2e79e6f19516110f2589 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputShowUnderLine001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing001.webp new file mode 100644 index 0000000000000000000000000000000000000000..739a72d2d16a5a143e1fb905c84fa753a82f92be Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing002.webp new file mode 100644 index 0000000000000000000000000000000000000000..739a72d2d16a5a143e1fb905c84fa753a82f92be Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing003.webp new file mode 100644 index 0000000000000000000000000000000000000000..53dc81f627fc5b28b15d02063fa9dec77417b717 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing004.webp new file mode 100644 index 0000000000000000000000000000000000000000..739a72d2d16a5a143e1fb905c84fa753a82f92be Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing005.webp new file mode 100644 index 0000000000000000000000000000000000000000..739a72d2d16a5a143e1fb905c84fa753a82f92be Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing006.webp new file mode 100644 index 0000000000000000000000000000000000000000..739a72d2d16a5a143e1fb905c84fa753a82f92be Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputStopEditing006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputTextAlign001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputTextAlign001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4e4118690ad758577005287bb0e76775e65e0e8e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputTextAlign001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputType001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputType001.webp new file mode 100644 index 0000000000000000000000000000000000000000..072670ab7db261d7f7ef6de66ed5b632b52f3936 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputType001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1f95e81717845196b2e9e83d77753cb11dd0635c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..8a49609ec8a330bcd67edca49a24f18945becb56 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextInputWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLetterSpacing001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLetterSpacing001.webp new file mode 100644 index 0000000000000000000000000000000000000000..32ba509ca0a9744574d6163e381352bfdab92648 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLetterSpacing001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLineBreakStrategy001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLineBreakStrategy001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2752a859acca30e5c89dd957a8ae89942682565f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLineBreakStrategy001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLineHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLineHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..80f03605a6703e41d731480fde8000d758ba4b7d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLineHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLinearGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLinearGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..fe4519b7c6934db8ee2cb0918cfb3e442c385e13 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextLinearGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMask001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMask001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9108247e6194990dc4f458a36e83dd71c52a661d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMask001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMaxFontSize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMaxFontSize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9e3797089187ce4c807d6d756bfb44990a176d51 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMaxFontSize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMaxLines001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMaxLines001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e8e5be8599129f2fcf5dc8e8f4bcdc8ad880cce4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMaxLines001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMinFontSize001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMinFontSize001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0bb1b2689993f0d5b217db064a7f31a7bf2f610a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextMinFontSize001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOffset001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOffset001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6cc2082fc87afa51b17498062355b6a0d8e04c08 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOffset001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOpacity001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOpacity001.webp new file mode 100644 index 0000000000000000000000000000000000000000..abe005fad017b6d9aff80108c9a557b0be4f5942 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOpacity001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOverflow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOverflow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1c17c3e9b58044cfc2e2670d3ff648b42ff8c1c5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOverflow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOverlay001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOverlay001.webp new file mode 100644 index 0000000000000000000000000000000000000000..908e3b006cfa11abcf3cb83470ab8cdec8a50b40 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextOverlay001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPadding001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPadding001.webp new file mode 100644 index 0000000000000000000000000000000000000000..733fc9027a51b655aa6637a423b1d5bfa66464f0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPadding001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..87038da12b13713d189e7f0eba5812164c6aba32 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerCanLoop001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerCanLoop001.webp new file mode 100644 index 0000000000000000000000000000000000000000..66cbf78e898fe8a648f7b625433c92360915c5ff Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerCanLoop001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDefaultPickerItemHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDefaultPickerItemHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..6f38d91b5f889ca92d76bae3fa4007f6beef5b0b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDefaultPickerItemHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..76dfed031520304c458437bc7852650038fa097d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3481bc3498adf02a43fa74560c50c8eef5c95dae Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle003.webp new file mode 100644 index 0000000000000000000000000000000000000000..91b01bb3e0d731dfe21e87f72f8019b074919c40 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle004.webp new file mode 100644 index 0000000000000000000000000000000000000000..47b1847761ae4f9966741e3ef0f6ce6029f1dcc0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle005.webp new file mode 100644 index 0000000000000000000000000000000000000000..72697779d30693ac41467d8123517a45aff9adb9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle006.webp new file mode 100644 index 0000000000000000000000000000000000000000..3481bc3498adf02a43fa74560c50c8eef5c95dae Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle007.webp new file mode 100644 index 0000000000000000000000000000000000000000..52332a73a201c45b5b08fdbc7bd01047e1d1d069 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerDisappearTextStyle007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..fe991cce11eb4c399280d70e953b89a45b45358f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..741f9c458d1498a7a8731521e21fb25b8c40a341 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerOnChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerOnChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..60ebf421ef9a0a8b327cb2c3078f43c1aa8b593f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerOnChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerRange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerRange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3c5e3daec3defa41b38147b161b7f132a7a28fd7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerRange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelected001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelected001.webp new file mode 100644 index 0000000000000000000000000000000000000000..bde449ec085575c40a8915b16f595ddb717a83b5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelected001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedIndex001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedIndex001.webp new file mode 100644 index 0000000000000000000000000000000000000000..bde449ec085575c40a8915b16f595ddb717a83b5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedIndex001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f236a67e1091576cd1a39101d9de486fc275ffc1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..181076cdbbb1f6f32dba47aeb7eba3b606dfb88d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle003.webp new file mode 100644 index 0000000000000000000000000000000000000000..9b7e5a844d5c513a9c4a123629062e4745800bf4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle004.webp new file mode 100644 index 0000000000000000000000000000000000000000..ddaa02f2e319760dae7e8493351a6ea32038fb24 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle005.webp new file mode 100644 index 0000000000000000000000000000000000000000..186ce6dfb271d05d59e921cedc7b93f244604be5 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle006.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd9cd25501e6c50f4646ed61a59c3692dcc7cdd6 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle007.webp new file mode 100644 index 0000000000000000000000000000000000000000..b1691d5d4b5a253ee0335019daf3040216f06723 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerSelectedTextStyle007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5c398f09d933338471034bc4377079c3478b0781 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..956f2bf93c6a60df5f917321e6ee87e2f72c1be8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle003.webp new file mode 100644 index 0000000000000000000000000000000000000000..1a735446e016d41d12c6e8eba23521d1912e950f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle004.webp new file mode 100644 index 0000000000000000000000000000000000000000..4e83231b2ca77e699e2670bc81f8a58095f239fe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle005.webp new file mode 100644 index 0000000000000000000000000000000000000000..59e33d1c1ab131e39923965f634a5ba700cc60ba Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle006.webp new file mode 100644 index 0000000000000000000000000000000000000000..32d05cbd0c29781bd027bed86952ef942d8b7194 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle007.webp new file mode 100644 index 0000000000000000000000000000000000000000..2b227941ccc2330c93d150214534403e2935fe8b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerTextStyle007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerValue001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerValue001.webp new file mode 100644 index 0000000000000000000000000000000000000000..32717f41bc5dde78852ad1f0c646f0b9d00f2023 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerValue001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9f827e768f028bb2c416cc9dbccf62da28083626 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..fb5761d8820bb46a0b2cb52531ff99b50c254972 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPickerWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..492955d5280dd04d8571569fdccd1b30e012f2fe Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextPosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextRadialGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextRadialGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..5558ec74ff2836a3d1f829c72e3fbd83ddfb6a82 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextRadialGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextScale001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextScale001.webp new file mode 100644 index 0000000000000000000000000000000000000000..06014ec0bf4ba3ac242e89e1de697a306bd978c3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextScale001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextShadow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextShadow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..a966be4fe7896e922714d9222b09156218b5bb64 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextShadow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextSweepGradient001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextSweepGradient001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9e96ce04d6aaaf1000fe7038b7e7486b2438100b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextSweepGradient001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextAlign001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextAlign001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2fbad5b0cf78f5ff42ca3bf70ec92d613e1ef08c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextAlign001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextCase001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextCase001.webp new file mode 100644 index 0000000000000000000000000000000000000000..983ee19ea9ed79f186d2f5b9d170fe1a7e41c188 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextCase001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextIndent001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextIndent001.webp new file mode 100644 index 0000000000000000000000000000000000000000..8bad2283c62b36985f16ac868399750348fa383e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextIndent001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextShadow001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextShadow001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ba1f9daf86279624784710b3d296b922e892ec66 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTextShadow001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTransform001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTransform001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9b509d5c62c0180644cfc93b938ecc66c7006784 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextTransform001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextVisibility001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextVisibility001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f751873c66e3f00cd9e03d48fad1e8bf810ab393 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextVisibility001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f40489da818eaffa5eb7eb55705f4f32782f2cee Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..4af450fee9f4e6c219091830de3fcf3eee8e001c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTextWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f191423ae27e2d73a88a5e06a820e639ad2fa00 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2f191423ae27e2d73a88a5e06a820e639ad2fa00 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f846748e90e8aef5c3cca16bd3e3003f663e838c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f846748e90e8aef5c3cca16bd3e3003f663e838c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f846748e90e8aef5c3cca16bd3e3003f663e838c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..f846748e90e8aef5c3cca16bd3e3003f663e838c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..f846748e90e8aef5c3cca16bd3e3003f663e838c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..f846748e90e8aef5c3cca16bd3e3003f663e838c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..e23d279d7004f773a87b09cffc2d46357e2dc443 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..e23d279d7004f773a87b09cffc2d46357e2dc443 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e23d279d7004f773a87b09cffc2d46357e2dc443 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..e23d279d7004f773a87b09cffc2d46357e2dc443 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..f06177dcbcfd4b185cdffcba36c0309555a4946f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..9fe446762402557cd5df8d76e3c7bacbe81e4ff9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle003.webp new file mode 100644 index 0000000000000000000000000000000000000000..6fd56353ff4d6352df6302825aea9c6aa433b7ff Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle004.webp new file mode 100644 index 0000000000000000000000000000000000000000..84c48dff61e01e31a10500e48e43ab1e870c09fd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle005.webp new file mode 100644 index 0000000000000000000000000000000000000000..e0a22192ec1d3b8ac9893acaf2bea79ac98f1981 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle006.webp new file mode 100644 index 0000000000000000000000000000000000000000..9fe446762402557cd5df8d76e3c7bacbe81e4ff9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle007.webp new file mode 100644 index 0000000000000000000000000000000000000000..2c6aef6b29aa56d2eea4cb2eabf089617558d121 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerDisappearTextStyle007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..c8d844074f8a6ed41ac6ad622f09866e8ff80773 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerOnChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerOnChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ddbe5eee04e3142a7713959c6ce2df7abd9a33fb Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerOnChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelected001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelected001.webp new file mode 100644 index 0000000000000000000000000000000000000000..de24c53d41082f982fad77efac2c6e4dedcddf4d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelected001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b969963391c763c74e72d15e80fb366b6caf41c4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..97339b9db78a2d232ec45058eef51baff31df0db Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle003.webp new file mode 100644 index 0000000000000000000000000000000000000000..0b228deb5f5f9d8052e2322f541a9bdfd0aef987 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle004.webp new file mode 100644 index 0000000000000000000000000000000000000000..e4d864317a440d9a56971ca559730b63100b6cba Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle005.webp new file mode 100644 index 0000000000000000000000000000000000000000..4de9d41ed0f04b5c80a71d0a1eb053f584944a87 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle006.webp new file mode 100644 index 0000000000000000000000000000000000000000..af9730e8d37c613cfcc731411a3edb200125a5e4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle007.webp new file mode 100644 index 0000000000000000000000000000000000000000..3882de7f5bf9841358c77b5e4c5d8fe7fae5acbc Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerSelectedTextStyle007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle001.webp new file mode 100644 index 0000000000000000000000000000000000000000..1c407219e72b8a1277ceefda47931ce551ecc9e1 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle002.webp new file mode 100644 index 0000000000000000000000000000000000000000..2c29c0aa511c0bee7d98d988500f1a4b37ca5f3c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle003.webp new file mode 100644 index 0000000000000000000000000000000000000000..8e15cd996fc1233668bba444e77fb97ac5bc297f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle004.webp new file mode 100644 index 0000000000000000000000000000000000000000..e2d2bfd96345638896b92161cb71814f977d1a22 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle005.webp new file mode 100644 index 0000000000000000000000000000000000000000..141c7f7d45663d7fb806b7d38b0eb07e2ab72e23 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle006.webp new file mode 100644 index 0000000000000000000000000000000000000000..7692b83a365bd248e4c7152678b8e7d4c02b937b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle007.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle007.webp new file mode 100644 index 0000000000000000000000000000000000000000..f98391877ae5834966342468f7a72c6255fdfca7 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerTextStyle007.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerUseMilitaryTime001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerUseMilitaryTime001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b88a70751bc51cf532e4cad8bb21f4fc89c7b748 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTimePickerUseMilitaryTime001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityDescription001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityDescription001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityDescription001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityDescription002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityDescription002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityDescription002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityGroup001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityGroup001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityGroup001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityGroup002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityGroup002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityGroup002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel003.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel004.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel005.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel005.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel005.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel006.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel006.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityLevel006.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityText001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityText001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityText001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityText002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityText002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3e7311ea142d86d91e4ca8e32a11e47827417cb0 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleAccessibilityText002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleBackgroundColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleBackgroundColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..66f15e06c008fabff49b0168aee91367db1686d4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleBackgroundColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleClip001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleClip001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e3893eefe7da853a8e837c14e1050b62161cb93d Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleClip001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleEnabled001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleEnabled001.webp new file mode 100644 index 0000000000000000000000000000000000000000..3879a06d5c8317a05cbef274cd9e6c66cd57426f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleEnabled001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleEnabled002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleEnabled002.webp new file mode 100644 index 0000000000000000000000000000000000000000..976cb383d0b0ed2802e6861d29df00a3cb543b9a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleEnabled002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleEnabled003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleEnabled003.webp new file mode 100644 index 0000000000000000000000000000000000000000..90cdabcee23d9074cf0d378e98d5519446fb19c3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleEnabled003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleFocusable001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleFocusable001.webp new file mode 100644 index 0000000000000000000000000000000000000000..9cf030e603afa2ce3028b5a37d15d5d16cd41b9b Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleFocusable001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleFocusable002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleFocusable002.webp new file mode 100644 index 0000000000000000000000000000000000000000..3c7d2018bc88cb2ca72784beeb87a8e02f646b63 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleFocusable002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..024b32a4b82d3323884bfe32f5058b1f365e51b4 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..03de22eb15257e87a3fe70ec75e8c51588e98a9a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin001.webp new file mode 100644 index 0000000000000000000000000000000000000000..4930d7a7ac49136f482f9e7e6763e811dcf765dd Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin002.webp new file mode 100644 index 0000000000000000000000000000000000000000..021a70cf3d382a8bc87aff22c1b9b4f4fe892baf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin003.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin003.webp new file mode 100644 index 0000000000000000000000000000000000000000..021a70cf3d382a8bc87aff22c1b9b4f4fe892baf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin003.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin004.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin004.webp new file mode 100644 index 0000000000000000000000000000000000000000..021a70cf3d382a8bc87aff22c1b9b4f4fe892baf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleMargin004.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleOnChange001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleOnChange001.webp new file mode 100644 index 0000000000000000000000000000000000000000..fdddb63bbbea2d8f744e1e0da878663e68b6da3a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleOnChange001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTogglePosition001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTogglePosition001.webp new file mode 100644 index 0000000000000000000000000000000000000000..ff8abc145cc11d2013be051d7041cfee9cce609c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTogglePosition001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTogglePosition002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTogglePosition002.webp new file mode 100644 index 0000000000000000000000000000000000000000..25073e2fe9c4d62ca663ab204f4181cc6fab8193 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testTogglePosition002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleSelectedColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleSelectedColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..0fe7038c0a79a3da1ddea3fac5df0b821fbaa4b3 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleSelectedColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleSwitch001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleSwitch001.webp new file mode 100644 index 0000000000000000000000000000000000000000..021a70cf3d382a8bc87aff22c1b9b4f4fe892baf Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleSwitch001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleSwitchPointColor001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleSwitchPointColor001.webp new file mode 100644 index 0000000000000000000000000000000000000000..426f8b805c173ba4e09f77a259ed3f56fc298174 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleSwitchPointColor001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..64affcfdea0b411bfb9fcd5ca205eb330c24b97e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..03de22eb15257e87a3fe70ec75e8c51588e98a9a Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testToggleWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentHeight001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentHeight001.webp new file mode 100644 index 0000000000000000000000000000000000000000..20112976c7f5e1a1b8850aba0d89891c6a09413e Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentHeight001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentHeight002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentHeight002.webp new file mode 100644 index 0000000000000000000000000000000000000000..32a7126611d68cc2ac879c3e70dfbaaf7d796de9 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentHeight002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentSourceId001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentSourceId001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e6f826e9c3880b32f50bc5b990701288e3a9a7e8 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentSourceId001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentType001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentType001.webp new file mode 100644 index 0000000000000000000000000000000000000000..b0b129b9453ab77f4968c198fe9b31d2b60ba957 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentType001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentWidth001.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentWidth001.webp new file mode 100644 index 0000000000000000000000000000000000000000..e6c906ec1b4b1c79dc6885da0c556cb92cddec31 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentWidth001.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentWidth002.webp b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentWidth002.webp new file mode 100644 index 0000000000000000000000000000000000000000..4af450fee9f4e6c219091830de3fcf3eee8e001c Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/BaseImages_20240624_164302/arkui_capi_demo/testXComponentWidth002.webp differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/hap/arkui_capi_demo.hap b/scenario/arkui/arkui_capi_demo/uicompare/hap/arkui_capi_demo.hap new file mode 100644 index 0000000000000000000000000000000000000000..18b2d60b8ad7d3b886bc75129aee3fece588fa6f Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/hap/arkui_capi_demo.hap differ diff --git a/scenario/arkui/arkui_capi_demo/uicompare/hap/arkui_capi_demo_test.hap b/scenario/arkui/arkui_capi_demo/uicompare/hap/arkui_capi_demo_test.hap new file mode 100644 index 0000000000000000000000000000000000000000..6fe8cce44bd2d37ec6c7885d0d6d94511bff6e72 Binary files /dev/null and b/scenario/arkui/arkui_capi_demo/uicompare/hap/arkui_capi_demo_test.hap differ