blob: 17f48e93ac3a7a67480fed23c58006e634516e9a [file] [log] [blame]
load("//bazel:macros.bzl", "bool_flag", "selects", "skia_cc_library")
load(":tests.bzl", "skia_cpu_tests", "skia_ganesh_tests")
CODEC_TESTS = [
"AndroidCodecTest.cpp",
"AnimatedImageTest.cpp",
"CodecAnimTest.cpp",
"CodecExactReadTest.cpp",
"CodecPartialTest.cpp",
"CodecRecommendedTypeTest.cpp",
"CodecTest.cpp",
"ColorSpaceTest.cpp",
"EncodeTest.cpp",
"EncodedInfoTest.cpp",
"ExifTest.cpp",
"GifTest.cpp",
"IndexedPngOverflowTest.cpp",
"WebpTest.cpp",
"YUVTest.cpp",
]
CPU_ONLY_TESTS = [
"AAClipTest.cpp",
"ArenaAllocTest.cpp",
"AsADashTest.cpp",
"AvifTest.cpp",
"BRDTest.cpp",
"BadIcoTest.cpp",
"BitSetTest.cpp",
"BitmapCopyTest.cpp",
"BitmapGetColorTest.cpp",
"BitmapTest.cpp",
"BlitMaskClip.cpp",
"CachedDecodingPixelRefTest.cpp",
"CanvasStateTest.cpp",
"CanvasTest.cpp",
"ChecksumTest.cpp",
"ClipCubicTest.cpp",
"ClipStackTest.cpp",
"ClipperTest.cpp",
"ColorMatrixTest.cpp",
"ColorPrivTest.cpp",
"ColorTest.cpp",
"CtsEnforcement.cpp",
"CubicMapTest.cpp",
"CubicRootsTest.cpp",
"DashPathEffectTest.cpp",
"DataRefTest.cpp",
"DequeTest.cpp",
"DescriptorTest.cpp",
"DrawBitmapRectTest.cpp",
"DrawPathTest.cpp",
"DrawTextTest.cpp",
"EmptyPathTest.cpp",
"F16StagesTest.cpp",
"FillPathTest.cpp",
"FitsInTest.cpp",
"FlattenDrawableTest.cpp",
"FlattenableFactoryToName.cpp",
"FlattenableNameToFactory.cpp",
"Float16Test.cpp",
"FloatingPointTest.cpp",
"FontHostStreamTest.cpp",
"FontHostTest.cpp",
"FontNamesTest.cpp",
"FontTest.cpp",
"FrontBufferedStreamTest.cpp",
"GeometryTest.cpp",
"GlyphRunTest.cpp",
"HSVRoundTripTest.cpp",
"HashTest.cpp",
"HighContrastFilterTest.cpp",
"ICCTest.cpp",
"ImageBitmapTest.cpp",
"ImageFrom565Bitmap.cpp",
"ImageGeneratorTest.cpp",
"IncrTopoSortTest.cpp",
"InfRectTest.cpp",
"InsetConvexPolyTest.cpp",
"InvalidIndexedPngTest.cpp",
"IsClosedSingleContourTest.cpp",
"JSONTest.cpp",
"LListTest.cpp",
"LRUCacheTest.cpp",
"M44Test.cpp",
"MD5Test.cpp",
"MallocPixelRefTest.cpp",
"MaskCacheTest.cpp",
"MathTest.cpp",
"MatrixProcsTest.cpp",
"MatrixTest.cpp",
"MemoryTest.cpp",
"MemsetTest.cpp",
"MeshTest.cpp",
"MetaDataTest.cpp",
"MipMapTest.cpp",
"NdkDecodeTest.cpp",
"NdkEncodeTest.cpp",
"NonlinearBlendingTest.cpp",
"OSPathTest.cpp",
"OffsetSimplePolyTest.cpp",
"OnceTest.cpp",
"OverAlignedTest.cpp",
"PaintTest.cpp",
"ParametricStageTest.cpp",
"ParseColorTest.cpp",
"ParsePathTest.cpp",
"PathBuilderTest.cpp",
"PathCoverageTest.cpp",
"PathMeasureTest.cpp",
"PathTest.cpp",
"PictureBBHTest.cpp",
"PictureShaderTest.cpp",
"PictureTest.cpp",
"PixelRefTest.cpp",
"Point3Test.cpp",
"PointTest.cpp",
"PolyUtilsTest.cpp",
"QuadRootsTest.cpp",
"QuickRejectTest.cpp",
"RRectInPathTest.cpp",
"RTreeTest.cpp",
"RandomTest.cpp",
"ReadPixelsTest.cpp",
"RecordDrawTest.cpp",
"RecordOptsTest.cpp",
"RecordPatternTest.cpp",
"RecordTest.cpp",
"RecorderTest.cpp",
"RecordingXfermodeTest.cpp",
"RectTest.cpp",
"RefCntTest.cpp",
"RegionTest.cpp",
"RoundRectTest.cpp",
"SRGBTest.cpp",
"SafeMathTest.cpp",
"SamplingTest.cpp",
"ScalarTest.cpp",
"ScaleToSidesTest.cpp",
"SerialProcsTest.cpp",
"SerializationTest.cpp",
"ShaderOpacityTest.cpp",
"ShaderTest.cpp",
"ShadowTest.cpp",
"SizeTest.cpp",
"SkBase64Test.cpp",
"SkBlockAllocatorTest.cpp",
"SkColor4fTest.cpp",
"SkColorSpaceXformStepsTest.cpp",
"SkContainersTest.cpp",
"SkDOMTest.cpp",
"SkEnumBitMaskTest.cpp",
"SkGaussFilterTest.cpp",
"SkGlyphBufferTest.cpp",
"SkGlyphTest.cpp",
"SkImageTest.cpp",
"SkPathRangeIterTest.cpp",
"SkSLErrorTest.cpp",
"SkSLInterpreterTest.cpp",
"SkSLMemoryLayoutTest.cpp",
"SkSLTypeTest.cpp",
"SkSharedMutexTest.cpp",
"SkSpanTest.cpp",
"SkStrikeCacheTest.cpp",
"SkStrikeTest.cpp",
"SkStringViewTest.cpp",
"SkTBlockListTest.cpp",
"SkUTFTest.cpp",
"SkVMDebugTracePlayerTest.cpp",
"SkVMDebugTraceTest.cpp",
"SkVMTest.cpp",
"SkVxTest.cpp",
"Skbug6389.cpp",
"SortTest.cpp",
"SrcOverTest.cpp",
"StreamTest.cpp",
"StrikeForGPUTest.cpp",
"StringTest.cpp",
"StrokeTest.cpp",
"SwizzlerTest.cpp",
"TArrayTest.cpp",
"TDPQueueTest.cpp",
"TLazyTest.cpp",
"TemplatesTest.cpp",
"TextBlobTest.cpp",
"TracingTest.cpp",
"TypefaceTest.cpp",
"UnicodeTest.cpp",
"UtilsTest.cpp",
"VerticesTest.cpp",
"Writer32Test.cpp",
"YUVCacheTest.cpp",
]
DEBUGGER_TESTS = [
"MultiPictureDocumentTest.cpp",
"DebugLayerManagerTest.cpp",
]
DISCARDABLE_MEMORY_POOL_TESTS = [
"CachedDataTest.cpp",
"DiscardableMemoryPoolTest.cpp",
"DiscardableMemoryTest.cpp",
"ImageCacheTest.cpp",
"SkResourceCacheTest.cpp",
]
# These files have tests requiring a Ganesh backend, and optionally, tests only for the CPU.
# The mock Ganesh backend is always available; the other ones depend on the compile flags used
# to invoke the tests see //bazel/buildrc for these configurations.
GANESH_TESTS = [
"AdvancedBlendTest.cpp",
"ApplyGammaTest.cpp",
"BackendAllocationTest.cpp",
"BackendSurfaceMutableStateTest.cpp",
"BlendTest.cpp",
"BlurTest.cpp",
"BulkRectTest.cpp",
"ClearTest.cpp",
"ColorFilterTest.cpp",
"CompressedBackendAllocationTest.cpp",
"CopySurfaceTest.cpp",
"CullTestTest.cpp",
"DMSAATest.cpp",
"DefaultPathRendererTest.cpp",
"DeviceTest.cpp",
"DrawOpAtlasTest.cpp",
"EGLImageTest.cpp",
"ExtendedSkColorTypeTests.cpp",
"FindCubicConvex180ChopsTest.cpp",
"FloatingPointTextureTest.cpp",
"GLBackendSurfaceTest.cpp",
"GainmapShaderTest.cpp",
"GpuDrawPathTest.cpp",
"GpuRectanizerTest.cpp",
"GrAHardwareBufferTest.cpp",
"GrClipStackTest.cpp",
"GrContextAbandonTest.cpp",
"GrContextFactoryTest.cpp",
"GrContextOOM.cpp",
"GrDDLImageTest.cpp",
"GrFinishedFlushTest.cpp",
"GrGLExtensionsTest.cpp",
"GrGlyphVectorTest.cpp",
"GrGpuBufferTest.cpp",
"GrMemoryPoolTest.cpp",
"GrMeshTest.cpp",
"GrMipMappedTest.cpp",
"GrOpListFlushTest.cpp",
"GrPipelineDynamicStateTest.cpp",
"GrPorterDuffTest.cpp",
"GrQuadBufferTest.cpp",
"GrQuadCropTest.cpp",
"GrRenderTaskClusterTest.cpp",
"GrSlugTest.cpp",
"GrStyledShapeTest.cpp",
"GrSubmittedFlushTest.cpp",
"GrSurfaceResolveTest.cpp",
"GrSurfaceTest.cpp",
"GrTextBlobTest.cpp",
"GrTextureMipMapInvalidationTest.cpp",
"GrThreadSafeCacheTest.cpp",
"GradientTest.cpp",
"ImageFilterCacheTest.cpp",
"ImageFilterTest.cpp",
"ImageIsOpaqueTest.cpp",
"ImageNewShaderTest.cpp",
"ImageTest.cpp",
"LazyProxyTest.cpp",
"LazyStencilAttachmentTest.cpp",
"MatrixColorFilterTest.cpp",
"MessageBusTest.cpp",
"OpChainTest.cpp",
"PathRendererCacheTests.cpp",
"PinnedImageTest.cpp",
"PreChopPathCurvesTest.cpp",
"PremulAlphaRoundTripTest.cpp",
"PrimitiveProcessorTest.cpp",
"ProcessorTest.cpp",
"ProgramsTest.cpp",
"PromiseImageTest.cpp",
"ProxyConversionTest.cpp",
"ProxyRefTest.cpp",
"ProxyTest.cpp",
"ReadWritePixelsGpuTest.cpp",
"RectangleTextureTest.cpp",
"RepeatedClippedBlurTest.cpp",
"ResourceAllocatorTest.cpp",
"ResourceCacheTest.cpp",
"RuntimeBlendTest.cpp",
"SRGBReadWritePixelsTest.cpp",
"SaveLayerOriginTest.cpp",
"ShaderImageFilterTest.cpp",
"SkRemoteGlyphCacheTest.cpp",
"SkRuntimeEffectTest.cpp",
"SkSLCross.cpp",
"SkSLDSLTest.cpp",
"SkSLES2ConformanceTest.cpp",
"SkSLTest.cpp",
"Skbug12214.cpp",
"Skbug5221.cpp",
"Skbug6653.cpp",
"SpecialImageTest.cpp",
"SpecialSurfaceTest.cpp",
"SrcSrcOverBatchTest.cpp",
"SurfaceDrawContextTest.cpp",
"SurfaceSemaphoreTest.cpp",
"SurfaceTest.cpp",
"TestTest.cpp",
"TextureBindingsResetTest.cpp",
"TextureOpTest.cpp",
"TextureProxyTest.cpp",
"TextureStripAtlasManagerTest.cpp",
"TopoSortTest.cpp",
"TraceMemoryDumpTest.cpp",
"TransferPixelsTest.cpp",
"TriangulatingPathRendererTests.cpp",
"VkBackendSurfaceTest.cpp",
"VkHardwareBufferTest.cpp",
"VkPriorityExtensionTest.cpp",
"VkProtectedContextTest.cpp",
"VkWrapTests.cpp",
"VkYcbcrSamplerTest.cpp",
"WangsFormulaTest.cpp",
"WindowRectanglesTest.cpp",
"WrappedSurfaceCopyOnWriteTest.cpp",
"WritePixelsTest.cpp",
]
PATHOPS_TESTS = [
"CubicChopTest.cpp",
"PathOpsAngleIdeas.cpp",
"PathOpsAngleTest.cpp",
"PathOpsAsWindingTest.cpp",
"PathOpsBattles.cpp",
"PathOpsBoundsTest.cpp",
"PathOpsBuilderConicTest.cpp",
"PathOpsBuilderTest.cpp",
"PathOpsBuildUseTest.cpp",
"PathOpsChalkboardTest.cpp",
"PathOpsConicIntersectionTest.cpp",
"PathOpsConicLineIntersectionTest.cpp",
"PathOpsConicQuadIntersectionTest.cpp",
"PathOpsCubicConicIntersectionTest.cpp",
"PathOpsCubicIntersectionTest.cpp",
"PathOpsCubicLineIntersectionIdeas.cpp",
"PathOpsCubicLineIntersectionTest.cpp",
"PathOpsCubicQuadIntersectionTest.cpp",
"PathOpsCubicReduceOrderTest.cpp",
"PathOpsDCubicTest.cpp",
"PathOpsDLineTest.cpp",
"PathOpsDPointTest.cpp",
"PathOpsDRectTest.cpp",
"PathOpsDVectorTest.cpp",
"PathOpsExtendedTest.cpp",
"PathOpsFuzz763Test.cpp",
"PathOpsInverseTest.cpp",
"PathOpsIssue3651.cpp",
"PathOpsLineIntersectionTest.cpp",
"PathOpsLineParametetersTest.cpp",
"PathOpsOpCircleThreadedTest.cpp",
"PathOpsOpCubicThreadedTest.cpp",
"PathOpsOpLoopThreadedTest.cpp",
"PathOpsOpRectThreadedTest.cpp",
"PathOpsOpTest.cpp",
"PathOpsQuadIntersectionTest.cpp",
"PathOpsQuadLineIntersectionTest.cpp",
"PathOpsQuadLineIntersectionThreadedTest.cpp",
"PathOpsQuadReduceOrderTest.cpp",
"PathOpsSimplifyDegenerateThreadedTest.cpp",
"PathOpsSimplifyFailTest.cpp",
"PathOpsSimplifyQuadralateralsThreadedTest.cpp",
"PathOpsSimplifyQuadThreadedTest.cpp",
"PathOpsSimplifyRectThreadedTest.cpp",
"PathOpsSimplifyTest.cpp",
"PathOpsSimplifyTrianglesThreadedTest.cpp",
"PathOpsSkpTest.cpp",
"PathOpsThreeWayTest.cpp",
"PathOpsTigerTest.cpp",
"PathOpsTightBoundsTest.cpp",
"PathOpsTypesTest.cpp",
"StrokerTest.cpp",
]
PDF_TESTS = [
"AnnotationTest.cpp",
"PDFDeflateWStreamTest.cpp",
"PDFDocumentTest.cpp",
"PDFGlyphsToUnicodeTest.cpp",
"PDFJpegEmbedTest.cpp",
"PDFMetadataAttributeTest.cpp",
"PDFOpaqueSrcModeToSrcOverTest.cpp",
"PDFPrimitivesTest.cpp",
"PDFTaggedLinkTest.cpp",
"PDFTaggedPruningTest.cpp",
"PDFTaggedTableTest.cpp",
"PDFTaggedTest.cpp",
# TODO(kjlubick, bungeman) There are PDF-specific tests in
# CanvasTest.cpp
]
skia_cc_library(
name = "tests_base",
testonly = True,
srcs = [
"CanvasStateHelpers.cpp",
"CtsEnforcement.cpp",
"Test.cpp",
"TestHarness.cpp",
"//tools/flags",
] + select({
"//src/gpu:has_gpu_backend": ["TestUtils.cpp"],
"//conditions:default": [],
}),
hdrs = [
"CanvasStateHelpers.h",
"CodecPriv.h",
"CtsEnforcement.h",
"FakeStreams.h",
"RecordTestUtils.h",
"Test.h",
"TestHarness.h",
"//tools/fonts:test_empty_typeface",
] + select({
"//src/gpu:has_gpu_backend": ["TestUtils.h"],
"//conditions:default": [],
}),
deps = [
"//:skia_internal",
"//tools:registry",
"//tools:tool_utils",
] + select({
"//src/gpu:has_gpu_backend": ["//tools/gpu:utils"],
"//conditions:default": [],
}) + select({
"//src/sksl:needs_sksl": ["//tools:runtime_blend_utils"],
"//conditions:default": [],
}),
)
skia_cc_library(
name = "fontmgr_tests_base",
testonly = True,
srcs = [
"FontMgrFlags.cpp",
],
deps = [":tests_base"],
)
skia_cc_library(
name = "pathops_tests_base",
testonly = True,
srcs = [
"PathOpsCubicIntersectionTestData.cpp",
"PathOpsDebug.cpp",
"PathOpsExtendedTest.cpp",
"PathOpsQuadIntersectionTestData.cpp",
"PathOpsTestCommon.cpp",
"PathOpsThreadedCommon.cpp",
"SubsetPath.cpp",
],
hdrs = [
"PathOpsCubicIntersectionTestData.h",
"PathOpsDebug.h",
"PathOpsExtendedTest.h",
"PathOpsQuadIntersectionTestData.h",
"PathOpsTSectDebug.h",
"PathOpsTestCommon.h",
"PathOpsThreadedCommon.h",
"SubsetPath.h",
"Test.h",
],
deps = [":tests_base"],
)
skia_cc_library(
name = "dsl_only_test_base",
testonly = True,
srcs = [
"SkSLDSLUtil.cpp",
],
deps = [":tests_base"],
)
# These macros generates one test target per file listed in the passed in list. The test target
# has the name of the file, with the .cpp extension removed.
skia_cpu_tests(
name = "codec_tests",
flags = {
"include_decoder": [
"avif_decode_codec",
"gif_decode_codec",
"jpeg_decode_codec",
"jxl_decode_codec",
"png_decode_codec",
"raw_decode_codec",
"webp_decode_codec",
],
"include_encoder": [
"jpeg_encode_codec",
"png_encode_codec",
"webp_encode_codec",
],
},
harness = ":tests_base",
resources = ["//resources"],
tests = CODEC_TESTS,
)
skia_cpu_tests(
name = "cpu_only_tests",
flags = {
"fontmgr_factory": ["custom_directory_fontmgr_factory"],
"enable_sksl": ["True"],
"enable_sksl_tracing": ["True"],
"include_decoder": [
"jpeg_decode_codec",
"png_decode_codec",
],
"include_encoder": [
"png_encode_codec",
],
},
harness = ":tests_base",
resources = ["//resources"],
tests = CPU_ONLY_TESTS,
)
skia_cpu_tests(
name = "discardable_memory_tests",
flags = {
"enable_discardable_memory": ["True"],
"use_default_global_memory_pool": ["True"],
},
harness = ":tests_base",
resources = ["//resources"],
tests = DISCARDABLE_MEMORY_POOL_TESTS,
)
skia_ganesh_tests(
name = "debugger_tests",
extra_deps = ["//tools/debugger"],
harness = ":tests_base",
tests = DEBUGGER_TESTS,
)
skia_ganesh_tests(
name = "dsl_only_tests",
harness = ":dsl_only_test_base",
resources = ["//resources"],
tests = ["SkSLDSLOnlyTest.cpp"],
)
skia_ganesh_tests(
name = "ganesh_tests",
harness = ":tests_base",
resources = ["//resources"],
tests = GANESH_TESTS,
)
skia_cpu_tests(
name = "fontmgr_android_test",
flags = {
"fontmgr_factory": ["android_fontmgr_factory"],
},
harness = ":fontmgr_tests_base",
resources = ["//resources"],
tests = ["FontMgrAndroidParserTest.cpp"],
)
skia_cpu_tests(
name = "fontmgr_test",
flags = {
"fontmgr_factory": ["custom_directory_fontmgr_factory"],
},
harness = ":fontmgr_tests_base",
resources = ["//resources"],
tests = ["FontMgrTest.cpp"],
)
skia_cpu_tests(
name = "fontmgr_fci_test",
flags = {
"fontmgr_factory": ["fci_fontmgr_factory"],
},
harness = ":fontmgr_tests_base",
resources = ["//resources"],
tests = ["FCITest.cpp"],
)
# TODO(kjlubick, bungeman) This test probably won't pass on Windows. We'll need a mechanism for
# running tests only on certain platforms. This probably can be achieved by expanding limit_to
# to generate a test that is configured to run only on linux and one that will only run on Mac
# and Windows will ignore both of those tests.
skia_cpu_tests(
name = "fontmgr_fontconfig_test",
flags = {
"fontmgr_factory": ["fontconfig_fontmgr_factory"],
},
harness = ":fontmgr_tests_base",
resources = ["//resources"],
tests = ["FontMgrFontConfigTest.cpp"],
)
skia_cpu_tests(
name = "mac_only_tests",
harness = ":tests_base",
limit_to = ["@platforms//os:macos"],
tests = ["TypefaceMacTest.cpp"],
)
skia_cpu_tests(
name = "pathops_tests",
harness = ":pathops_tests_base",
tests = PATHOPS_TESTS,
)
skia_cpu_tests(
name = "pdf_tests",
flags = {
"fontmgr_factory": ["custom_directory_fontmgr_factory"],
"enable_pdf_backend": ["True"],
"include_decoder": ["jpeg_decode_codec"],
"include_encoder": ["jpeg_encode_codec"],
},
harness = ":tests_base",
resources = ["//resources"],
tests = PDF_TESTS,
)
skia_ganesh_tests(
name = "secondary_draw_context_tests",
flags = {
"enable_secondary_draw_context": ["True"],
},
harness = ":tests_base",
resources = ["//resources"],
tests = [
"DeferredDisplayListTest.cpp",
"VkDrawableTest.cpp",
],
)
skia_cpu_tests(
name = "svg_tests",
flags = {
"enable_svg_canvas": ["True"],
},
harness = ":tests_base",
resources = ["//resources"],
tests = ["SVGDeviceTest.cpp"],
)
skia_ganesh_tests(
name = "text_blob_cache_test",
extra_deps = ["//tools/fonts:random_scaler_context"],
harness = ":tests_base",
resources = ["//resources"],
tests = ["TextBlobCacheTest.cpp"],
)
bool_flag(
name = "force_cpu_tests",
default = False,
public = False,
)
selects.config_setting_group(
name = "skip_cpu_tests",
match_all = [
"//src/gpu:has_gpu_backend",
":force_cpu_tests_false",
],
)