# Copyright (c) 2025 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")

ohos_unittest("form_render_test") {
  module_out_path = "ace_engine/form_fwk"
  include_dirs = [ "$ace_root/interfaces/inner_api/form_render/include" ]
  sources = [
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_proxy.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_stub.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_proxy.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_stub.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_group.cpp",
    "$ace_root/test/mock/interfaces/mock_uicontent_creator.cpp",
    "$ace_root/test/unittest/core/pattern/form/mock/mock_rs_surface_mode.cpp",
    "form_render_test.cpp",
    "form_renderer_dispatcher_proxy_test.cpp",
  ]

  configs = [ "$ace_root/test/unittest:ace_unittest_config" ]

  deps = [
    "$ace_root/test/unittest:ace_base",
    "$ace_root/test/unittest:ace_components_base",
    "$ace_root/test/unittest:ace_components_event",
    "$ace_root/test/unittest:ace_components_gestures",
    "$ace_root/test/unittest:ace_components_layout",
    "$ace_root/test/unittest:ace_components_manager",
    "$ace_root/test/unittest:ace_components_mock",
    "$ace_root/test/unittest:ace_components_pattern",
    "$ace_root/test/unittest:ace_components_property",
    "$ace_root/test/unittest:ace_components_render",
    "$ace_root/test/unittest:ace_components_syntax",
    "$ace_root/test/unittest:ace_core_animation",
    "$ace_root/test/unittest:ace_core_extra",
    "$ace_root/test/unittest:ace_engine_unittest_flutter_deps",
    "$ace_root/test/unittest:ace_unittest_log",
  ]

  external_deps = [
    "ability_base:want",
    "ability_runtime:ability_context_native",
    "ability_runtime:ability_manager",
    "ability_runtime:runtime",
    "accessibility:accessibility_common",
    "ace_engine:ace_uicontent",
    "cJSON:cjson",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "form_fwk:form_render_info",
    "form_fwk:form_common_info",
    "form_fwk:form_utils",
    "googletest:gmock_main",
    "graphic_2d:librender_service_base",
    "graphic_2d:librender_service_client",
    "graphic_surface:surface",
    "hicollie:libhicollie",
    "hilog:libhilog",
    "hisysevent:libhisysevent",
    "input:libmmi-client",
    "ipc:ipc_core",
    "napi:ace_napi",
    "window_manager:libwm",
  ]
}

