1# Copyright (c) 2023 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/test.gni") 15import("//foundation/arkui/ace_engine/ace_config.gni") 16import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni") 17 18group("unittest") { 19 testonly = true 20 deps = [] 21 if (!is_asan) { 22 deps += [ 23 "base:base_unittest", 24 "core:core_unittest", 25 "interfaces:interfaces_unittest", 26 ] 27 } 28} 29 30config("ace_coverage_config") { 31 cflags = [] 32 ldflags = [] 33 if (ace_engine_feature_enable_coverage) { 34 cflags += [ "--coverage" ] 35 ldflags += [ "--coverage" ] 36 } 37} 38 39# ace unittest config 40config("ace_unittest_config") { 41 visibility = [ "./../../*" ] 42 include_dirs = [ 43 "$ace_root", 44 "$ace_root/frameworks", 45 "$root_out_dir/arkui/framework", 46 ] 47 cflags_cc = [] 48 defines = [] 49 50 if (is_ohos_standard_system && !use_mingw_win && !use_mac && !use_linux) { 51 cflags_cc += [ 52 "-Wno-thread-safety-attributes", 53 "-Wno-thread-safety-analysis", 54 "-Wno-non-c-typedef-for-linkage", 55 ] 56 defines += [ "OHOS_STANDARD_SYSTEM" ] 57 } 58 59 cflags = [ 60 "-fvisibility=hidden", 61 "-fdata-sections", 62 "-ffunction-sections", 63 ] 64 65 cflags_cc += [ "-fvisibility-inlines-hidden" ] 66 ldflags = [ "-Wl,-gc-sections" ] 67 68 if (ace_engine_feature_enable_coverage) { 69 cflags += [ "--coverage" ] 70 ldflags += [ "--coverage" ] 71 } 72 73 defines += [ "ACE_UNITTEST" ] 74 75 if (ace_use_new_skia) { 76 defines += [ "NEW_SKIA" ] 77 } 78} 79 80# ace unittest log 81ohos_source_set("ace_unittest_log") { 82 testonly = true 83 subsystem_name = ace_engine_subsystem 84 part_name = ace_engine_part 85 sources = [ "$ace_root/adapter/ohos/osal/log_wrapper.cpp" ] 86 external_deps = [ "hilog:libhilog" ] 87 configs = [ ":ace_unittest_config" ] 88} 89 90# ace unittest trace 91ohos_source_set("ace_unittest_trace") { 92 testonly = true 93 subsystem_name = ace_engine_subsystem 94 part_name = ace_engine_part 95 sources = [ 96 "$ace_root/adapter/ohos/osal/ace_trace.cpp", 97 "$ace_root/frameworks/base/log/ace_trace.cpp", 98 ] 99 deps = [ "//third_party/bounds_checking_function:libsec_shared" ] 100 external_deps = [ "hitrace:hitrace_meter" ] 101 configs = [ ":ace_unittest_config" ] 102} 103 104# ace components base 105ohos_source_set("ace_components_base") { 106 testonly = true 107 subsystem_name = ace_engine_subsystem 108 part_name = ace_engine_part 109 sources = [ 110 "$ace_root/frameworks/core/components_ng/base/frame_node.cpp", 111 "$ace_root/frameworks/core/components_ng/base/geometry_node.cpp", 112 "$ace_root/frameworks/core/components_ng/base/inspector.cpp", 113 "$ace_root/frameworks/core/components_ng/base/modifier.cpp", 114 "$ace_root/frameworks/core/components_ng/base/ui_node.cpp", 115 "$ace_root/frameworks/core/components_ng/base/view_abstract.cpp", 116 "$ace_root/frameworks/core/components_ng/base/view_stack_processor.cpp", 117 "$ace_root/frameworks/core/components_ng/pattern/custom/custom_node.cpp", 118 "$ace_root/frameworks/core/components_ng/pattern/scroll/inner/scroll_bar.cpp", 119 ] 120 configs = [ ":ace_unittest_config" ] 121} 122 123# ace components event 124ohos_source_set("ace_components_event") { 125 testonly = true 126 subsystem_name = ace_engine_subsystem 127 part_name = ace_engine_part 128 sources = [ 129 "$ace_root/frameworks/core/components_ng/event/click_event.cpp", 130 "$ace_root/frameworks/core/components_ng/event/drag_event.cpp", 131 "$ace_root/frameworks/core/components_ng/event/event_hub.cpp", 132 "$ace_root/frameworks/core/components_ng/event/focus_hub.cpp", 133 "$ace_root/frameworks/core/components_ng/event/gesture_event_hub.cpp", 134 "$ace_root/frameworks/core/components_ng/event/input_event.cpp", 135 "$ace_root/frameworks/core/components_ng/event/input_event_hub.cpp", 136 "$ace_root/frameworks/core/components_ng/event/long_press_event.cpp", 137 "$ace_root/frameworks/core/components_ng/event/pan_event.cpp", 138 "$ace_root/frameworks/core/components_ng/event/scrollable_event.cpp", 139 "$ace_root/frameworks/core/components_ng/event/state_style_manager.cpp", 140 "$ace_root/frameworks/core/components_ng/event/touch_event.cpp", 141 ] 142 configs = [ ":ace_unittest_config" ] 143} 144 145# ace components gestures 146ohos_source_set("ace_components_gestures") { 147 testonly = true 148 subsystem_name = ace_engine_subsystem 149 part_name = ace_engine_part 150 sources = [ 151 "$ace_root/frameworks/core/components_ng/gestures/gesture_group.cpp", 152 "$ace_root/frameworks/core/components_ng/gestures/gesture_referee.cpp", 153 "$ace_root/frameworks/core/components_ng/gestures/long_press_gesture.cpp", 154 "$ace_root/frameworks/core/components_ng/gestures/pan_gesture.cpp", 155 "$ace_root/frameworks/core/components_ng/gestures/pinch_gesture.cpp", 156 "$ace_root/frameworks/core/components_ng/gestures/recognizers/click_recognizer.cpp", 157 "$ace_root/frameworks/core/components_ng/gestures/recognizers/exclusive_recognizer.cpp", 158 "$ace_root/frameworks/core/components_ng/gestures/recognizers/gesture_recognizer.cpp", 159 "$ace_root/frameworks/core/components_ng/gestures/recognizers/long_press_recognizer.cpp", 160 "$ace_root/frameworks/core/components_ng/gestures/recognizers/multi_fingers_recognizer.cpp", 161 "$ace_root/frameworks/core/components_ng/gestures/recognizers/pan_recognizer.cpp", 162 "$ace_root/frameworks/core/components_ng/gestures/recognizers/parallel_recognizer.cpp", 163 "$ace_root/frameworks/core/components_ng/gestures/recognizers/pinch_recognizer.cpp", 164 "$ace_root/frameworks/core/components_ng/gestures/recognizers/recognizer_group.cpp", 165 "$ace_root/frameworks/core/components_ng/gestures/recognizers/rotation_recognizer.cpp", 166 "$ace_root/frameworks/core/components_ng/gestures/recognizers/sequenced_recognizer.cpp", 167 "$ace_root/frameworks/core/components_ng/gestures/recognizers/swipe_recognizer.cpp", 168 "$ace_root/frameworks/core/components_ng/gestures/rotation_gesture.cpp", 169 "$ace_root/frameworks/core/components_ng/gestures/swipe_gesture.cpp", 170 "$ace_root/frameworks/core/components_ng/gestures/tap_gesture.cpp", 171 ] 172 configs = [ ":ace_unittest_config" ] 173} 174 175# ace components layout 176ohos_source_set("ace_components_layout") { 177 testonly = true 178 subsystem_name = ace_engine_subsystem 179 part_name = ace_engine_part 180 sources = [ 181 "$ace_root/frameworks/core/components_ng/layout/box_layout_algorithm.cpp", 182 "$ace_root/frameworks/core/components_ng/layout/layout_property.cpp", 183 "$ace_root/frameworks/core/components_ng/layout/layout_wrapper.cpp", 184 "$ace_root/frameworks/core/components_ng/layout/layout_wrapper_builder.cpp", 185 "$ace_root/frameworks/core/components_ng/layout/layout_wrapper_node.cpp", 186 "$ace_root/frameworks/core/components_ng/manager/safe_area/safe_area_manager.cpp", 187 ] 188 configs = [ ":ace_unittest_config" ] 189} 190 191# ace components property 192ohos_source_set("ace_components_property") { 193 testonly = true 194 subsystem_name = ace_engine_subsystem 195 part_name = ace_engine_part 196 sources = [ 197 "$ace_root/frameworks/core/components_ng/property/accessibility_property.cpp", 198 "$ace_root/frameworks/core/components_ng/property/border_property.cpp", 199 "$ace_root/frameworks/core/components_ng/property/calc_length.cpp", 200 "$ace_root/frameworks/core/components_ng/property/gradient_property.cpp", 201 "$ace_root/frameworks/core/components_ng/property/grid_property.cpp", 202 "$ace_root/frameworks/core/components_ng/property/measure_utils.cpp", 203 "$ace_root/frameworks/core/components_ng/property/property.cpp", 204 "$ace_root/frameworks/core/components_ng/property/safe_area_insets.cpp", 205 ] 206 configs = [ ":ace_unittest_config" ] 207} 208 209# ace components syntax 210ohos_source_set("ace_components_syntax") { 211 testonly = true 212 subsystem_name = ace_engine_subsystem 213 part_name = ace_engine_part 214 sources = [ 215 "$ace_root/frameworks/core/components_ng/syntax/for_each_model_ng.cpp", 216 "$ace_root/frameworks/core/components_ng/syntax/for_each_node.cpp", 217 "$ace_root/frameworks/core/components_ng/syntax/if_else_model_ng.cpp", 218 "$ace_root/frameworks/core/components_ng/syntax/if_else_node.cpp", 219 "$ace_root/frameworks/core/components_ng/syntax/lazy_for_each_node.cpp", 220 "$ace_root/frameworks/core/components_ng/syntax/lazy_layout_wrapper_builder.cpp", 221 ] 222 configs = [ ":ace_unittest_config" ] 223} 224 225# ace components render 226ohos_source_set("ace_components_render") { 227 testonly = true 228 subsystem_name = ace_engine_subsystem 229 part_name = ace_engine_part 230 sources = [ 231 "$ace_root/frameworks/core/components_ng/render/border_image_painter.cpp", 232 "$ace_root/frameworks/core/components_ng/render/circle_painter.cpp", 233 "$ace_root/frameworks/core/components_ng/render/debug_boundary_painter.cpp", 234 "$ace_root/frameworks/core/components_ng/render/divider_painter.cpp", 235 "$ace_root/frameworks/core/components_ng/render/drawing_prop_convertor.cpp", 236 "$ace_root/frameworks/core/components_ng/render/ellipse_painter.cpp", 237 "$ace_root/frameworks/core/components_ng/render/image_painter.cpp", 238 "$ace_root/frameworks/core/components_ng/render/line_painter.cpp", 239 "$ace_root/frameworks/core/components_ng/render/paint_wrapper.cpp", 240 "$ace_root/frameworks/core/components_ng/render/polygon_painter.cpp", 241 "$ace_root/frameworks/core/components_ng/render/rect_painter.cpp", 242 "$ace_root/frameworks/core/components_ng/render/render_context.cpp", 243 "$ace_root/frameworks/core/components_ng/render/render_property.cpp", 244 "$ace_root/frameworks/core/components_ng/render/shape_painter.cpp", 245 ] 246 configs = [ ":ace_unittest_config" ] 247} 248 249# ace components extra - special 250ohos_source_set("ace_components_extra") { 251 testonly = true 252 subsystem_name = ace_engine_subsystem 253 part_name = ace_engine_part 254 sources = [ 255 "$ace_root/frameworks/core/common/clipboard/clipboard_proxy.cpp", 256 "$ace_root/frameworks/core/common/container_scope.cpp", 257 "$ace_root/frameworks/core/components/common/layout/grid_column_info.cpp", 258 "$ace_root/frameworks/core/components/common/layout/grid_container_info.cpp", 259 "$ace_root/frameworks/core/components/common/layout/grid_system_manager.cpp", 260 "$ace_root/frameworks/core/components/common/layout/screen_system_manager.cpp", 261 "$ace_root/frameworks/core/components/common/properties/alignment.cpp", 262 "$ace_root/frameworks/core/components/common/properties/border_image.cpp", 263 "$ace_root/frameworks/core/components/common/properties/color.cpp", 264 "$ace_root/frameworks/core/components/common/properties/decoration.cpp", 265 "$ace_root/frameworks/core/components/common/properties/shadow_config.cpp", 266 "$ace_root/frameworks/core/components_ng/test/pattern/image/mock_icon_theme.cpp", 267 "$ace_root/frameworks/core/components_v2/inspector/inspector_constants.cpp", 268 "$ace_root/frameworks/core/event/back_end_event_manager.cpp", 269 "$ace_root/frameworks/core/gestures/velocity_tracker.cpp", 270 "$ace_root/frameworks/core/pipeline/base/constants.cpp", 271 ] 272 273 configs = [ ":ace_unittest_config" ] 274} 275 276# ace base 277ohos_source_set("ace_base") { 278 testonly = true 279 subsystem_name = ace_engine_subsystem 280 part_name = ace_engine_part 281 sources = [ 282 "$ace_root/frameworks/base/geometry/animatable_dimension.cpp", 283 "$ace_root/frameworks/base/geometry/dimension.cpp", 284 "$ace_root/frameworks/base/geometry/least_square_impl.cpp", 285 "$ace_root/frameworks/base/geometry/matrix3.cpp", 286 "$ace_root/frameworks/base/geometry/matrix4.cpp", 287 "$ace_root/frameworks/base/json/json_util.cpp", 288 "$ace_root/frameworks/base/subwindow/subwindow_manager.cpp", 289 "$ace_root/frameworks/base/utils/base_id.cpp", 290 "$ace_root/frameworks/base/utils/string_expression.cpp", 291 "$ace_root/frameworks/base/utils/string_utils.cpp", 292 "$ace_root/frameworks/base/utils/time_util.cpp", 293 ] 294 295 deps = [ 296 ":ace_unittest_trace", 297 "$cjson_root:cjson", 298 ] 299 300 configs = [ ":ace_unittest_config" ] 301} 302 303# ace core animation 304ohos_source_set("ace_core_animation") { 305 testonly = true 306 subsystem_name = ace_engine_subsystem 307 part_name = ace_engine_part 308 sources = [ 309 "$ace_root/frameworks/core/animation/anticipate_curve.cpp", 310 "$ace_root/frameworks/core/animation/chain_animation.cpp", 311 "$ace_root/frameworks/core/animation/cubic_curve.cpp", 312 "$ace_root/frameworks/core/animation/curves.cpp", 313 "$ace_root/frameworks/core/animation/scroll_motion.cpp", 314 "$ace_root/frameworks/core/animation/spring_model.cpp", 315 "$ace_root/frameworks/core/animation/spring_motion.cpp", 316 "$ace_root/frameworks/core/animation/test/mock/mock_animator.cpp", 317 "$ace_root/frameworks/core/animation/test/mock/mock_scheduler.cpp", 318 "$ace_root/frameworks/core/components_ng/animation/geometry_transition.cpp", 319 ] 320 321 configs = [ ":ace_unittest_config" ] 322} 323 324ohos_source_set("ace_engine_unittest_flutter_deps") { 325 testonly = true 326 sources = [] 327 public_configs = [] 328 public_deps = [] 329 if (ace_use_new_skia) { 330 sources += [ "$ace_root/test/mock/core/common/mock_flutter_window.cpp" ] 331 public_deps += [ 332 "$ace_flutter_engine_root/libtxt:thirdparty_lib_txt_ohos", 333 "$skia_root_new:skia_ohos", 334 ] 335 cflags_cc = [ "-Wno-thread-safety-attributes" ] 336 external_deps = [ "eventhandler:libeventhandler" ] 337 public_configs += [ "$ace_flutter_engine_root:flutter_config" ] 338 } else { 339 public_deps += [ 340 "$ace_flutter_engine_root:third_party_flutter_engine_ohos", 341 "$ace_flutter_engine_root/skia:ace_skia_ohos", 342 ] 343 } 344} 345 346source_set("ace_components_mock") { 347 testonly = true 348 sources = [ 349 "$ace_root/frameworks/base/test/mock/mock_drag_window.cpp", 350 "$ace_root/frameworks/base/test/mock/mock_pixel_map.cpp", 351 "$ace_root/frameworks/base/test/mock/mock_ressched_report.cpp", 352 "$ace_root/frameworks/base/test/mock/mock_socperf_client_impl.cpp", 353 "$ace_root/frameworks/base/test/mock/mock_system_properties.cpp", 354 "$ace_root/frameworks/core/common/test/mock/mock_ace_application_info.cpp", 355 "$ace_root/frameworks/core/components_ng/test/event/scrollable_event/mock_scrollable.cpp", 356 "$ace_root/frameworks/core/components_ng/test/mock/base/mock_localization.cpp", 357 "$ace_root/frameworks/core/components_ng/test/mock/image_provider/mock_image_cache.cpp", 358 "$ace_root/frameworks/core/components_ng/test/mock/image_provider/mock_image_loading_context.cpp", 359 "$ace_root/frameworks/core/components_ng/test/mock/image_provider/mock_image_source_info.cpp", 360 "$ace_root/frameworks/core/components_ng/test/mock/render/mock_animation_utils.cpp", 361 "$ace_root/frameworks/core/components_ng/test/mock/render/mock_modifier_adapter.cpp", 362 "$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_context_creator.cpp", 363 "$ace_root/frameworks/core/components_ng/test/mock/render/mock_render_surface_creator.cpp", 364 "$ace_root/frameworks/core/components_ng/test/pattern/text/mock/mock_text_layout_adapter.cpp", 365 "$ace_root/frameworks/core/pipeline_ng/test/mock/mock_element_register.cpp", 366 "$ace_root/frameworks/core/pipeline_ng/test/mock/mock_pipeline_base.cpp", 367 "$ace_root/test/mock/base/mock_frame_trace_adapter.cpp", 368 "$ace_root/test/mock/core/common/mock_ace_engine.cpp", 369 "$ace_root/test/mock/core/common/mock_container.cpp", 370 "$ace_root/test/mock/core/render/mock_font_collection.cpp", 371 "$ace_root/test/mock/core/render/mock_paragraph.cpp", 372 ] 373 deps = [ "//third_party/googletest:gmock_main" ] 374 configs += [ ":ace_unittest_config" ] 375} 376