| # Copyright 2019 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/components.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/rust/rustc_test.gni") |
| import("//build/testing/environments.gni") |
| import("//build/testing/host_test_data.gni") |
| |
| rustc_library("font_info") { |
| edition = "2021" |
| |
| sources = [ |
| "src/lib.rs", |
| "src/sources.rs", |
| "src/vmo_stream.rs", |
| ] |
| |
| deps = [ |
| "//src/fonts/char_set", |
| "//src/fonts/freetype_ffi", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:byteorder", |
| ] |
| |
| if (is_fuchsia) { |
| deps += [ |
| "//sdk/fidl/fuchsia.mem:fuchsia.mem_rust", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:libc", |
| ] |
| } |
| } |
| |
| rustc_test("font_info_test_bin") { |
| name = "font_info_test" |
| edition = "2021" |
| deps = [ |
| ":font_info", |
| "//src/fonts/char_set", |
| "//third_party/rust_crates:anyhow", |
| ] |
| source_root = "tests/tests.rs" |
| non_rust_deps = [] |
| if (is_host) { |
| non_rust_deps += [ ":test_data" ] |
| } |
| |
| sources = [ "tests/tests.rs" ] |
| } |
| |
| resource("testdata") { |
| sources = [ "//src/fonts/test_data/SampleFont-Regular.ttf" ] |
| outputs = [ "data/{{source_file_part}}" ] |
| } |
| |
| fuchsia_unittest_package("font_info_tests") { |
| deps = [ |
| ":font_info_test_bin", |
| ":testdata", |
| ] |
| } |
| |
| if (is_host) { |
| host_test_data("test_data") { |
| sources = [ "//src/fonts/test_data/SampleFont-Regular.ttf" ] |
| outputs = [ "$root_out_dir/test_data/font_info/{{source_file_part}}" ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":font_info_test_bin($host_toolchain)", |
| ":font_info_tests", |
| ] |
| } |