ohos_unittest("form_render_group_test") {
  module_out_path = "ace_engine/form_fwk"
  include_dirs = [ "$ace_root/interfaces/inner_api/form_render/include" ]
  sources = [
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_proxy.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_stub.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_proxy.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_stub.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_group.cpp",
    "$ace_root/test/mock/frameworks/base/log/mock_ace_performance_check.cpp",
    "$ace_root/test/mock/frameworks/base/log/mock_ace_performance_monitor.cpp",
    "$ace_root/test/mock/frameworks/bridge/common/utils/mock_engine_helper.cpp",
    "$ace_root/test/mock/adapter/ohos/osal/mock_frame_report.cpp",
    "$ace_root/test/mock/frameworks/base/thread/mock_frame_trace_adapter.cpp",
    "$ace_root/test/mock/frameworks/base/utils/mock_lifecycle_checkable.cpp",
    "$ace_root/test/mock/frameworks/base/ressched/mock_ressched_click_optimizer.cpp",
    "$ace_root/test/mock/frameworks/base/ressched/mock_ressched_report.cpp",
    "$ace_root/test/mock/frameworks/base/ressched/mock_ressched_touch_optimizer.cpp",
    "$ace_root/test/mock/frameworks/base/ressched/mock_taihang_optimizer.cpp",
    "$ace_root/test/mock/adapter/ohos/osal/mock_system_properties.cpp",
    "$ace_root/test/mock/frameworks/core/common/mock_ace_application_info.cpp",
    "$ace_root/test/mock/frameworks/core/common/mock_container.cpp",
    "$ace_root/test/mock/frameworks/core/common/mock_raw_recognizer.cpp",
    "$ace_root/test/mock/frameworks/core/image/mock_image_source_info.cpp",
    "$ace_root/test/mock/frameworks/core/event/package/mock_package_event_proxy.cpp",
    "$ace_root/test/mock/frameworks/core/pipeline/mock_element_register.cpp",
    "$ace_root/test/mock/frameworks/core/pipeline/mock_pipeline_context.cpp",
    "$ace_root/test/mock/frameworks/core/components_ng/render/mock_animation_utils.cpp",
    "$ace_root/test/mock/frameworks/core/components_ng/render/mock_modifier_adapter.cpp",
    "$ace_root/test/mock/interfaces/mock_uicontent_creator.cpp",
    "form_render_group_test.cpp",
  ]

  configs = [ "$ace_root/test/unittest:ace_unittest_config" ]

  deps = [
    "$ace_root/test/unittest:ace_base",
    "$ace_root/test/unittest:ace_components_base",
    "$ace_root/test/unittest:ace_components_event",
    "$ace_root/test/unittest:ace_components_gestures",
    "$ace_root/test/unittest:ace_components_layout",
    "$ace_root/test/unittest:ace_components_manager",
    "$ace_root/test/unittest:ace_components_pattern",
    "$ace_root/test/unittest:ace_components_property",
    "$ace_root/test/unittest:ace_components_render",
    "$ace_root/test/unittest:ace_components_syntax",
    "$ace_root/test/unittest:ace_core_animation",
    "$ace_root/test/unittest:ace_core_extra",
    "$ace_root/test/unittest:ace_engine_unittest_flutter_deps",
    "$ace_root/test/unittest:ace_unittest_log",
    "$ace_root/test/unittest:ace_unittest_trace",
  ]

  external_deps = [
    "ability_base:configuration",
    "ability_base:want",
    "ability_runtime:ability_context_native",
    "ability_runtime:ability_manager",
    "ability_runtime:runtime",
    "accessibility:accessibility_common",
    "ace_engine:ace_uicontent",
    "cJSON:cjson",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "form_fwk:form_render_info",
    "form_fwk:form_common_info",
    "form_fwk:form_utils",
    "googletest:gmock_main",
    "graphic_2d:librender_service_base",
    "graphic_2d:librender_service_client",
    "graphic_surface:surface",
    "hicollie:libhicollie",
    "hilog:libhilog",
    "hisysevent:libhisysevent",
    "input:libmmi-client",
    "ipc:ipc_core",
    "napi:ace_napi",
    "window_manager:libwm",
  ]
}

ohos_unittest("form_render_delegate_proxy_test") {
  module_out_path = "ace_engine/form_fwk"
  include_dirs = [ "$ace_root/interfaces/inner_api/form_render/include" ]
  sources = [
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_proxy.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_stub.cpp",
    "$ace_root/test/mock/frameworks/base/log/mock_ace_performance_monitor.cpp",
    "$ace_root/test/mock/adapter/ohos/osal/mock_system_properties.cpp",
    "$ace_root/test/mock/frameworks/core/common/mock_container.cpp",
    "$ace_root/test/unittest/core/pattern/form/mock/mock_rs_surface_mode.cpp",
    "form_render_delegate_proxy_test.cpp",
  ]

  configs = [ "$ace_root/test/unittest:ace_unittest_config" ]

  deps = []

  external_deps = [
    "ability_base:want",
    "ability_runtime:ability_context_native",
    "ability_runtime:ability_manager",
    "ability_runtime:runtime",
    "accessibility:accessibility_common",
    "ace_engine:ace_uicontent",
    "cJSON:cjson",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "form_fwk:form_render_info",
    "form_fwk:form_common_info",
    "form_fwk:form_utils",
    "googletest:gmock_main",
    "graphic_2d:librender_service_base",
    "graphic_2d:librender_service_client",
    "graphic_surface:surface",
    "hilog:libhilog",
    "input:libmmi-client",
    "ipc:ipc_core",
    "napi:ace_napi",
  ]
}

