• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/ohos.gni")
15import("//build/test.gni")
16import("//foundation/arkui/ace_engine/ace_config.gni")
17
18pattern_test_output_path = "ace_engine/components"
19gestures_test_output_path = "ace_engine/gestures"
20event_test_output_path = "ace_engine/events"
21base_test_output_path = "ace_engine/base"
22syntax_test_output_path = "ace_engine/syntaxs"
23image_test_output_path = "ace_engine/image"
24basic_test_output_path = "ace_engine/basic"
25manager_test_output_path = "ace_engine/manager"
26interface_test_output_path = "ace_engine/interfaces"
27accessibility_test_output_path = "ace_engine/accessibility"
28property_test_output_path = "ace_engine/property"
29layout_test_output_path = "ace_engine/layout"
30svg_test_output_path = "ace_engine/svg"
31render_test_output_path = "ace_engine/render"
32
33template("ace_unittest") {
34  forward_variables_from(invoker, "*")
35
36  type = "components"
37  ace_animation = false
38  flutter_skia = false
39  render = false
40  ace_unittest_out_path = "ace_engine/$type"
41  ace_unittest_name = target_name
42  ace_unittest_config = [ "$ace_root/test/unittest:ace_unittest_config" ]
43  ace_external_deps = []
44  flutter_sources = []
45  flutter_external_deps = []
46  ace_unittest_deps = [
47    "$ace_root/frameworks/base:ace_memory_monitor_ohos",
48    "$ace_root/test/unittest:ace_unittest_log",
49    "$ace_root/test/unittest:ace_unittest_trace",
50    "//third_party/googletest:gmock",
51  ]
52
53  # temporary support
54  if (defined(invoker.external_deps)) {
55    ace_external_deps += external_deps
56  }
57
58  if (defined(invoker.render)) {
59    render = invoker.render
60  }
61
62  if (defined(invoker.type)) {
63    type = invoker.type
64    ace_unittest_out_path = "ace_engine/$type"
65  }
66
67  if (defined(invoker.ace_animation)) {
68    ace_animation = invoker.ace_animation
69  }
70
71  if (defined(invoker.flutter_skia)) {
72    flutter_skia = invoker.flutter_skia
73  }
74
75  if (ace_animation) {
76    ace_unittest_deps += [ "$ace_root/test/unittest:ace_core_animation" ]
77  }
78
79  if (render) {
80    ace_unittest_deps += [ "$graphic_2d_path/rosen/modules/render_service_client:librender_service_client" ]
81  }
82
83  if (flutter_skia) {
84    if (ace_use_new_skia) {
85      flutter_sources +=
86          [ "$ace_root/test/mock/core/common/mock_flutter_window.cpp" ]
87      ace_unittest_deps += [
88        "$ace_flutter_engine_root:flutter_engine_common_ohos",
89        "$ace_flutter_engine_root/libtxt:thirdparty_lib_txt_ohos",
90        "$skia_root_new:skia_ohos",
91      ]
92      ace_unittest_config += [ "$ace_flutter_engine_root:flutter_config" ]
93      flutter_external_deps = [ "eventhandler:libeventhandler" ]
94    } else {
95      ace_unittest_deps += [
96        "$ace_flutter_engine_root:third_party_flutter_engine_ohos",
97        "$ace_flutter_engine_root/skia:ace_skia_ohos",
98      ]
99    }
100  }
101
102  if (type == "components") {
103    ohos_unittest(ace_unittest_name) {
104      module_out_path = ace_unittest_out_path
105
106      sources = []
107      sources += invoker.sources
108      sources += flutter_sources
109
110      deps = ace_unittest_deps
111      deps += [
112        "$ace_root/frameworks/core/components/theme:build_theme_code",
113        "$ace_root/test/unittest:ace_base",
114        "$ace_root/test/unittest:ace_components_base",
115        "$ace_root/test/unittest:ace_components_event",
116        "$ace_root/test/unittest:ace_components_extra",
117        "$ace_root/test/unittest:ace_components_gestures",
118        "$ace_root/test/unittest:ace_components_layout",
119        "$ace_root/test/unittest:ace_components_mock",
120        "$ace_root/test/unittest:ace_components_property",
121        "$ace_root/test/unittest:ace_components_render",
122        "$ace_root/test/unittest:ace_components_syntax",
123      ]
124
125      configs = []
126      configs += ace_unittest_config
127
128      external_deps = []
129      external_deps += ace_external_deps
130      external_deps += flutter_external_deps
131    }
132  } else if (type == "basic/common") {
133    ohos_unittest(ace_unittest_name) {
134      module_out_path = ace_unittest_out_path
135      sources = []
136      sources += invoker.sources
137      sources += flutter_sources
138
139      deps = ace_unittest_deps
140      deps += [ "$ace_root/test/unittest:ace_base" ]
141
142      configs = []
143      configs = ace_unittest_config
144
145      external_deps = []
146      external_deps += ace_external_deps
147      external_deps += flutter_external_deps
148    }
149  } else {
150    assert(false)
151  }
152}
153