1# Copyright (c) 2022 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")
16
17module_output_path = "graphic_2d/rosen/modules/2d_graphics/render_context"
18
19group("unittest") {
20  testonly = true
21
22  deps = [
23    ":2d_graphics_shader_cache_test",
24    ":RenderContextTest",
25  ]
26}
27
28## Build RenderContextTest
29ohos_unittest("RenderContextTest") {
30  module_out_path = module_output_path
31  public_configs = [ ":render_context_public_config" ]
32  sources = [ "render_context_test.cpp" ]
33  deps = [
34    ":render_context",
35    "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base",
36  ]
37  if (defined(use_rosen_drawing) && use_rosen_drawing) {
38    defines = [ "USE_ROSEN_DRAWING" ]
39  }
40  include_dirs =
41      [ "$graphic_2d_root/rosen/modules/render_service_base/include" ]
42
43  external_deps = [
44    "c_utils:utils",
45    "hilog:libhilog",
46  ]
47}
48
49## Build render_context.a {{{
50config("render_context_public_config") {
51  include_dirs =
52      [ "$graphic_2d_root/rosen/modules/2d_graphics/src/render_context" ]
53
54  cflags = [
55    "-Wall",
56    "-Werror",
57    "-g3",
58    "-Dprivate=public",
59    "-Dprotected=public",
60  ]
61}
62
63ohos_static_library("render_context") {
64  visibility = [ ":*" ]
65  testonly = true
66
67  public_configs = [ ":render_context_public_config" ]
68
69  public_deps = [
70    "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base",
71    "//third_party/googletest:gtest_main",
72  ]
73  subsystem_name = "graphic"
74  part_name = "graphic_2d"
75}
76
77## Build render_context.a }}}
78
79ohos_unittest("2d_graphics_shader_cache_test") {
80  module_out_path = module_output_path
81
82  public_configs = [ ":render_context_public_config" ]
83
84  sources = [
85    "cache_data_test.cpp",
86    "momory_handler_test.cpp",
87    "shader_cache_test.cpp",
88  ]
89
90  include_dirs = [
91    "$graphic_2d_root/rosen/modules/2d_engine",
92    "$graphic_2d_root/rosen/modules/2d_graphics/src/render_context",
93    "$graphic_2d_root/rosen/modules/2d_graphics/include",
94    "$graphic_2d_root/rosen/modules/render_service_base/include",
95  ]
96
97  include_dirs += [ "//third_party/skia/" ]
98
99  deps = [
100    "$graphic_2d_root/rosen/modules/2d_graphics:2d_graphics",
101    "$graphic_2d_root/rosen/modules/render_service_base:librender_service_base",
102    "//third_party/googletest:gtest_main",
103  ]
104
105  external_deps = [ "hilog:libhilog" ]
106
107  defines = []
108  defines += gpu_defines
109
110  part_name = "graphic_2d"
111  subsystem_name = "graphic"
112}
113