1# Copyright (c) 2022-2024 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/test/unittest/ace_unittest.gni")
16
17config("config_svg_parse_test") {
18  visibility = [ ":*" ]
19  include_dirs = [
20    "//commonlibrary/c_utils/base/include",
21    "//foundation/graphic/graphic_2d/rosen/modules",
22    "//foundation/graphic/graphic_2d/rosen/modules/render_service_client",
23    "//foundation/graphic/graphic_2d/rosen/modules/render_service_client/core",
24    "//foundation/graphic/graphic_2d/rosen/modules/render_service_base",
25    "//foundation/graphic/graphic_2d/rosen/modules/render_service_base/include",
26    "//foundation/graphic/graphic_2d/rosen/modules/platform/image_native",
27    "//foundation/graphic/graphic_2d/rosen/modules/2d_engine",
28    "//foundation/graphic/graphic_2d/rosen/modules/2d_engine/rosen_text/export/rosen_text",
29    "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/include",
30    "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/src",
31    "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/src/drawing/engine_adapter",
32    "//foundation/graphic/graphic_2d/rosen/modules/render_service_base/include",
33    "//third_party/skia",
34    "$ace_root",
35    "$ace_root/frameworks",
36  ]
37  if (enable_graphic_text_gine) {
38    include_dirs += [ "//foundation/graphic/graphic_2d/rosen/modules/2d_engine/rosen_text/export" ]
39  } else {
40    include_dirs +=
41        [ "//foundation/graphic/graphic_2d/rosen/modules/2d_engine/rosen_text" ]
42  }
43}
44
45ohos_unittest("parse_test_ng") {
46  module_out_path = svg_test_output_path
47  sources = [
48    "$ace_root/frameworks/base/base64/base64_util.cpp",
49    "$ace_root/frameworks/bridge/common/dom/dom_type.cpp",
50    "$ace_root/frameworks/bridge/common/utils/utils.cpp",
51    "$ace_root/frameworks/bridge/js_frontend/engine/common/js_constants.cpp",
52    "$ace_root/frameworks/core/animation/svg_animate.cpp",
53    "$ace_root/frameworks/core/components/svg/svg_transform.cpp",
54    "$ace_root/frameworks/core/components_ng/pattern/overlay/sheet_manager.cpp",
55    "$ace_root/frameworks/core/components_ng/svg/parse/svg_animation.cpp",
56    "$ace_root/frameworks/core/components_ng/svg/parse/svg_attributes_parser.cpp",
57    "$ace_root/frameworks/core/components_ng/svg/parse/svg_circle.cpp",
58    "$ace_root/frameworks/core/components_ng/svg/parse/svg_clip_path.cpp",
59    "$ace_root/frameworks/core/components_ng/svg/parse/svg_constants.cpp",
60    "$ace_root/frameworks/core/components_ng/svg/parse/svg_ellipse.cpp",
61    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe.cpp",
62    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_blend.cpp",
63    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_color_matrix.cpp",
64    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_composite.cpp",
65    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_flood.cpp",
66    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_gaussian_blur.cpp",
67    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_offset.cpp",
68    "$ace_root/frameworks/core/components_ng/svg/parse/svg_filter.cpp",
69    "$ace_root/frameworks/core/components_ng/svg/parse/svg_g.cpp",
70    "$ace_root/frameworks/core/components_ng/svg/parse/svg_gradient.cpp",
71    "$ace_root/frameworks/core/components_ng/svg/parse/svg_graphic.cpp",
72    "$ace_root/frameworks/core/components_ng/svg/parse/svg_image.cpp",
73    "$ace_root/frameworks/core/components_ng/svg/parse/svg_line.cpp",
74    "$ace_root/frameworks/core/components_ng/svg/parse/svg_mask.cpp",
75    "$ace_root/frameworks/core/components_ng/svg/parse/svg_node.cpp",
76    "$ace_root/frameworks/core/components_ng/svg/parse/svg_path.cpp",
77    "$ace_root/frameworks/core/components_ng/svg/parse/svg_pattern.cpp",
78    "$ace_root/frameworks/core/components_ng/svg/parse/svg_polygon.cpp",
79    "$ace_root/frameworks/core/components_ng/svg/parse/svg_rect.cpp",
80    "$ace_root/frameworks/core/components_ng/svg/parse/svg_stop.cpp",
81    "$ace_root/frameworks/core/components_ng/svg/parse/svg_style.cpp",
82    "$ace_root/frameworks/core/components_ng/svg/parse/svg_svg.cpp",
83    "$ace_root/frameworks/core/components_ng/svg/parse/svg_use.cpp",
84    "$ace_root/frameworks/core/components_ng/svg/svg_context.cpp",
85    "$ace_root/frameworks/core/components_ng/svg/svg_dom.cpp",
86    "$ace_root/test/mock/adapter/mock_drawing_color_filter_ohos.cpp",
87    "$ace_root/test/mock/core/svg/mock_image_painter_utils.cpp",
88    "$ace_root/test/mock/core/svg/mock_rosen_svg_painter.cpp",
89    "$ace_root/test/mock/core/svg/mock_shared_transition_effect.cpp",
90    "$ace_root/test/mock/core/svg/mock_svg_fit_convertor.cpp",
91    "$ace_root/test/mock/core/svg/mock_svg_utils.cpp",
92    "parse_test_ng.cpp",
93    "parse_testtwo_ng.cpp",
94    "svg_manager_test_ng.cpp",
95  ]
96  defines = [ "USE_ROSEN_DRAWING" ]
97  if (ace_use_rosen_drawing) {
98    defines += [
99      "ACE_ENABLE_GPU",
100      "NEW_SKIA",
101    ]
102    include_dirs = [ "//third_party/skia" ]
103  }
104
105  configs = [
106    ":config_svg_parse_test",
107    "$ace_root/test/unittest:ace_unittest_config",
108  ]
109
110  external_deps = [
111    "bounds_checking_function:libsec_static",
112    "eventhandler:libeventhandler",
113    "graphic_2d:librender_service_base",
114    "graphic_2d:librender_service_client",
115    "graphic_2d:rosen_text",
116  ]
117
118  deps = [
119    "$ace_root/test/unittest:ace_base",
120    "$ace_root/test/unittest:ace_components_base",
121    "$ace_root/test/unittest:ace_components_mock",
122    "$ace_root/test/unittest:ace_components_render",
123    "$ace_root/test/unittest:ace_core_animation",
124    "$ace_root/test/unittest:ace_core_extra",
125    "//third_party/googletest:gmock",
126    "//third_party/googletest:gtest_main",
127  ]
128
129  if (ability_runtime_graphics) {
130    external_deps += [
131      "ability_runtime:runtime",
132      "image_framework:image_native",
133      "window_manager:libdm",
134    ]
135  }
136}
137
138ohos_unittest("svg_dom_test_ng") {
139  module_out_path = svg_test_output_path
140
141  sources = [
142    "$ace_root/frameworks/bridge/common/dom/dom_type.cpp",
143    "$ace_root/frameworks/bridge/common/utils/utils.cpp",
144    "$ace_root/frameworks/bridge/js_frontend/engine/common/js_constants.cpp",
145    "$ace_root/frameworks/core/animation/svg_animate.cpp",
146    "$ace_root/frameworks/core/components/svg/svg_transform.cpp",
147    "$ace_root/frameworks/core/components_ng/pattern/overlay/sheet_manager.cpp",
148    "$ace_root/frameworks/core/components_ng/svg/parse/svg_animation.cpp",
149    "$ace_root/frameworks/core/components_ng/svg/parse/svg_attributes_parser.cpp",
150    "$ace_root/frameworks/core/components_ng/svg/parse/svg_circle.cpp",
151    "$ace_root/frameworks/core/components_ng/svg/parse/svg_clip_path.cpp",
152    "$ace_root/frameworks/core/components_ng/svg/parse/svg_constants.cpp",
153    "$ace_root/frameworks/core/components_ng/svg/parse/svg_ellipse.cpp",
154    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe.cpp",
155    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_blend.cpp",
156    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_color_matrix.cpp",
157    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_composite.cpp",
158    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_flood.cpp",
159    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_gaussian_blur.cpp",
160    "$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_offset.cpp",
161    "$ace_root/frameworks/core/components_ng/svg/parse/svg_filter.cpp",
162    "$ace_root/frameworks/core/components_ng/svg/parse/svg_g.cpp",
163    "$ace_root/frameworks/core/components_ng/svg/parse/svg_gradient.cpp",
164    "$ace_root/frameworks/core/components_ng/svg/parse/svg_graphic.cpp",
165    "$ace_root/frameworks/core/components_ng/svg/parse/svg_image.cpp",
166    "$ace_root/frameworks/core/components_ng/svg/parse/svg_line.cpp",
167    "$ace_root/frameworks/core/components_ng/svg/parse/svg_mask.cpp",
168    "$ace_root/frameworks/core/components_ng/svg/parse/svg_node.cpp",
169    "$ace_root/frameworks/core/components_ng/svg/parse/svg_path.cpp",
170    "$ace_root/frameworks/core/components_ng/svg/parse/svg_pattern.cpp",
171    "$ace_root/frameworks/core/components_ng/svg/parse/svg_polygon.cpp",
172    "$ace_root/frameworks/core/components_ng/svg/parse/svg_rect.cpp",
173    "$ace_root/frameworks/core/components_ng/svg/parse/svg_stop.cpp",
174    "$ace_root/frameworks/core/components_ng/svg/parse/svg_style.cpp",
175    "$ace_root/frameworks/core/components_ng/svg/parse/svg_svg.cpp",
176    "$ace_root/frameworks/core/components_ng/svg/parse/svg_use.cpp",
177    "$ace_root/frameworks/core/components_ng/svg/svg_context.cpp",
178    "$ace_root/frameworks/core/components_ng/svg/svg_dom.cpp",
179    "$ace_root/frameworks/core/components_ng/svg/svg_utils.cpp",
180    "$ace_root/test/mock/adapter/mock_drawing_color_filter_ohos.cpp",
181    "$ace_root/test/mock/core/svg/mock_image_painter_utils.cpp",
182    "$ace_root/test/mock/core/svg/mock_rosen_svg_painter.cpp",
183    "$ace_root/test/mock/core/svg/mock_shared_transition_effect.cpp",
184    "$ace_root/test/mock/core/svg/mock_svg_fit_convertor.cpp",
185    "svg_dom_test_ng.cpp",
186  ]
187
188  defines = [ "USE_ROSEN_DRAWING" ]
189
190  configs = [
191    ":config_svg_parse_test",
192    "$ace_root/test/unittest:ace_unittest_config",
193  ]
194
195  external_deps = [
196    "bounds_checking_function:libsec_static",
197    "eventhandler:libeventhandler",
198    "graphic_2d:librender_service_base",
199    "graphic_2d:librender_service_client",
200    "graphic_2d:rosen_text",
201  ]
202
203  deps = [
204    "$ace_root/test/unittest:ace_base",
205    "$ace_root/test/unittest:ace_components_base",
206    "$ace_root/test/unittest:ace_components_mock",
207    "$ace_root/test/unittest:ace_components_render",
208    "$ace_root/test/unittest:ace_core_animation",
209    "$ace_root/test/unittest:ace_core_extra",
210    "//third_party/googletest:gmock",
211    "//third_party/googletest:gtest_main",
212  ]
213}
214
215group("core_svg_unittest") {
216  testonly = true
217  deps = [
218    ":parse_test_ng",
219    ":svg_dom_test_ng",
220  ]
221}
222