# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

assert(is_fuchsia)

import("//build/fuchsia/sdk.gni")
import("//flutter/tools/fuchsia/fuchsia_archive.gni")
import("//flutter/tools/fuchsia/gn-sdk/package.gni")

group("tests") {
  testonly = true
  deps = [ ":text-input-test" ]
}

executable("text-input-test-bin") {
  testonly = true
  output_name = "text-input-test"
  sources = [ "text-input-test.cc" ]

  # This is needed for //third_party/googletest for linking zircon symbols.
  libs = [ "$fuchsia_sdk_path/arch/$target_cpu/sysroot/lib/libzircon.so" ]

  deps = [
    "$fuchsia_sdk_root/fidl:fuchsia.accessibility.semantics",
    "$fuchsia_sdk_root/fidl:fuchsia.component",
    "$fuchsia_sdk_root/fidl:fuchsia.intl",
    "$fuchsia_sdk_root/fidl:fuchsia.kernel",
    "$fuchsia_sdk_root/fidl:fuchsia.tracing.provider",
    "$fuchsia_sdk_root/fidl:fuchsia.ui.app",
    "$fuchsia_sdk_root/fidl:fuchsia.ui.display.singleton",
    "$fuchsia_sdk_root/fidl:fuchsia.ui.input",
    "$fuchsia_sdk_root/fidl:fuchsia.ui.pointerinjector",
    "$fuchsia_sdk_root/fidl:fuchsia.ui.test.input",
    "$fuchsia_sdk_root/fidl:fuchsia.ui.test.scene",
    "$fuchsia_sdk_root/pkg:async",
    "$fuchsia_sdk_root/pkg:async-loop-testing",
    "$fuchsia_sdk_root/pkg:fidl_cpp",
    "$fuchsia_sdk_root/pkg:sys_component_cpp_testing",
    "$fuchsia_sdk_root/pkg:zx",
    "text-input-view:package",
    "//flutter/fml",
    "//flutter/shell/platform/fuchsia/flutter/tests/integration/utils:check_view",
    "//flutter/shell/platform/fuchsia/flutter/tests/integration/utils:portable_ui_test",
    "//third_party/googletest:gtest",
    "//third_party/googletest:gtest_main",
  ]
}

fuchsia_test_archive("text-input-test") {
  deps = [
    ":text-input-test-bin",

    # "OOT" copies of the runners used by tests, to avoid conflicting with the
    # runners in the base fuchsia image.
    # TODO(fxbug.dev/106575): Fix this with subpackages.
    "//flutter/shell/platform/fuchsia/flutter:oot_flutter_jit_runner",
  ]

  binary = "$target_name"
  cml_file = rebase_path("meta/$target_name.cml")
}