ohos_unittest("form_render_delegate_stub_test") {
  module_out_path = "ace_engine/form_fwk"
  include_dirs = [ "$ace_root/interfaces/inner_api/form_render/include" ]
  sources = [
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_stub.cpp",
    "$ace_root/test/mock/frameworks/base/log/mock_ace_performance_monitor.cpp",
    "$ace_root/test/mock/adapter/ohos/osal/mock_system_properties.cpp",
    "$ace_root/test/mock/frameworks/core/common/mock_container.cpp",
    "$ace_root/test/unittest/core/pattern/form/mock/mock_rs_surface_mode.cpp",
    "form_render_delegate_stub_test.cpp",
  ]

  configs = [ "$ace_root/test/unittest:ace_unittest_config" ]

  deps = []

  external_deps = [
    "ability_base:want",
    "bundle_framework:appexecfwk_core",
    "bundle_framework:appexecfwk_base",
    "cJSON:cjson",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "form_fwk:form_render_info",
    "form_fwk:form_common_info",
    "form_fwk:form_utils",
    "googletest:gmock_main",
    "graphic_2d:librender_service_base",
    "graphic_2d:librender_service_client",
    "graphic_surface:surface",
    "hilog:libhilog",
    "ipc:ipc_core",
    "napi:ace_napi",
  ]
}

ohos_unittest("form_render_dispatcher_stub_test") {
  module_out_path = "ace_engine/form_fwk"
  include_dirs = [ "$ace_root/interfaces/inner_api/form_render/include" ]
  sources = [
    "$ace_root/frameworks/core/pipeline_ng/ui_task_scheduler.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_proxy.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_stub.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_proxy.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_stub.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_group.cpp",
    "$ace_root/test/mock/frameworks/base/log/mock_ace_performance_check.cpp",
    "$ace_root/test/mock/frameworks/base/log/mock_ace_performance_monitor.cpp",
    "$ace_root/test/mock/frameworks/bridge/common/utils/mock_engine_helper.cpp",
    "$ace_root/test/mock/adapter/ohos/osal/mock_frame_report.cpp",
    "$ace_root/test/mock/frameworks/base/thread/mock_frame_trace_adapter.cpp",
    "$ace_root/test/mock/frameworks/base/ressched/mock_ressched_click_optimizer.cpp",
    "$ace_root/test/mock/frameworks/base/ressched/mock_ressched_report.cpp",
    "$ace_root/test/mock/frameworks/base/ressched/mock_ressched_touch_optimizer.cpp",
    "$ace_root/test/mock/frameworks/base/ressched/mock_taihang_optimizer.cpp",
    "$ace_root/test/mock/adapter/ohos/osal/mock_system_properties.cpp",
    "$ace_root/test/mock/frameworks/core/common/mock_ace_application_info.cpp",
    "$ace_root/test/mock/frameworks/core/common/mock_container.cpp",
    "$ace_root/test/mock/frameworks/core/common/mock_raw_recognizer.cpp",
    "$ace_root/test/mock/frameworks/core/event/mock_touch_event.cpp",
    "$ace_root/test/mock/frameworks/core/image/mock_image_source_info.cpp",
    "$ace_root/test/mock/frameworks/core/pipeline/mock_element_register.cpp",
    "$ace_root/test/mock/frameworks/core/pipeline/mock_pipeline_context.cpp",
    "$ace_root/test/mock/frameworks/core/components_ng/render/mock_animation_utils.cpp",
    "$ace_root/test/mock/frameworks/core/components_ng/render/mock_modifier_adapter.cpp",
    "$ace_root/test/mock/interfaces/mock_uicontent_creator.cpp",
    "form_render_dispatcher_stub_test.cpp",
  ]

  configs = [ "$ace_root/test/unittest:ace_unittest_config" ]

  deps = []

  external_deps = [
    "ability_base:want",
    "ability_runtime:ability_context_native",
    "ability_runtime:ability_manager",
    "ability_runtime:runtime",
    "accessibility:accessibility_common",
    "ace_engine:ace_uicontent",
    "cJSON:cjson",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "form_fwk:form_render_info",
    "form_fwk:form_common_info",
    "form_fwk:form_utils",
    "googletest:gmock_main",
    "graphic_2d:librender_service_base",
    "graphic_2d:librender_service_client",
    "graphic_surface:surface",
    "hicollie:libhicollie",
    "hilog:libhilog",
    "hisysevent:libhisysevent",
    "input:libmmi-client",
    "ipc:ipc_core",
    "napi:ace_napi",
    "window_manager:libwm",
  ]
}

