• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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/graphic/graphic_2d/graphic_config.gni")
16import("${graphic_2d_root}/rosen/modules/render_service_base/config.gni")
17
18config("rs_graphic_test_config") {
19  include_dirs = [
20    "include",
21    "resource",
22    "$graphic_2d_root/rosen/modules",
23    "$graphic_2d_root/rosen/modules/render_service_client/core",
24    "$graphic_2d_root/rosen/modules/render_service_base/include",
25    "$graphic_2d_root/rosen/modules/2d_engine/rosen_text/export/rosen_text",
26    "$graphic_2d_root/rosen/modules/2d_graphics",
27    "$graphic_2d_root/rosen/modules/2d_graphics/include",
28    "$graphic_2d_root/rosen/modules/utils",
29  ]
30
31  defines = rs_common_define
32}
33
34ohos_source_set("rs_graphic_test_src") {
35  defines = []
36  defines += gpu_defines
37  testonly = true
38
39  sources = [
40    "src/rs_graphic_rootnode.cpp",
41    "src/rs_graphic_test.cpp",
42    "src/rs_graphic_test_director.cpp",
43    "src/rs_graphic_test_ext.cpp",
44    "src/rs_graphic_test_img.cpp",
45    "src/rs_graphic_test_text.cpp",
46    "src/rs_graphic_test_utils.cpp",
47    "src/rs_parameter_parse.cpp",
48  ]
49
50  cflags = [
51    "-Wno-pointer-arith",
52    "-Wno-missing-field-initializers",
53    "-Wno-c++11-narrowing",
54  ]
55
56  cflags_cc = [
57    "-fvisibility-inlines-hidden",
58    "-std=c++17",
59  ]
60
61  public_configs = [ ":rs_graphic_test_config" ]
62
63  deps = [
64    "$rosen_root/modules/2d_graphics:2d_graphics",
65    "$rosen_root/modules/platform:eventhandler",
66    "$rosen_root/modules/platform:hilog",
67    "$rosen_root/modules/platform:ipc_core",
68  ]
69
70  public_deps = [
71    "$rosen_root/modules/render_service_base:librender_service_base",
72    "$rosen_root/modules/render_service_client:librender_service_client",
73    "//third_party/googletest:gtest",
74  ]
75
76  public_external_deps = [
77    "graphic_surface:surface",
78    "hilog:libhilog",
79    "hitrace:hitrace_meter",
80    "image_framework:image_native",
81    "libpng:libpng",
82    "window_manager:libdm",
83    "zlib:libz",
84  ]
85
86  part_name = "graphic_2d"
87  subsystem_name = "graphic"
88}
89
90ohos_shared_library("rs_graphic_test") {
91  testonly = true
92
93  public_deps = [
94    ":rs_graphic_test_src",
95    "//third_party/googletest:gtest_main",
96  ]
97
98  part_name = "graphic_2d"
99  subsystem_name = "graphic"
100}
101
102ohos_static_library("rs_graphic_test_main") {
103  testonly = true
104
105  sources = [ "src/rs_graphic_test_main.cpp" ]
106
107  public_deps = [ ":rs_graphic_test_src" ]
108
109  external_deps = [ "hilog:libhilog" ]
110
111  part_name = "graphic_2d"
112  subsystem_name = "graphic"
113}
114
115action_foreach("objcopy_resource") {
116  # add resource file here
117  sources = [
118    "$rosen_root/modules/effect/test/resource/images/test.png",
119    # "resource/pngtest.png",
120  ]
121
122  resource_dir =
123      get_label_info(":binary_resource($current_toolchain)", "target_out_dir")
124
125  outputs = [ "$resource_dir/{{source_name_part}}.data" ]
126
127  script = "build_resource_to_bytecode.py"
128  out_target = rebase_path("$resource_dir/") + "{{source_name_part}}.data"
129
130  args = [
131    "--input",
132    "{{source}}",
133    "--output",
134    out_target,
135  ]
136}
137