ohos_unittest("form_render_delegate_impl_test") {
  module_out_path = "ace_engine/form_fwk"
  include_dirs = [ "$ace_root/interfaces/inner_api/form_render/include" ]
  sources = [
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_delegate_stub.cpp",
    "$ace_root/test/mock/frameworks/base/log/mock_ace_performance_monitor.cpp",
    "$ace_root/test/mock/adapter/ohos/osal/mock_system_properties.cpp",
    "$ace_root/test/mock/frameworks/core/common/mock_container.cpp",
    "$ace_root/test/unittest/core/pattern/form/mock/mock_rs_surface_mode.cpp",
    "form_render_delegate_impl_test.cpp",
  ]

  configs = [ "$ace_root/test/unittest:ace_unittest_config" ]

  deps = []

  external_deps = [
    "ability_base:want",
    "bundle_framework:appexecfwk_core",
    "bundle_framework:appexecfwk_base",
    "cJSON:cjson",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "form_fwk:form_render_info",
    "form_fwk:form_common_info",
    "form_fwk:form_utils",
    "googletest:gmock_main",
    "graphic_2d:librender_service_base",
    "graphic_2d:librender_service_client",
    "graphic_surface:surface",
    "hilog:libhilog",
    "ipc:ipc_core",
    "napi:ace_napi",
  ]
}

ohos_unittest("form_render_dispatcher_impl_test") {
  module_out_path = "ace_engine/form_fwk"
  include_dirs = [ "$ace_root/interfaces/inner_api/form_render/include" ]
  sources = [
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_impl.cpp",
    "$ace_root/interfaces/inner_api/form_render/src/form_renderer_dispatcher_stub.cpp",
    "form_render_dispatcher_impl_test.cpp",
  ]

  configs = [ "$ace_root/test/unittest:ace_unittest_config" ]

  deps = []

  external_deps = [
    "ability_base:want",
    "ability_runtime:ability_context_native",
    "ability_runtime:ability_manager",
    "ability_runtime:runtime",
    "accessibility:accessibility_common",
    "ace_engine:ace_uicontent",
    "cJSON:cjson",
    "c_utils:utils",
    "eventhandler:libeventhandler",
    "form_fwk:form_render_info",
    "form_fwk:form_common_info",
    "form_fwk:form_utils",
    "googletest:gmock_main",
    "graphic_2d:librender_service_base",
    "graphic_2d:librender_service_client",
    "graphic_surface:surface",
    "hicollie:libhicollie",
    "hilog:libhilog",
    "hisysevent:libhisysevent",
    "input:libmmi-client",
    "ipc:ipc_core",
    "napi:ace_napi",
    "window_manager:libwm",
  ]
}

group("ace_form_render_test") {
  testonly = true
  deps = [
    ":form_render_delegate_impl_test",
    ":form_render_delegate_proxy_test",
    ":form_render_delegate_stub_test",
    ":form_render_dispatcher_impl_test",
    ":form_render_dispatcher_stub_test",
    ":form_render_group_test",
    ":form_render_test",
  ]
}