Flutter Engine
flutter::testing Namespace Reference

Classes

struct  AOTDataDeleter
 
class  AutoDestroyChildLayerId
 
class  AutoIsolateShutdown
 
class  CanvasTestBase
 
class  ConstantFiringVsyncWaiter
 
class  DartIsolateTest
 
class  DartSecondaryIsolateTest
 
class  DummyPlatformConfigurationClient
 
struct  ELFAOTSymbols
 
class  EmbedderConfigBuilder
 
class  EmbedderTest
 
class  EmbedderTestBackingStoreProducer
 
class  EmbedderTestCompositor
 
class  EmbedderTestCompositorGL
 
class  EmbedderTestCompositorSoftware
 
class  EmbedderTestContext
 
class  EmbedderTestContextGL
 
class  EmbedderTestContextSoftware
 
class  EmbedderTestTaskRunner
 A task runner that we expect the embedder to provide but whose implementation is a real FML task runner. More...
 
class  FixtureTest
 
class  FuchsiaShellTest
 
class  GLContextSwitchTest
 
class  ImageDecoderFixtureTest
 
class  ImageDisposeTest
 
class  LayerTestBase
 
class  LayerTreeTest
 
struct  LoadedELFDeleter
 
class  MockCanvas
 
class  MockLayer
 
class  MockRasterCache
 A RasterCache implementation that simulates the act of rendering a Layer or SkPicture without the overhead of rasterization or pixel storage. This implementation is used only for testing proper usage of the RasterCache in layer unit tests. More...
 
class  MockRasterCacheResult
 A RasterCacheResult implementation that represents a cached Layer or SkPicture without the overhead of storage. More...
 
class  MockSession
 
class  MockSessionWrapper
 
class  MockTexture
 
class  MockWin32Window
 Mock for the Win32Window base class. More...
 
class  PendingTests
 
class  ScopedStubFlutterApi
 
class  ScopedStubFlutterGlfwApi
 
class  ScopedStubFlutterWindowsApi
 
class  ShellTest
 
class  ShellTestPlatformView
 
class  ShellTestPlatformViewGL
 
class  ShellTestPlatformViewVulkan
 
class  ShellTestVsyncClock
 
class  ShellTestVsyncWaiter
 
class  SkiaGPUObjectLayerTest
 
class  SkiaGpuObjectTest
 
class  StubFlutterApi
 
class  StubFlutterGlfwApi
 
class  StubFlutterWindowsApi
 
class  SurfaceMock
 
class  TestAndroidSurfaceFactory
 
struct  TestContext
 
class  TestDartNativeResolver
 
class  TestGLSurface
 
class  TestIOManager
 
class  TestSkObject
 
class  TestSwitchableGLContext
 The renderer context used for testing. More...
 
class  TestTimeoutListener
 
class  ThreadTest
 A fixture that creates threads with running message loops that are terminated when the test is done (the threads are joined then as well). While this fixture may be used on it's own, it is often sub-classed by other fixtures whose functioning requires threads to be created as necessary. More...
 
class  TypeConversionsTest
 
struct  UniqueEngineTraits
 
class  Win32FlutterWindowTest
 Test class for Win32FlutterWindow. More...
 

Typedefs

using BackdropFilterLayerTest = LayerTest
 
using CheckerBoardLayerTest = LayerTest
 
using ClipPathLayerTest = LayerTest
 
using ClipRectLayerTest = LayerTest
 
using ClipRRectLayerTest = LayerTest
 
using ColorFilterLayerTest = LayerTest
 
using ContainerLayerTest = LayerTest
 
using FuchsiaLayerTest = ::testing::Test
 
using ImageFilterLayerTest = LayerTest
 
using OpacityLayerTest = LayerTest
 
using PerformanceOverlayLayerTest = LayerTest
 
using PhysicalShapeLayerTest = LayerTest
 
using PictureLayerTest = SkiaGPUObjectLayerTest
 
using PlatformViewLayerTest = LayerTest
 
using ShaderMaskLayerTest = LayerTest
 
using TextureLayerTest = LayerTest
 
using TransformLayerTest = LayerTest
 
using LayerTest = LayerTestBase<::testing::Test >
 
using MockLayerTest = LayerTest
 
using DartLifecycleTest = FixtureTest
 
using DartVMTest = FixtureTest
 
using UnitlessTime = int
 
using Generator = std::function< UnitlessTime(int)>
 
using IntPipeline = Pipeline< int >
 
using Continuation = IntPipeline::ProducerContinuation
 
using CreateVsyncWaiter = std::function< std::unique_ptr< VsyncWaiter >()>
 
using Embedder11yTest = testing::EmbedderTest
 
using UniqueEngine = fml::UniqueObject< FlutterEngine, UniqueEngineTraits >
 
using SemanticsNodeCallback = std::function< void(const FlutterSemanticsNode *)>
 
using SemanticsActionCallback = std::function< void(const FlutterSemanticsCustomAction *)>
 
using UniqueAOTData = std::unique_ptr< _FlutterEngineAOTData, AOTDataDeleter >
 
using EmbedderTest = testing::EmbedderTest
 
using CanvasTest = CanvasTestBase<::testing::Test >
 
using UniqueLoadedELF = std::unique_ptr< Dart_LoadedElf, LoadedELFDeleter >
 
using MockCanvasTest = CanvasTest
 
using NativeEntry = std::function< void(Dart_NativeArguments)>
 

Enumerations

enum  DebuggerStatus {
  DebuggerStatus::kDontKnow,
  DebuggerStatus::kAttached
}
 
enum  MemsetPatternOp {
  MemsetPatternOp::kMemsetPatternOpSetBuffer,
  MemsetPatternOp::kMemsetPatternOpCheckBuffer
}
 

Functions

 TEST (EmbeddedViewParams, GetBoundingRectAfterMutationsWithNoMutations)
 
 TEST (EmbeddedViewParams, GetBoundingRectAfterMutationsWithScale)
 
 TEST (EmbeddedViewParams, GetBoundingRectAfterMutationsWithTranslate)
 
 TEST (EmbeddedViewParams, GetBoundingRectAfterMutationsWithRotation90)
 
 TEST (EmbeddedViewParams, GetBoundingRectAfterMutationsWithRotation45)
 
 TEST (EmbeddedViewParams, GetBoundingRectAfterMutationsWithTranslateScaleAndRotation)
 
 TEST (GLContextSwitchTest, SwitchKeepsContextCurrentWhileInScope)
 
 TEST_F (BackdropFilterLayerTest, PaintingEmptyLayerDies)
 
 TEST_F (BackdropFilterLayerTest, PaintBeforePrerollDies)
 
 TEST_F (BackdropFilterLayerTest, EmptyFilter)
 
 TEST_F (BackdropFilterLayerTest, SimpleFilter)
 
 TEST_F (BackdropFilterLayerTest, MultipleChildren)
 
 TEST_F (BackdropFilterLayerTest, Nested)
 
 TEST_F (BackdropFilterLayerTest, Readback)
 
 TEST_F (CheckerBoardLayerTest, ClipRectSaveLayerNotCheckBoard)
 
 TEST_F (CheckerBoardLayerTest, ClipRectSaveLayerCheckBoard)
 
 TEST_F (CheckerBoardLayerTest, ClipPathSaveLayerNotCheckBoard)
 
 TEST_F (CheckerBoardLayerTest, ClipPathSaveLayerCheckBoard)
 
 TEST_F (CheckerBoardLayerTest, ClipRRectSaveLayerNotCheckBoard)
 
 TEST_F (CheckerBoardLayerTest, ClipRRectSaveLayerCheckBoard)
 
 TEST_F (CheckerBoardLayerTest, PhysicalSaveLayerNotCheckBoard)
 
 TEST_F (CheckerBoardLayerTest, PhysicalSaveLayerCheckBoard)
 
 TEST_F (ClipPathLayerTest, ClipNoneBehaviorDies)
 
 TEST_F (ClipPathLayerTest, PaintingCulledLayerDies)
 
 TEST_F (ClipPathLayerTest, ChildOutsideBounds)
 
 TEST_F (ClipPathLayerTest, FullyContainedChild)
 
 TEST_F (ClipPathLayerTest, PartiallyContainedChild)
 
static bool ReadbackResult (PrerollContext *context, Clip clip_behavior, std::shared_ptr< Layer > child, bool before)
 
static bool ReadbackResult (PrerollContext *context, Clip clip_behavior, std::shared_ptr< Layer > child, bool before)
 
 TEST_F (ClipRRectLayerTest, PaintBeforePreollDies)
 
static bool ReadbackResult (PrerollContext *context, Clip clip_behavior, std::shared_ptr< Layer > child, bool before)
 
 TEST_F (ContainerLayerTest, LayerWithParentHasPlatformView)
 
 TEST_F (ContainerLayerTest, Simple)
 
 TEST_F (ContainerLayerTest, Multiple)
 
 TEST_F (ContainerLayerTest, MultipleWithEmpty)
 
 TEST_F (ContainerLayerTest, NeedsSystemComposite)
 
 TEST_F (ContainerLayerTest, MergedOneChild)
 
 TEST_F (ContainerLayerTest, MergedMultipleChildren)
 
std::unique_ptr< TestContextInitTest ()
 
zx_koid_t GetChildLayerId ()
 
 TEST_F (FuchsiaLayerTest, DISABLED_PhysicalShapeLayersAndChildSceneLayers)
 
 TEST_F (FuchsiaLayerTest, DISABLED_OpacityAndTransformLayer)
 
 TEST_F (ImageFilterLayerTest, SimpleFilterBounds)
 
 TEST_F (ImageFilterLayerTest, ChildIsCached)
 
 TEST_F (ImageFilterLayerTest, ChildrenNotCached)
 
 TEST_F (LayerTreeTest, PaintingEmptyLayerDies)
 
 TEST_F (LayerTreeTest, PaintBeforePreollDies)
 
 TEST_F (LayerTreeTest, Simple)
 
 TEST_F (LayerTreeTest, Multiple)
 
 TEST_F (LayerTreeTest, MultipleWithEmpty)
 
 TEST_F (LayerTreeTest, NeedsSystemComposite)
 
 TEST_F (OpacityLayerTest, LeafLayer)
 
 TEST_F (OpacityLayerTest, FullyOpaque)
 
 TEST_F (OpacityLayerTest, FullyTransparent)
 
 TEST_F (OpacityLayerTest, HalfTransparent)
 
 TEST_F (OpacityLayerTest, CullRectIsTransformed)
 
 TEST_F (PerformanceOverlayLayerTest, InvalidOptions)
 
 TEST_F (PerformanceOverlayLayerTest, SimpleRasterizerStatistics)
 
 TEST (PerformanceOverlayLayerDefault, Gold)
 
 TEST (PerformanceOverlayLayer90fps, Gold)
 
 TEST (PerformanceOverlayLayer120fps, Gold)
 
 TEST_F (PhysicalShapeLayerTest, NonEmptyLayer)
 
 TEST_F (PhysicalShapeLayerTest, ChildrenLargerThanPath)
 
 TEST_F (PhysicalShapeLayerTest, ElevationSimple)
 
 TEST_F (PhysicalShapeLayerTest, ElevationComplex)
 
static bool ReadbackResult (PrerollContext *context, Clip clip_behavior, std::shared_ptr< Layer > child, bool before)
 
 TEST_F (PictureLayerTest, PaintBeforePrerollInvalidPictureDies)
 
 TEST_F (PictureLayerTest, PaintBeforePreollDies)
 
 TEST_F (PictureLayerTest, PaintingEmptyLayerDies)
 
 TEST_F (PictureLayerTest, InvalidPictureDies)
 
 TEST_F (PictureLayerTest, SimplePicture)
 
 TEST_F (PlatformViewLayerTest, NullViewEmbedderDoesntPrerollCompositeOrPaint)
 
 TEST_F (TextureLayerTest, InvalidTexture)
 
 TEST_F (TextureLayerTest, PaintingWithLowFilterQuality)
 
 TEST_F (TransformLayerTest, Identity)
 
 TEST_F (TransformLayerTest, NestedSeparated)
 
 TEST (MatrixDecomposition, Rotation)
 
 TEST (MatrixDecomposition, Scale)
 
 TEST (MatrixDecomposition, Translate)
 
 TEST (MatrixDecomposition, Combination)
 
 TEST (MatrixDecomposition, ScaleFloatError)
 
 TEST (MutatorsStack, Initialization)
 
 TEST (MutatorsStack, CopyConstructor)
 
 TEST (MutatorsStack, CopyAndUpdateTheCopy)
 
 TEST (MutatorsStack, PushClipRect)
 
 TEST (MutatorsStack, PushClipRRect)
 
 TEST (MutatorsStack, PushClipPath)
 
 TEST (MutatorsStack, PushTransform)
 
 TEST (MutatorsStack, PushOpacity)
 
 TEST (MutatorsStack, Pop)
 
 TEST (MutatorsStack, Traversal)
 
 TEST (MutatorsStack, Equality)
 
 TEST (Mutator, Initialization)
 
 TEST (Mutator, CopyConstructor)
 
 TEST (Mutator, Equality)
 
 TEST (Mutator, UnEquality)
 
 TEST (RasterCache, SimpleInitialization)
 
 TEST (RasterCache, ThresholdIsRespected)
 
 TEST (RasterCache, AccessThresholdOfZeroDisablesCaching)
 
 TEST (RasterCache, PictureCacheLimitPerFrameIsRespectedWhenZero)
 
 TEST (RasterCache, SweepsRemoveUnusedFrames)
 
 TEST (RasterCache, DeviceRectRoundOut)
 
 TEST (RTree, searchNonOverlappingDrawnRectsNoIntersection)
 
 TEST (RTree, searchNonOverlappingDrawnRectsSingleRectIntersection)
 
 TEST (RTree, searchNonOverlappingDrawnRectsIgnoresNonDrawingRecords)
 
 TEST (RTree, searchNonOverlappingDrawnRectsMultipleRectIntersection)
 
 TEST (RTree, searchNonOverlappingDrawnRectsJoinRectsWhenIntersectedCase1)
 
 TEST (RTree, searchNonOverlappingDrawnRectsJoinRectsWhenIntersectedCase2)
 
 TEST (RTree, searchNonOverlappingDrawnRectsJoinRectsWhenIntersectedCase3)
 
 TEST_F (SkiaGpuObjectTest, QueueSimple)
 
 TEST_F (SkiaGpuObjectTest, ObjectDestructor)
 
 TEST_F (SkiaGpuObjectTest, ObjectReset)
 
 TEST_F (SkiaGpuObjectTest, ObjectResetTwice)
 
 TEST_F (MockLayerTest, SimpleParams)
 
 TEST_F (MockLayerTest, FakePlatformView)
 
 TEST_F (MockLayerTest, FakeSystemComposite)
 
bool operator== (const MockTexture::PaintCall &a, const MockTexture::PaintCall &b)
 
std::ostream & operator<< (std::ostream &os, const MockTexture::PaintCall &data)
 
 TEST (MockTextureTest, Callbacks)
 
 TEST (MockTextureTest, PaintCalls)
 
 TEST (MockTextureTest, PaintCallsWithLowFilterQuality)
 
 TEST (TextureRegistryTest, UnregisterTextureCallbackTriggered)
 
 TEST (TextureRegistryTest, GrContextCallbackTriggered)
 
 TEST (TextureRegistryTest, RegisterTextureTwice)
 
 TEST (TextureRegistryTest, ReuseSameTextureSlot)
 
static sk_sp< SkData > OpenFixtureAsSkData (const char *name)
 
 TEST_F (ImageDecoderFixtureTest, CanCreateImageDecoder)
 
 TEST_F (ImageDecoderFixtureTest, InvalidImageResultsError)
 
 TEST_F (ImageDecoderFixtureTest, ValidImageResultsInSuccess)
 
 TEST_F (ImageDecoderFixtureTest, ExifDataIsRespectedOnDecode)
 
 TEST_F (ImageDecoderFixtureTest, CanDecodeWithoutAGPUContext)
 
 TEST_F (ImageDecoderFixtureTest, CanDecodeWithResizes)
 
 TEST_F (ImageDecoderFixtureTest, CanResizeWithoutDecode)
 
 TEST (ImageDecoderTest, VerifyCodecRepeatCountsForGifAndWebPAreConsistentWithLoopCounts)
 
 TEST (ImageDecoderTest, VerifySimpleDecoding)
 
 TEST (ImageDecoderTest, VerifySubpixelDecodingPreservesExifOrientation)
 
 TEST_F (ImageDecoderFixtureTest, MultiFrameCodecCanBeCollectedBeforeIOTasksFinish)
 
 TEST_F (ImageDisposeTest, ImageReleasedAfterFrame)
 
 TEST_F (ShellTest, EncodeImageGivesExternalTypedData)
 
 TEST_F (ShellTest, VerticesAccuratelyReportsSize)
 
 TEST_F (ShellTest, PlatformConfigurationInitialization)
 
 TEST_F (ShellTest, PlatformConfigurationWindowMetricsUpdate)
 
void CreateSimulatedPointerData (PointerData &data, PointerData::Change change, int64_t device, double dx, double dy)
 
void CreateSimulatedMousePointerData (PointerData &data, PointerData::Change change, PointerData::SignalKind signal_kind, int64_t device, double dx, double dy, double scroll_delta_x, double scroll_delta_y)
 
void UnpackPointerPacket (std::vector< PointerData > &output, std::unique_ptr< PointerDataPacket > packet)
 
 TEST (PointerDataPacketConverterTest, CanConvetPointerDataPacket)
 
 TEST (PointerDataPacketConverterTest, CanSynthesizeDownAndUp)
 
 TEST (PointerDataPacketConverterTest, CanUpdatePointerIdentifier)
 
 TEST (PointerDataPacketConverterTest, AlwaysForwardMoveEvent)
 
 TEST (PointerDataPacketConverterTest, CanWorkWithDifferentDevices)
 
 TEST (PointerDataPacketConverterTest, CanSynthesizeAdd)
 
 TEST (PointerDataPacketConverterTest, CanHandleThreeFingerGesture)
 
 TEST (PointerDataPacketConverterTest, CanConvetScroll)
 
 TEST_F (DartIsolateTest, RootIsolateCreationAndShutdown)
 
 TEST_F (DartIsolateTest, IsolateShutdownCallbackIsInIsolateScope)
 
 TEST_F (DartIsolateTest, IsolateCanLoadAndRunDartCode)
 
 TEST_F (DartIsolateTest, IsolateCannotLoadAndRunUnknownDartEntrypoint)
 
 TEST_F (DartIsolateTest, CanRunDartCodeCodeSynchronously)
 
 TEST_F (DartIsolateTest, CanRegisterNativeCallback)
 
 TEST_F (DartIsolateTest, CanSaveCompilationTrace)
 
 TEST_F (DartSecondaryIsolateTest, CanLaunchSecondaryIsolates)
 
 TEST_F (DartIsolateTest, CanRecieveArguments)
 
 TEST_F (DartIsolateTest, CanCreateServiceIsolate)
 
 TEST_F (DartIsolateTest, RootIsolateCreateCallbackIsMadeOnceAndBeforeIsolateRunning)
 
 TEST_F (DartIsolateTest, IsolateCreateCallbacksTakeInstanceSettingsInsteadOfVMSettings)
 
 TEST_F (DartLifecycleTest, CanStartAndShutdownVM)
 
 TEST_F (DartLifecycleTest, CanStartAndShutdownVMOverAndOver)
 
static std::shared_ptr< DartIsolateCreateAndRunRootIsolate (const Settings &settings, const DartVMData &vm, fml::RefPtr< fml::TaskRunner > task_runner, std::string entrypoint)
 
 TEST_F (DartLifecycleTest, DISABLED_ShuttingDownTheVMShutsDownAllIsolates)
 
 TEST_F (DartVMTest, SimpleInitialization)
 
 TEST_F (DartVMTest, SimpleIsolateNameServer)
 
 TEST_F (DartVMTest, OldGenHeapSize)
 
 TEST_F (TypeConversionsTest, TestFixture)
 
 TEST_F (TypeConversionsTest, CanConvertEmptyList)
 
 TEST_F (TypeConversionsTest, CanConvertListOfStrings)
 
 TEST_F (TypeConversionsTest, CanConvertListOfDoubles)
 
 TEST_F (TypeConversionsTest, CanConvertListOfInts)
 
 TEST_F (TypeConversionsTest, CanConvertListOfFloatsToListOfDartDoubles)
 
 TEST_F (ShellTest, VSyncTargetTime)
 
 TEST (CanvasSpyTest, DrawingIsTracked)
 
 TEST (CanvasSpyTest, SpiedCanvasIsDrawing)
 
static void TestSimulatedInputEvents (ShellTest *fixture, int num_events, UnitlessTime base_latency, Generator delivery_time, UnitlessTime frame_time, std::vector< UnitlessTime > &events_consumed_at_frame, bool restart_engine=false)
 
void CreateSimulatedPointerData (PointerData &data, PointerData::Change change, double dx, double dy)
 
 TEST_F (ShellTest, MissAtMostOneFrameForIrregularInputEvents)
 
 TEST_F (ShellTest, DelayAtMostOneEventForFasterThanVSyncInputEvents)
 
 TEST_F (ShellTest, HandlesActualIphoneXsInputEvents)
 
 TEST_F (ShellTest, CanCorrectlyPipePointerPacket)
 
 TEST_F (ShellTest, CanCorrectlySynthesizePointerPacket)
 
static void WaitForIO (Shell *shell)
 
 TEST_F (ShellTest, CacheSkSLWorks)
 
static void CheckTextSkData (sk_sp< SkData > data, const std::string &expected)
 
static void ResetAssetManager ()
 
static void CheckTwoSkSLsAreLoaded ()
 
 TEST_F (ShellTest, CanLoadSkSLsFromAsset)
 
 TEST_F (ShellTest, CanRemoveOldPersistentCache)
 
 TEST_F (ShellTest, CanPurgePersistentCache)
 
 TEST_F (ShellTest, PurgeAllowsFutureSkSLCache)
 
 TEST (PipelineTest, ConsumeOneVal)
 
 TEST (PipelineTest, ContinuationCanOnlyBeUsedOnce)
 
 TEST (PipelineTest, PushingMoreThanDepthCompletesFirstSubmission)
 
 TEST (PipelineTest, PushingMultiProcessesInOrder)
 
 TEST (PipelineTest, ProduceIfEmptyDoesNotConsumeWhenQueueIsNotEmpty)
 
 TEST (PipelineTest, ProduceIfEmptySuccessfulIfQueueIsEmpty)
 
static bool ValidateShell (Shell *shell)
 
static void RunCoroutineWithRetry (int retries, fml::AutoResetWaitableEvent *tick, fml::AutoResetWaitableEvent *tock, std::function< bool()> f)
 
 TEST_F (FuchsiaShellTest, LocaltimesVaryOnTimezoneChanges)
 
static bool ValidateShell (Shell *shell)
 
static bool RasterizerHasLayerTree (Shell *shell)
 
static void ValidateDestroyPlatformView (Shell *shell)
 
static std::string CreateFlagsString (std::vector< const char *> &flags)
 
static void TestDartVmFlags (std::vector< const char *> &flags)
 
 TEST_F (ShellTest, InitializeWithInvalidThreads)
 
 TEST_F (ShellTest, InitializeWithDifferentThreads)
 
 TEST_F (ShellTest, InitializeWithSingleThread)
 
 TEST_F (ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread)
 
 TEST_F (ShellTest, InitializeWithMultipleThreadButCallingThreadAsPlatformThread)
 
 TEST_F (ShellTest, InitializeWithGPUAndPlatformThreadsTheSame)
 
 TEST_F (ShellTest, FixturesAreFunctional)
 
 TEST_F (ShellTest, SecondaryIsolateBindingsAreSetupViaShellSettings)
 
 TEST_F (ShellTest, LastEntrypoint)
 
 TEST_F (ShellTest, DisallowedDartVMFlag)
 
 TEST_F (ShellTest, AllowedDartVMFlag)
 
 TEST_F (ShellTest, NoNeedToReportTimingsByDefault)
 
 TEST_F (ShellTest, NeedsReportTimingsIsSetWithCallback)
 
static void CheckFrameTimings (const std::vector< FrameTiming > &timings, fml::TimePoint start, fml::TimePoint finish)
 
 TEST_F (ShellTest, DISABLED_ReportTimingsIsCalled)
 
 TEST_F (ShellTest, FrameRasterizedCallbackIsCalled)
 
 TEST_F (ShellTest, ExternalEmbedderNoThreadMerger)
 
 TEST_F (ShellTest, ExternalEmbedderEndFrameIsCalledWhenPostPrerollResultIsResubmit)
 
 TEST_F (ShellTest, OnPlatformViewDestroyDisablesThreadMerger)
 
 TEST_F (ShellTest, OnPlatformViewDestroyAfterMergingThreads)
 
 TEST_F (ShellTest, OnPlatformViewDestroyWhenThreadsAreMerging)
 
 TEST_F (ShellTest, OnPlatformViewDestroyWithThreadMergerWhileThreadsAreUnmerged)
 
 TEST_F (ShellTest, OnPlatformViewDestroyWithoutRasterThreadMerger)
 
 TEST_F (ShellTest, OnPlatformViewDestroyWithStaticThreadMerging)
 
 TEST_F (ShellTest, DISABLED_SkipAndSubmitFrame)
 
 TEST_F (ShellTest, ResubmitFrame)
 
 TEST (SettingsTest, FrameTimingSetsAndGetsProperly)
 
 TEST_F (ShellTest, ReportTimingsIsCalledSoonerInNonReleaseMode)
 
 TEST_F (ShellTest, ReportTimingsIsCalledImmediatelyAfterTheFirstFrame)
 
 TEST_F (ShellTest, ReloadSystemFonts)
 
 TEST_F (ShellTest, WaitForFirstFrame)
 
 TEST_F (ShellTest, WaitForFirstFrameZeroSizeFrame)
 
 TEST_F (ShellTest, WaitForFirstFrameTimeout)
 
 TEST_F (ShellTest, WaitForFirstFrameMultiple)
 
 TEST_F (ShellTest, WaitForFirstFrameInlined)
 
static size_t GetRasterizerResourceCacheBytesSync (const Shell &shell)
 
 TEST_F (ShellTest, SetResourceCacheSize)
 
 TEST_F (ShellTest, SetResourceCacheSizeEarly)
 
 TEST_F (ShellTest, SetResourceCacheSizeNotifiesDart)
 
 TEST_F (ShellTest, CanCreateImagefromDecompressedBytes)
 
 TEST_F (ShellTest, TextureFrameMarkedAvailableAndUnregister)
 
 TEST_F (ShellTest, IsolateCanAccessPersistentIsolateData)
 
static void LogSkData (sk_sp< SkData > data, const char *title)
 
 TEST_F (ShellTest, Screenshot)
 
 TEST_F (ShellTest, CanConvertToAndFromMappings)
 
 TEST_F (ShellTest, LocaltimesMatch)
 
 TEST_F (ShellTest, CanDecompressImageFromAsset)
 
 TEST_F (ShellTest, OnServiceProtocolGetSkSLsWorks)
 
 TEST_F (ShellTest, RasterizerScreenshot)
 
 TEST_F (ShellTest, RasterizerMakeRasterSnapshot)
 
static sk_sp< SkPicture > MakeSizedPicture (int width, int height)
 
 TEST_F (ShellTest, OnServiceProtocolEstimateRasterCacheMemoryWorks)
 
 TEST_F (ShellTest, DiscardLayerTreeOnResize)
 
 TEST_F (ShellTest, IgnoresInvalidMetrics)
 
 TEST_F (ShellTest, OnServiceProtocolSetAssetBundlePathWorks)
 
 TEST_F (ShellTest, EngineRootIsolateLaunchesDontTakeVMDataSettings)
 
fml::RefPtr< fml::RasterThreadMergerGetThreadMergerFromPlatformThread (bool merged=false)
 
fml::RefPtr< fml::RasterThreadMergerGetThreadMergerFromRasterThread ()
 
 TEST (AndroidExternalViewEmbedder, GetCurrentCanvases)
 
 TEST (AndroidExternalViewEmbedder, GetCurrentCanvases__CompositeOrder)
 
 TEST (AndroidExternalViewEmbedder, CompositeEmbeddedView)
 
 TEST (AndroidExternalViewEmbedder, CancelFrame)
 
 TEST (AndroidExternalViewEmbedder, RasterizerRunsOnPlatformThread)
 
 TEST (AndroidExternalViewEmbedder, RasterizerRunsOnRasterizerThread)
 
 TEST (AndroidExternalViewEmbedder, PlatformViewRect)
 
 TEST (AndroidExternalViewEmbedder, PlatformViewRect__ChangedParams)
 
 TEST (AndroidExternalViewEmbedder, SubmitFrame)
 
 TEST (AndroidExternalViewEmbedder, DoesNotCallJNIPlatformThreadOnlyMethods)
 
 TEST (AndroidExternalViewEmbedder, DestroyOverlayLayersOnSizeChange)
 
 TEST (AndroidExternalViewEmbedder, DoesNotDestroyOverlayLayersOnSizeChange)
 
 TEST (AndroidExternalViewEmbedder, SupportsDynamicThreadMerging)
 
 TEST (AndroidExternalViewEmbedder, DisableThreadMerger)
 
 TEST (SurfacePool, GetLayer__AllocateOneLayer)
 
 TEST (SurfacePool, GetUnusedLayers)
 
 TEST (SurfacePool, GetLayer__Recycle)
 
 TEST (SurfacePool, GetLayer__AllocateTwoLayers)
 
 TEST (SurfacePool, DestroyLayers)
 
 TEST (SurfacePool, DestroyLayers__frameSizeChanged)
 
 TEST (JNIMock, FlutterViewHandlePlatformMessage)
 
 TEST (PlatformViewShell, UpdateSemanticsDoesFlutterViewUpdateSemantics)
 
 TEST (PlatformViewShell, UpdateSemanticsDoesFlutterViewUpdateCustomAccessibilityActions)
 
 TEST (FlutterEngineTest, FlutterEngineCanLaunch)
 
id mockViewController (NSString *pasteboardString)
 
 TEST (FlutterViewControllerTest, HasStringsWhenPasteboardEmpty)
 
 TEST (FlutterViewControllerTest, HasStringsWhenPasteboardFull)
 
 TEST_F (Embedder11yTest, DISABLED_A11yTreeIsConsistent)
 
static void InvokeAllCallbacks (const std::vector< fml::closure > &callbacks)
 
 TEST (EmbedderTestNoFixture, MustNotRunWithInvalidArgs)
 
 TEST_F (EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs)
 
 TEST_F (EmbedderTest, DISABLED_CanLaunchAndShutdownMultipleTimes)
 
 TEST_F (EmbedderTest, CanInvokeCustomEntrypoint)
 
 TEST_F (EmbedderTest, CanInvokeCustomEntrypointMacro)
 
 TEST_F (EmbedderTest, CanSpecifyCustomPlatformTaskRunner)
 
 TEST (EmbedderTestNoFixture, CanGetCurrentTimeInNanoseconds)
 
 TEST_F (EmbedderTest, CanReloadSystemFonts)
 
 TEST_F (EmbedderTest, IsolateServiceIdSent)
 
 TEST_F (EmbedderTest, CanCreateAndCollectCallbacks)
 
 TEST_F (EmbedderTest, PlatformMessagesCanReceiveResponse)
 
 TEST_F (EmbedderTest, PlatformMessagesCanBeSentWithoutResponseHandles)
 
 TEST_F (EmbedderTest, NullPlatformMessagesCanBeSent)
 
 TEST_F (EmbedderTest, InvalidPlatformMessages)
 
 TEST_F (EmbedderTest, VMShutsDownWhenNoEnginesInProcess)
 
 TEST_F (EmbedderTest, DartEntrypointArgs)
 
 TEST_F (EmbedderTest, VMAndIsolateSnapshotSizesAreRedundantInAOTMode)
 
 TEST_F (EmbedderTest, CompositorMustBeAbleToRenderKnownSceneWithSoftwareCompositor)
 
 TEST_F (EmbedderTest, CanCreateInitializedEngine)
 
 TEST_F (EmbedderTest, CanRunInitializedEngine)
 
 TEST_F (EmbedderTest, CaDeinitializeAnEngine)
 
 TEST_F (EmbedderTest, CanUpdateLocales)
 
 TEST_F (EmbedderTest, LocalizationCallbacksCalled)
 
 TEST_F (EmbedderTest, CanQueryDartAOTMode)
 
 TEST_F (EmbedderTest, VerifyB143464703WithSoftwareBackend)
 
 TEST_F (EmbedderTest, CanSendLowMemoryNotification)
 
 TEST_F (EmbedderTest, CanPostTaskToAllNativeThreads)
 
 TEST_F (EmbedderTest, InvalidAOTDataSourcesMustReturnError)
 
 TEST_F (EmbedderTest, MustNotRunWithMultipleAOTSources)
 
 TEST_F (EmbedderTest, CanCreateAndCollectAValidElfSource)
 
 TEST_F (EmbedderTest, CanLaunchAndShutdownWithAValidElfSource)
 
 TEST_F (EmbedderTest, CanCreateOpenGLRenderingEngine)
 
 TEST_F (EmbedderTest, MustPreventEngineLaunchWhenRequiredCompositorArgsAreAbsent)
 
 TEST_F (EmbedderTest, CompositorMustBeAbleToRenderToOpenGLFramebuffer)
 
 TEST_F (EmbedderTest, RasterCacheDisabledWithPlatformViews)
 
 TEST_F (EmbedderTest, RasterCacheEnabled)
 
 TEST_F (EmbedderTest, CompositorMustBeAbleToRenderToOpenGLTexture)
 
 TEST_F (EmbedderTest, CompositorMustBeAbleToRenderToSoftwareBuffer)
 
 TEST_F (EmbedderTest, CompositorMustBeAbleToRenderKnownScene)
 
 TEST_F (EmbedderTest, CustomCompositorMustWorkWithCustomTaskRunner)
 
 TEST_F (EmbedderTest, CompositorMustBeAbleToRenderWithRootLayerOnly)
 
 TEST_F (EmbedderTest, CompositorMustBeAbleToRenderWithPlatformLayerOnBottom)
 
 TEST_F (EmbedderTest, CompositorMustBeAbleToRenderKnownSceneWithRootSurfaceTransformation)
 
 TEST_F (EmbedderTest, CanRenderSceneWithoutCustomCompositor)
 
 TEST_F (EmbedderTest, CanRenderSceneWithoutCustomCompositorWithTransformation)
 
 TEST_F (EmbedderTest, CanRenderGradientWithoutCompositor)
 
 TEST_F (EmbedderTest, CanRenderGradientWithoutCompositorWithXform)
 
 TEST_F (EmbedderTest, CanRenderGradientWithCompositor)
 
 TEST_F (EmbedderTest, CanRenderGradientWithCompositorWithXform)
 
 TEST_F (EmbedderTest, CanRenderGradientWithCompositorOnNonRootLayer)
 
 TEST_F (EmbedderTest, CanRenderGradientWithCompositorOnNonRootLayerWithXform)
 
 TEST_F (EmbedderTest, VerifyB141980393)
 
 TEST_F (EmbedderTest, CanCreateEmbedderWithCustomRenderTaskRunner)
 
 TEST_F (EmbedderTest, CanCreateEmbedderWithCustomRenderTaskRunnerTheSameAsPlatformTaskRunner)
 
 TEST_F (EmbedderTest, CompositorMustBeAbleToRenderKnownScenePixelRatioOnSurface)
 
 TEST_F (EmbedderTest, CompositorMustBeAbleToRenderKnownScenePixelRatioOnSurfaceWithRootSurfaceXformation)
 
 TEST_F (EmbedderTest, PushingMutlipleFramesSetsUpNewRecordingCanvasWithCustomCompositor)
 
 TEST_F (EmbedderTest, PushingMutlipleFramesSetsUpNewRecordingCanvasWithoutCustomCompositor)
 
 TEST_F (EmbedderTest, PlatformViewMutatorsAreValid)
 
 TEST_F (EmbedderTest, PlatformViewMutatorsAreValidWithPixelRatio)
 
 TEST_F (EmbedderTest, PlatformViewMutatorsAreValidWithPixelRatioAndRootSurfaceTransformation)
 
 TEST_F (EmbedderTest, EmptySceneIsAcceptable)
 
 TEST_F (EmbedderTest, SceneWithNoRootContainerIsAcceptable)
 
 TEST_F (EmbedderTest, ArcEndCapsAreDrawnCorrectly)
 
 TEST_F (EmbedderTest, ClipsAreCorrectlyCalculated)
 
 TEST_F (EmbedderTest, ComplexClipsAreCorrectlyCalculated)
 
 TEST_F (EmbedderTest, ObjectsCanBePostedViaPorts)
 
 TEST_F (EmbedderTest, CompositorCanPostZeroLayersForPresentation)
 
 TEST_F (EmbedderTest, CompositorCanPostOnlyPlatformViews)
 
 TEST_F (EmbedderTest, CompositorRenderTargetsAreRecycled)
 
 TEST_F (EmbedderTest, CompositorRenderTargetsAreInStableOrder)
 
 TEST_F (EmbedderTest, FrameInfoContainsValidWidthAndHeight)
 
 TEST_F (EmbedderTest, MustNotRunWithBothFBOCallbacksSet)
 
 TEST_F (EmbedderTest, MustNotRunWithBothPresentCallbacksSet)
 
 TEST_F (EmbedderTest, PresentInfoContainsValidFBOId)
 
 TEST_F (EmbedderTest, SetSingleDisplayConfigurationWithDisplayId)
 
 TEST_F (EmbedderTest, SetSingleDisplayConfigurationWithoutDisplayId)
 
 TEST_F (EmbedderTest, SetValidMultiDisplayConfiguration)
 
 TEST_F (EmbedderTest, MultipleDisplaysWithSingleDisplayTrueIsInvalid)
 
 TEST_F (EmbedderTest, MultipleDisplaysWithSameDisplayIdIsInvalid)
 
sk_sp< SkSurface > CreateRenderSurface (const FlutterLayer &layer, GrDirectContext *context)
 
bool RasterImagesAreSame (sk_sp< SkImage > a, sk_sp< SkImage > b)
 
bool WriteImageToDisk (const fml::UniqueFD &directory, const std::string &name, sk_sp< SkImage > image)
 
bool ImageMatchesFixture (const std::string &fixture_file_name, sk_sp< SkImage > scene_image)
 
bool ImageMatchesFixture (const std::string &fixture_file_name, std::future< sk_sp< SkImage >> &scene_image)
 
void FilterMutationsByType (const FlutterPlatformViewMutation **mutations, size_t count, FlutterPlatformViewMutationType type, std::function< void(const FlutterPlatformViewMutation &mutation)> handler)
 
void FilterMutationsByType (const FlutterPlatformView *view, FlutterPlatformViewMutationType type, std::function< void(const FlutterPlatformViewMutation &mutation)> handler)
 
SkMatrix GetTotalMutationTransformationMatrix (const FlutterPlatformViewMutation **mutations, size_t count)
 
SkMatrix GetTotalMutationTransformationMatrix (const FlutterPlatformView *view)
 
 TEST (FlutterProjectBundle, BasicPropertiesAbsolutePaths)
 
 TEST (FlutterProjectBundle, BasicPropertiesRelativePaths)
 
 TEST (FlutterProjectBundle, SwitchesEmpty)
 
 TEST (FlutterProjectBundle, Switches)
 
 TEST (StringConversion, Utf16FromUtf8Empty)
 
 TEST (StringConversion, Utf16FromUtf8Ascii)
 
 TEST (StringConversion, Utf16FromUtf8Unicode)
 
 TEST (StringConversion, Utf8FromUtf16Empty)
 
 TEST (StringConversion, Utf8FromUtf16Ascii)
 
 TEST (StringConversion, Utf8FromUtf16Unicode)
 
 TEST (SystemUtils, GetPreferredLanguageInfo)
 
 TEST (SystemUtils, GetPreferredLanguages)
 
 TEST (SystemUtils, ParseLanguageNameGeneric)
 
 TEST (SystemUtils, ParseLanguageNameWithRegion)
 
 TEST (SystemUtils, ParseLanguageNameWithScript)
 
 TEST (SystemUtils, ParseLanguageNameWithRegionAndScript)
 
 TEST (SystemUtils, ParseLanguageNameWithSuplementalLanguage)
 
 TEST (SystemUtils, ParseLanguageNameWithThreeCharacterLanguage)
 
 TEST (DpiUtilsTest, NonZero)
 
 TEST (DpiUtilsTest, NullHwndUsesPrimaryMonitor)
 
 TEST (Win32FlutterWindowTest, CreateDestroy)
 
 TEST (Win32WindowProcDelegateManagerTest, CallsCorrectly)
 
 TEST (Win32WindowProcDelegateManagerTest, ReplacementRegister)
 
 TEST (Win32WindowProcDelegateManagerTest, RegisterMultiple)
 
 TEST (Win32WindowProcDelegateManagerTest, ConflictingDelegates)
 
 TEST (Win32WindowProcDelegateManagerTest, Unregister)
 
 TEST (MockWin32Window, CreateDestroy)
 
 TEST (MockWin32Window, GetDpiAfterCreate)
 
 TEST (MockWin32Window, VerticalScroll)
 
 TEST (MockWin32Window, HorizontalScroll)
 
bool NumberNear (double a, double b)
 
std::ostream & operator<< (std::ostream &os, const SkClipOp &o)
 
std::ostream & operator<< (std::ostream &os, const SkMatrix &m)
 
std::ostream & operator<< (std::ostream &os, const SkM44 &m)
 
std::ostream & operator<< (std::ostream &os, const SkVector3 &v)
 
std::ostream & operator<< (std::ostream &os, const SkRect &r)
 
std::ostream & operator<< (std::ostream &os, const SkRRect &r)
 
std::ostream & operator<< (std::ostream &os, const SkPath &r)
 
std::ostream & operator<< (std::ostream &os, const SkPoint &r)
 
std::ostream & operator<< (std::ostream &os, const SkISize &size)
 
std::ostream & operator<< (std::ostream &os, const SkColor4f &r)
 
std::ostream & operator<< (std::ostream &os, const SkPaint &r)
 
std::unique_ptr< AutoIsolateShutdownRunDartCodeInIsolateOnUITaskRunner (DartVMRef &vm_ref, const Settings &p_settings, const TaskRunners &task_runners, std::string entrypoint, const std::vector< std::string > &args, const std::string &fixtures_path, fml::WeakPtr< IOManager > io_manager)
 
std::unique_ptr< AutoIsolateShutdownRunDartCodeInIsolate (DartVMRef &vm_ref, const Settings &settings, const TaskRunners &task_runners, std::string entrypoint, const std::vector< std::string > &args, const std::string &fixtures_path, fml::WeakPtr< IOManager > io_manager)
 
void RunDartCodeInIsolate (DartVMRef &vm_ref, std::unique_ptr< AutoIsolateShutdown > &result, const Settings &settings, const TaskRunners &task_runners, std::string entrypoint, const std::vector< std::string > &args, const std::string &fixtures_path, fml::WeakPtr< IOManager > io_manager={})
 
DebuggerStatus GetDebuggerStatus ()
 
ELFAOTSymbols LoadELFSymbolFromFixturesIfNeccessary ()
 Attempts to resolve AOT symbols from the portable ELF loader. This location is automatically resolved from the fixtures generator. This only returns valid symbols when the VM is configured for AOT. More...
 
bool PrepareSettingsForAOTWithSymbols (Settings &settings, const ELFAOTSymbols &symbols)
 Prepare the settings objects various AOT mappings resolvers with the symbols already loaded. This method does nothing in non-AOT runtime modes. More...
 
bool operator== (const MockCanvas::SaveData &a, const MockCanvas::SaveData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::SaveData &data)
 
bool operator== (const MockCanvas::SaveLayerData &a, const MockCanvas::SaveLayerData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::SaveLayerData &data)
 
bool operator== (const MockCanvas::RestoreData &a, const MockCanvas::RestoreData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::RestoreData &data)
 
bool operator== (const MockCanvas::ConcatMatrixData &a, const MockCanvas::ConcatMatrixData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::ConcatMatrixData &data)
 
bool operator== (const MockCanvas::ConcatMatrix44Data &a, const MockCanvas::ConcatMatrix44Data &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::ConcatMatrix44Data &data)
 
bool operator== (const MockCanvas::SetMatrixData &a, const MockCanvas::SetMatrixData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::SetMatrixData &data)
 
bool operator== (const MockCanvas::DrawRectData &a, const MockCanvas::DrawRectData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::DrawRectData &data)
 
bool operator== (const MockCanvas::DrawPathData &a, const MockCanvas::DrawPathData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::DrawPathData &data)
 
bool operator== (const MockCanvas::DrawTextData &a, const MockCanvas::DrawTextData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::DrawTextData &data)
 
bool operator== (const MockCanvas::DrawPictureData &a, const MockCanvas::DrawPictureData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::DrawPictureData &data)
 
bool operator== (const MockCanvas::DrawShadowData &a, const MockCanvas::DrawShadowData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::DrawShadowData &data)
 
bool operator== (const MockCanvas::ClipRectData &a, const MockCanvas::ClipRectData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::ClipRectData &data)
 
bool operator== (const MockCanvas::ClipRRectData &a, const MockCanvas::ClipRRectData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::ClipRRectData &data)
 
bool operator== (const MockCanvas::ClipPathData &a, const MockCanvas::ClipPathData &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::ClipPathData &data)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::DrawCallData &data)
 
bool operator== (const MockCanvas::DrawCall &a, const MockCanvas::DrawCall &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::DrawCall &draw)
 
bool operator== (const MockCanvas::DrawPaint &a, const MockCanvas::DrawPaint &b)
 
std::ostream & operator<< (std::ostream &os, const MockCanvas::DrawPaint &data)
 
 TEST_F (MockCanvasTest, DrawRRectDies)
 
 TEST_F (MockCanvasTest, DrawCalls)
 
static const uint8_t * DartNativeEntrySymbolCallback (Dart_NativeFunction function)
 
static std::string GetEGLError ()
 
 TEST (TestMetalSurface, EmptySurfaceIsInvalid)
 
 TEST (TestMetalSurface, CanCreateValidTestMetalSurface)
 
template<class T >
auto WeakPtr (std::shared_ptr< T > pointer)
 
static std::string GetTestNameFromTestInfo (const ::testing::TestInfo &test_info)
 
std::string GetCurrentTestName ()
 Gets the name of the currently running test. This is useful in generating logs or assets based on test name. More...
 
fml::UniqueFD OpenFixturesDirectory ()
 Opens the fixtures directory for the unit-test harness. More...
 
fml::UniqueFD OpenFixture (std::string fixture_name)
 Opens a fixture of the given file name. More...
 
std::unique_ptr< fml::MappingOpenFixtureAsMapping (std::string fixture_name)
 Opens a fixture of the given file name and returns a mapping to its contents. More...
 
bool MemsetPatternSetOrCheck (uint8_t *buffer, size_t size, MemsetPatternOp op)
 Depending on the operation, either scribbles a known pattern into the buffer or checks if that pattern is present in an existing buffer. This is a portable variant of the memset_pattern class of methods that also happen to do assert that the same pattern exists. More...
 
bool MemsetPatternSetOrCheck (std::vector< uint8_t > &buffer, MemsetPatternOp op)
 
const char * GetFixturesPath ()
 Returns the directory containing the test fixture for the target if this target has fixtures configured. If there are no fixtures, this is a link error. If you see a linker error on this symbol, the unit-test target needs to depend on a test_fixtures target. More...
 

Variables

FML_THREAD_LOCAL fml::ThreadLocalUniquePtr< int > current_context
 
constexpr const char * kAOTAppELFFileName = "app_elf_snapshot.so"
 
constexpr SkISize kSize = SkISize::Make(64, 64)
 
static constexpr SkRect kEmptyRect = SkRect::MakeEmpty()
 
static std::mutex gIsolateResolversMutex
 
static std::map< Dart_Isolate, std::weak_ptr< TestDartNativeResolver > > gIsolateResolvers
 

Typedef Documentation

◆ BackdropFilterLayerTest

◆ CanvasTest

using flutter::testing::CanvasTest = typedef CanvasTestBase<::testing::Test>

Definition at line 28 of file canvas_test.h.

◆ CheckerBoardLayerTest

◆ ClipPathLayerTest

◆ ClipRectLayerTest

◆ ClipRRectLayerTest

◆ ColorFilterLayerTest

◆ ContainerLayerTest

◆ Continuation

◆ CreateVsyncWaiter

using flutter::testing::CreateVsyncWaiter = typedef std::function<std::unique_ptr<VsyncWaiter>()>

Definition at line 15 of file vsync_waiters_test.h.

◆ DartLifecycleTest

◆ DartVMTest

Definition at line 14 of file dart_vm_unittests.cc.

◆ Embedder11yTest

◆ EmbedderTest

◆ FuchsiaLayerTest

using flutter::testing::FuchsiaLayerTest = typedef ::testing::Test

Definition at line 30 of file fuchsia_layer_unittests.cc.

◆ Generator

Definition at line 17 of file input_events_unittests.cc.

◆ ImageFilterLayerTest

◆ IntPipeline

Definition at line 18 of file pipeline_unittests.cc.

◆ LayerTest

using flutter::testing::LayerTest = typedef LayerTestBase<::testing::Test>

Definition at line 151 of file layer_test.h.

◆ MockCanvasTest

Definition at line 13 of file mock_canvas_unittests.cc.

◆ MockLayerTest

Definition at line 14 of file mock_layer_unittests.cc.

◆ NativeEntry

using flutter::testing::NativeEntry = typedef std::function<void(Dart_NativeArguments)>

Definition at line 28 of file test_dart_native_resolver.h.

◆ OpacityLayerTest

Definition at line 16 of file opacity_layer_unittests.cc.

◆ PerformanceOverlayLayerTest

◆ PhysicalShapeLayerTest

◆ PictureLayerTest

◆ PlatformViewLayerTest

◆ SemanticsActionCallback

◆ SemanticsNodeCallback

◆ ShaderMaskLayerTest

◆ TextureLayerTest

Definition at line 16 of file texture_layer_unittests.cc.

◆ TransformLayerTest

◆ UniqueAOTData

Definition at line 39 of file embedder_test_context.h.

◆ UniqueEngine

◆ UniqueLoadedELF

using flutter::testing::UniqueLoadedELF = typedef std::unique_ptr<Dart_LoadedElf, LoadedELFDeleter>

Definition at line 23 of file elf_loader.h.

◆ UnitlessTime

using flutter::testing::UnitlessTime = typedef int

Definition at line 13 of file input_events_unittests.cc.

Enumeration Type Documentation

◆ DebuggerStatus

Enumerator
kDontKnow 
kAttached 

Definition at line 13 of file debugger_detection.h.

◆ MemsetPatternOp

Function Documentation

◆ CheckFrameTimings()

static void flutter::testing::CheckFrameTimings ( const std::vector< FrameTiming > &  timings,
fml::TimePoint  start,
fml::TimePoint  finish 
)
static

Definition at line 376 of file shell_unittests.cc.

References flutter::FrameTiming::kPhases, and phase.

Referenced by TEST_F().

378  {
379  fml::TimePoint last_frame_start;
380  for (size_t i = 0; i < timings.size(); i += 1) {
381  // Ensure that timings are sorted.
382  ASSERT_TRUE(timings[i].Get(FrameTiming::kPhases[0]) >= last_frame_start);
383  last_frame_start = timings[i].Get(FrameTiming::kPhases[0]);
384 
385  fml::TimePoint last_phase_time;
386  for (auto phase : FrameTiming::kPhases) {
387  ASSERT_TRUE(timings[i].Get(phase) >= start);
388  ASSERT_TRUE(timings[i].Get(phase) <= finish);
389 
390  // phases should have weakly increasing time points
391  ASSERT_TRUE(last_phase_time <= timings[i].Get(phase));
392  last_phase_time = timings[i].Get(phase);
393  }
394  }
395 }
FlutterPointerPhase phase
Definition: fl_view.cc:78

◆ CheckTextSkData()

static void flutter::testing::CheckTextSkData ( sk_sp< SkData >  data,
const std::string &  expected 
)
static

Definition at line 135 of file persistent_cache_unittests.cc.

Referenced by TEST_F().

135  {
136  std::string data_string(reinterpret_cast<const char*>(data->bytes()),
137  data->size());
138  ASSERT_EQ(data_string, expected);
139 }

◆ CheckTwoSkSLsAreLoaded()

static void flutter::testing::CheckTwoSkSLsAreLoaded ( )
static

Definition at line 146 of file persistent_cache_unittests.cc.

References flutter::PersistentCache::GetCacheForProcess(), and flutter::PersistentCache::LoadSkSLs().

Referenced by TEST_F().

146  {
147  auto shaders = PersistentCache::GetCacheForProcess()->LoadSkSLs();
148  ASSERT_EQ(shaders.size(), 2u);
149 }

◆ CreateAndRunRootIsolate()

static std::shared_ptr<DartIsolate> flutter::testing::CreateAndRunRootIsolate ( const Settings settings,
const DartVMData vm,
fml::RefPtr< fml::TaskRunner task_runner,
std::string  entrypoint 
)
static

Definition at line 46 of file dart_lifecycle_unittests.cc.

References flutter::DartIsolate::CreateRunningRootIsolate(), FML_CHECK, FML_LOG, flutter::DartVMData::GetIsolateSnapshot(), flutter::DartVMData::GetSettings(), flutter::IsolateConfiguration::InferFromSettings(), flutter::Settings::isolate_create_callback, and flutter::Settings::isolate_shutdown_callback.

Referenced by TEST_F().

50  {
51  FML_CHECK(entrypoint.size() > 0);
52  TaskRunners runners("io.flutter.test", task_runner, task_runner, task_runner,
53  task_runner);
54 
55  auto isolate_configuration =
56  IsolateConfiguration::InferFromSettings(settings);
57 
58  auto isolate =
59  DartIsolate::CreateRunningRootIsolate(
60  vm.GetSettings(), // settings
61  vm.GetIsolateSnapshot(), // isolate_snapshot
62  runners, // task_runners
63  {}, // window
64  {}, // snapshot_delegate
65  {}, // hint_freed_delegate
66  {}, // io_manager
67  {}, // unref_queue
68  {}, // image_decoder
69  "main.dart", // advisory_script_uri
70  entrypoint.c_str(), // advisory_script_entrypoint
71  DartIsolate::Flags{}, // flags
72  settings.isolate_create_callback, // isolate create callback
73  settings.isolate_shutdown_callback, // isolate shutdown callback,
74  entrypoint, // dart entrypoint
75  std::nullopt, // dart entrypoint library
76  std::move(isolate_configuration) // isolate configuration
77  )
78  .lock();
79 
80  if (!isolate) {
81  FML_LOG(ERROR) << "Could not launch the root isolate.";
82  return nullptr;
83  }
84 
85  return isolate;
86 }
#define FML_LOG(severity)
Definition: logging.h:65
#define FML_CHECK(condition)
Definition: logging.h:68

◆ CreateFlagsString()

static std::string flutter::testing::CreateFlagsString ( std::vector< const char *> &  flags)
static

Definition at line 95 of file shell_unittests.cc.

Referenced by TestDartVmFlags().

95  {
96  if (flags.size() == 0) {
97  return "";
98  }
99  std::string flags_string = flags[0];
100  for (size_t i = 1; i < flags.size(); ++i) {
101  flags_string += ",";
102  flags_string += flags[i];
103  }
104  return flags_string;
105 }
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol Prefix for the symbols representing ICU data linked into the Flutter library dart flags
Definition: switches.h:66

◆ CreateRenderSurface()

sk_sp< SkSurface > flutter::testing::CreateRenderSurface ( const FlutterLayer layer,
GrDirectContext *  context 
)

Definition at line 12 of file embedder_unittests_util.cc.

References FML_CHECK, FlutterSize::height, FlutterLayer::size, and FlutterSize::width.

Referenced by TEST_F().

13  {
14  const auto image_info =
15  SkImageInfo::MakeN32Premul(layer.size.width, layer.size.height);
16  auto surface = context ? SkSurface::MakeRenderTarget(
17  context, // context
18  SkBudgeted::kNo, // budgeted
19  image_info, // image info
20  1, // sample count
21  kTopLeft_GrSurfaceOrigin, // surface origin
22  nullptr, // surface properties
23  false // mipmaps
24 
25  )
26  : SkSurface::MakeRaster(image_info);
27  FML_CHECK(surface != nullptr);
28  return surface;
29 }
FlutterSize size
The size of the layer (in physical pixels).
Definition: embedder.h:902
double width
Definition: embedder.h:311
#define FML_CHECK(condition)
Definition: logging.h:68
double height
Definition: embedder.h:312

◆ CreateSimulatedMousePointerData()

void flutter::testing::CreateSimulatedMousePointerData ( PointerData data,
PointerData::Change  change,
PointerData::SignalKind  signal_kind,
int64_t  device,
double  dx,
double  dy,
double  scroll_delta_x,
double  scroll_delta_y 
)

Definition at line 49 of file pointer_data_packet_converter_unittests.cc.

References flutter::PointerData::buttons, flutter::PointerData::change, flutter::PointerData::device, flutter::PointerData::distance, flutter::PointerData::distance_max, flutter::PointerData::kind, flutter::PointerData::kMouse, flutter::PointerData::obscured, flutter::PointerData::orientation, flutter::PointerData::physical_delta_x, flutter::PointerData::physical_delta_y, flutter::PointerData::physical_x, flutter::PointerData::physical_y, flutter::PointerData::platformData, flutter::PointerData::pointer_identifier, flutter::PointerData::pressure, flutter::PointerData::pressure_max, flutter::PointerData::pressure_min, flutter::PointerData::radius_major, flutter::PointerData::radius_max, flutter::PointerData::radius_min, flutter::PointerData::radius_minor, flutter::PointerData::scroll_delta_x, flutter::PointerData::scroll_delta_y, flutter::PointerData::signal_kind, flutter::PointerData::size, flutter::PointerData::synthesized, flutter::PointerData::tilt, and flutter::PointerData::time_stamp.

Referenced by TEST().

56  {
57  data.time_stamp = 0;
58  data.change = change;
59  data.kind = PointerData::DeviceKind::kMouse;
60  data.signal_kind = signal_kind;
61  data.device = device;
62  data.pointer_identifier = 0;
63  data.physical_x = dx;
64  data.physical_y = dy;
65  data.physical_delta_x = 0.0;
66  data.physical_delta_y = 0.0;
67  data.buttons = 0;
68  data.obscured = 0;
69  data.synthesized = 0;
70  data.pressure = 0.0;
71  data.pressure_min = 0.0;
72  data.pressure_max = 0.0;
73  data.distance = 0.0;
74  data.distance_max = 0.0;
75  data.size = 0.0;
76  data.radius_major = 0.0;
77  data.radius_minor = 0.0;
78  data.radius_min = 0.0;
79  data.radius_max = 0.0;
80  data.orientation = 0.0;
81  data.tilt = 0.0;
82  data.platformData = 0;
83  data.scroll_delta_x = scroll_delta_x;
84  data.scroll_delta_y = scroll_delta_y;
85 }

◆ CreateSimulatedPointerData() [1/2]

void flutter::testing::CreateSimulatedPointerData ( PointerData data,
PointerData::Change  change,
int64_t  device,
double  dx,
double  dy 
)

Definition at line 14 of file pointer_data_packet_converter_unittests.cc.

References flutter::PointerData::buttons, flutter::PointerData::change, flutter::PointerData::device, flutter::PointerData::distance, flutter::PointerData::distance_max, flutter::PointerData::kind, flutter::PointerData::kNone, flutter::PointerData::kTouch, flutter::PointerData::obscured, flutter::PointerData::orientation, flutter::PointerData::physical_delta_x, flutter::PointerData::physical_delta_y, flutter::PointerData::physical_x, flutter::PointerData::physical_y, flutter::PointerData::platformData, flutter::PointerData::pointer_identifier, flutter::PointerData::pressure, flutter::PointerData::pressure_max, flutter::PointerData::pressure_min, flutter::PointerData::radius_major, flutter::PointerData::radius_max, flutter::PointerData::radius_min, flutter::PointerData::radius_minor, flutter::PointerData::scroll_delta_x, flutter::PointerData::scroll_delta_y, flutter::PointerData::signal_kind, flutter::PointerData::size, flutter::PointerData::synthesized, flutter::PointerData::tilt, and flutter::PointerData::time_stamp.

Referenced by TEST(), and TEST_F().

18  {
19  data.time_stamp = 0;
20  data.change = change;
21  data.kind = PointerData::DeviceKind::kTouch;
22  data.signal_kind = PointerData::SignalKind::kNone;
23  data.device = device;
24  data.pointer_identifier = 0;
25  data.physical_x = dx;
26  data.physical_y = dy;
27  data.physical_delta_x = 0.0;
28  data.physical_delta_y = 0.0;
29  data.buttons = 0;
30  data.obscured = 0;
31  data.synthesized = 0;
32  data.pressure = 0.0;
33  data.pressure_min = 0.0;
34  data.pressure_max = 0.0;
35  data.distance = 0.0;
36  data.distance_max = 0.0;
37  data.size = 0.0;
38  data.radius_major = 0.0;
39  data.radius_minor = 0.0;
40  data.radius_min = 0.0;
41  data.radius_max = 0.0;
42  data.orientation = 0.0;
43  data.tilt = 0.0;
44  data.platformData = 0;
45  data.scroll_delta_x = 0.0;
46  data.scroll_delta_y = 0.0;
47 }

◆ CreateSimulatedPointerData() [2/2]

void flutter::testing::CreateSimulatedPointerData ( PointerData data,
PointerData::Change  change,
double  dx,
double  dy 
)

Definition at line 144 of file input_events_unittests.cc.

References flutter::PointerData::buttons, flutter::PointerData::change, flutter::PointerData::device, flutter::PointerData::distance, flutter::PointerData::distance_max, flutter::PointerData::kind, flutter::PointerData::kNone, flutter::PointerData::kTouch, flutter::PointerData::obscured, flutter::PointerData::orientation, flutter::PointerData::physical_delta_x, flutter::PointerData::physical_delta_y, flutter::PointerData::physical_x, flutter::PointerData::physical_y, flutter::PointerData::platformData, flutter::PointerData::pointer_identifier, flutter::PointerData::pressure, flutter::PointerData::pressure_max, flutter::PointerData::pressure_min, flutter::PointerData::radius_major, flutter::PointerData::radius_max, flutter::PointerData::radius_min, flutter::PointerData::radius_minor, flutter::PointerData::scroll_delta_x, flutter::PointerData::scroll_delta_y, flutter::PointerData::signal_kind, flutter::PointerData::size, flutter::PointerData::synthesized, flutter::PointerData::tilt, and flutter::PointerData::time_stamp.

147  {
148  data.time_stamp = 0;
149  data.change = change;
150  data.kind = PointerData::DeviceKind::kTouch;
151  data.signal_kind = PointerData::SignalKind::kNone;
152  data.device = 0;
153  data.pointer_identifier = 0;
154  data.physical_x = dx;
155  data.physical_y = dy;
156  data.physical_delta_x = 0.0;
157  data.physical_delta_y = 0.0;
158  data.buttons = 0;
159  data.obscured = 0;
160  data.synthesized = 0;
161  data.pressure = 0.0;
162  data.pressure_min = 0.0;
163  data.pressure_max = 0.0;
164  data.distance = 0.0;
165  data.distance_max = 0.0;
166  data.size = 0.0;
167  data.radius_major = 0.0;
168  data.radius_minor = 0.0;
169  data.radius_min = 0.0;
170  data.radius_max = 0.0;
171  data.orientation = 0.0;
172  data.tilt = 0.0;
173  data.platformData = 0;
174  data.scroll_delta_x = 0.0;
175  data.scroll_delta_y = 0.0;
176 }

◆ DartNativeEntrySymbolCallback()

static const uint8_t* flutter::testing::DartNativeEntrySymbolCallback ( Dart_NativeFunction  function)
static

Definition at line 63 of file test_dart_native_resolver.cc.

Referenced by flutter::testing::TestDartNativeResolver::SetNativeResolverForIsolate().

64  {
65  return reinterpret_cast<const uint8_t*>("¯\\_(ツ)_/¯");
66 }

◆ FilterMutationsByType() [1/2]

void flutter::testing::FilterMutationsByType ( const FlutterPlatformViewMutation **  mutations,
size_t  count,
FlutterPlatformViewMutationType  type,
std::function< void(const FlutterPlatformViewMutation &mutation)>  handler 
)

Definition at line 141 of file embedder_unittests_util.cc.

References FlutterPlatformViewMutation::type.

Referenced by FilterMutationsByType(), GetTotalMutationTransformationMatrix(), and TEST_F().

145  {
146  if (mutations == nullptr) {
147  return;
148  }
149 
150  for (size_t i = 0; i < count; ++i) {
151  const FlutterPlatformViewMutation* mutation = mutations[i];
152  if (mutation->type != type) {
153  continue;
154  }
155 
156  handler(*mutation);
157  }
158 }
FlutterPlatformViewMutationType type
The type of the mutation described by the subsequent union.
Definition: embedder.h:807

◆ FilterMutationsByType() [2/2]

void flutter::testing::FilterMutationsByType ( const FlutterPlatformView view,
FlutterPlatformViewMutationType  type,
std::function< void(const FlutterPlatformViewMutation &mutation)>  handler 
)

Definition at line 160 of file embedder_unittests_util.cc.

References FilterMutationsByType(), FlutterPlatformView::mutations, and FlutterPlatformView::mutations_count.

163  {
164  return FilterMutationsByType(view->mutations, view->mutations_count, type,
165  handler);
166 }
size_t mutations_count
Definition: embedder.h:825
void FilterMutationsByType(const FlutterPlatformView *view, FlutterPlatformViewMutationType type, std::function< void(const FlutterPlatformViewMutation &mutation)> handler)
const FlutterPlatformViewMutation ** mutations
Definition: embedder.h:838

◆ GetChildLayerId()

zx_koid_t flutter::testing::GetChildLayerId ( )

Definition at line 313 of file fuchsia_layer_unittests.cc.

Referenced by TEST_F().

313  {
314  static zx_koid_t sChildLayerId = 17324;
315  return sChildLayerId++;
316 }

◆ GetCurrentTestName()

std::string flutter::testing::GetCurrentTestName ( )

Gets the name of the currently running test. This is useful in generating logs or assets based on test name.

Returns
The current test name.

Definition at line 12 of file testing.cc.

Referenced by flutter::testing::TypeConversionsTest::RunWithEntrypoint(), and TEST_F().

12  {
13  return ::testing::UnitTest::GetInstance()->current_test_info()->name();
14 }

◆ GetDebuggerStatus()

DebuggerStatus flutter::testing::GetDebuggerStatus ( )

Definition at line 25 of file debugger_detection.cc.

References FML_CHECK, kAttached, kDontKnow, and fml::size().

Referenced by main().

25  {
26 #if OS_MACOSX
27  // From Technical Q&A QA1361 Detecting the Debugger
28  // https://developer.apple.com/library/archive/qa/qa1361/_index.html
29  int management_info_base[4];
30  struct kinfo_proc info;
31  size_t size;
32 
33  // Initialize the flags so that, if sysctl fails for some bizarre
34  // reason, we get a predictable result.
35  info.kp_proc.p_flag = 0;
36 
37  // Initialize management_info_base, which tells sysctl the info we want, in
38  // this case we're looking for information about a specific process ID.
39  management_info_base[0] = CTL_KERN;
40  management_info_base[1] = KERN_PROC;
41  management_info_base[2] = KERN_PROC_PID;
42  management_info_base[3] = getpid();
43 
44  // Call sysctl.
45 
46  size = sizeof(info);
47  auto status =
48  ::sysctl(management_info_base,
49  sizeof(management_info_base) / sizeof(*management_info_base),
50  &info, &size, NULL, 0);
51  FML_CHECK(status == 0);
52 
53  // We're being debugged if the P_TRACED flag is set.
54  return ((info.kp_proc.p_flag & P_TRACED) != 0) ? DebuggerStatus::kAttached
55  : DebuggerStatus::kDontKnow;
56 
57 #elif OS_WIN
58  return ::IsDebuggerPresent() ? DebuggerStatus::kAttached
59  : DebuggerStatus::kDontKnow;
60 
61 #else
62  return DebuggerStatus::kDontKnow;
63 #endif
64 } // namespace testing
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13
#define FML_CHECK(condition)
Definition: logging.h:68

◆ GetEGLError()

static std::string flutter::testing::GetEGLError ( )
static

Definition at line 22 of file test_gl_surface.cc.

References eglGetError(), and error.

Referenced by flutter::testing::TestGLSurface::ClearCurrent(), flutter::testing::TestGLSurface::MakeCurrent(), flutter::testing::TestGLSurface::MakeResourceCurrent(), flutter::testing::TestGLSurface::Present(), flutter::testing::TestGLSurface::TestGLSurface(), and flutter::testing::TestGLSurface::~TestGLSurface().

22  {
23  std::stringstream stream;
24 
25  auto error = ::eglGetError();
26 
27  stream << "EGL Result: '";
28 
29  switch (error) {
30  case EGL_SUCCESS:
31  stream << "EGL_SUCCESS";
32  break;
33  case EGL_NOT_INITIALIZED:
34  stream << "EGL_NOT_INITIALIZED";
35  break;
36  case EGL_BAD_ACCESS:
37  stream << "EGL_BAD_ACCESS";
38  break;
39  case EGL_BAD_ALLOC:
40  stream << "EGL_BAD_ALLOC";
41  break;
42  case EGL_BAD_ATTRIBUTE:
43  stream << "EGL_BAD_ATTRIBUTE";
44  break;
45  case EGL_BAD_CONTEXT:
46  stream << "EGL_BAD_CONTEXT";
47  break;
48  case EGL_BAD_CONFIG:
49  stream << "EGL_BAD_CONFIG";
50  break;
51  case EGL_BAD_CURRENT_SURFACE:
52  stream << "EGL_BAD_CURRENT_SURFACE";
53  break;
54  case EGL_BAD_DISPLAY:
55  stream << "EGL_BAD_DISPLAY";
56  break;
57  case EGL_BAD_SURFACE:
58  stream << "EGL_BAD_SURFACE";
59  break;
60  case EGL_BAD_MATCH:
61  stream << "EGL_BAD_MATCH";
62  break;
63  case EGL_BAD_PARAMETER:
64  stream << "EGL_BAD_PARAMETER";
65  break;
66  case EGL_BAD_NATIVE_PIXMAP:
67  stream << "EGL_BAD_NATIVE_PIXMAP";
68  break;
69  case EGL_BAD_NATIVE_WINDOW:
70  stream << "EGL_BAD_NATIVE_WINDOW";
71  break;
72  case EGL_CONTEXT_LOST:
73  stream << "EGL_CONTEXT_LOST";
74  break;
75  default:
76  stream << "Unknown";
77  }
78 
79  stream << "' (0x" << std::hex << error << std::dec << ").";
80  return stream.str();
81 }
FlMethodResponse GError ** error
EGLint eglGetError()
Definition: mock_egl.cc:252

◆ GetFixturesPath()

const char* flutter::testing::GetFixturesPath ( )

Returns the directory containing the test fixture for the target if this target has fixtures configured. If there are no fixtures, this is a link error. If you see a linker error on this symbol, the unit-test target needs to depend on a test_fixtures target.

Returns
The fixtures path.

Referenced by flutter::BM_PlatformMessageResponseDartComplete(), flutter::testing::EmbedderTest::GetFixturesDirectory(), ImageMatchesFixture(), LoadELFSymbolFromFixturesIfNeccessary(), main(), mockViewController(), OpenFixture(), OpenFixtureAsSkData(), OpenFixturesDirectory(), flutter::testing::TypeConversionsTest::RunWithEntrypoint(), flutter::testing::EmbedderTestContext::SetupAOTDataIfNecessary(), flutter::StartupAndShutdownShell(), TEST(), and TEST_F().

◆ GetRasterizerResourceCacheBytesSync()

static size_t flutter::testing::GetRasterizerResourceCacheBytesSync ( const Shell shell)
static

Definition at line 1331 of file shell_unittests.cc.

References flutter::Shell::GetRasterizer(), flutter::TaskRunners::GetRasterTaskRunner(), flutter::Shell::GetTaskRunners(), fml::TaskRunner::RunNowOrPostTask(), fml::AutoResetWaitableEvent::Signal(), and fml::AutoResetWaitableEvent::Wait().

Referenced by TEST_F().

1331  {
1332  size_t bytes = 0;
1335  shell.GetTaskRunners().GetRasterTaskRunner(), [&]() {
1336  if (auto rasterizer = shell.GetRasterizer()) {
1337  bytes = rasterizer->GetResourceCacheMaxBytes().value_or(0U);
1338  }
1339  latch.Signal();
1340  });
1341  latch.Wait();
1342  return bytes;
1343 }
static void RunNowOrPostTask(fml::RefPtr< fml::TaskRunner > runner, const fml::closure &task)
Definition: task_runner.cc:55

◆ GetTestNameFromTestInfo()

static std::string flutter::testing::GetTestNameFromTestInfo ( const ::testing::TestInfo &  test_info)
static

Definition at line 86 of file test_timeout_listener.cc.

References name, fml::TimePoint::Now(), fml::TaskRunner::PostTask(), and WeakPtr().

87  {
88  std::stringstream stream;
89  stream << test_info.test_suite_name();
90  stream << ".";
91  stream << test_info.name();
92  if (auto type_param = test_info.type_param()) {
93  stream << "/" << type_param;
94  }
95  if (auto value_param = test_info.value_param()) {
96  stream << "/" << value_param;
97  }
98  return stream.str();
99 }

◆ GetThreadMergerFromPlatformThread()

fml::RefPtr<fml::RasterThreadMerger> flutter::testing::GetThreadMergerFromPlatformThread ( bool  merged = false)

Definition at line 66 of file external_view_embedder_unittests.cc.

References fml::MessageLoop::EnsureInitializedForCurrentThread(), and fml::MessageLoop::GetCurrentTaskQueueId().

Referenced by TEST().

67  {
68  // Assume the current thread is the platform thread.
70  auto platform_queue_id = fml::MessageLoop::GetCurrentTaskQueueId();
71 
72  if (merged) {
73  return fml::MakeRefCounted<fml::RasterThreadMerger>(platform_queue_id,
74  platform_queue_id);
75  }
76  auto rasterizer_thread = new fml::Thread("rasterizer");
77  auto rasterizer_queue_id =
78  rasterizer_thread->GetTaskRunner()->GetTaskQueueId();
79  return fml::MakeRefCounted<fml::RasterThreadMerger>(platform_queue_id,
80  rasterizer_queue_id);
81 }
static void EnsureInitializedForCurrentThread()
Definition: message_loop.cc:27
static TaskQueueId GetCurrentTaskQueueId()
Definition: message_loop.cc:76

◆ GetThreadMergerFromRasterThread()

fml::RefPtr<fml::RasterThreadMerger> flutter::testing::GetThreadMergerFromRasterThread ( )

Definition at line 83 of file external_view_embedder_unittests.cc.

References fml::MessageLoop::EnsureInitializedForCurrentThread(), and fml::MessageLoop::GetCurrentTaskQueueId().

Referenced by TEST().

83  {
84  auto platform_thread = new fml::Thread("rasterizer");
85  auto platform_queue_id = platform_thread->GetTaskRunner()->GetTaskQueueId();
86 
87  // Assume the current thread is the raster thread.
89  auto rasterizer_queue_id = fml::MessageLoop::GetCurrentTaskQueueId();
90 
91  return fml::MakeRefCounted<fml::RasterThreadMerger>(platform_queue_id,
92  rasterizer_queue_id);
93 }
static void EnsureInitializedForCurrentThread()
Definition: message_loop.cc:27
static TaskQueueId GetCurrentTaskQueueId()
Definition: message_loop.cc:76

◆ GetTotalMutationTransformationMatrix() [1/2]

SkMatrix flutter::testing::GetTotalMutationTransformationMatrix ( const FlutterPlatformViewMutation **  mutations,
size_t  count 
)

Definition at line 168 of file embedder_unittests_util.cc.

References FilterMutationsByType(), kFlutterPlatformViewMutationTypeTransformation, and SkMatrixMake().

Referenced by GetTotalMutationTransformationMatrix(), and TEST_F().

170  {
171  SkMatrix collected;
172 
175  [&](const auto& mutation) {
176  collected.preConcat(SkMatrixMake(mutation.transformation));
177  });
178 
179  return collected;
180 }
SkMatrix SkMatrixMake(const FlutterTransformation &xformation)
void FilterMutationsByType(const FlutterPlatformView *view, FlutterPlatformViewMutationType type, std::function< void(const FlutterPlatformViewMutation &mutation)> handler)

◆ GetTotalMutationTransformationMatrix() [2/2]

SkMatrix flutter::testing::GetTotalMutationTransformationMatrix ( const FlutterPlatformView view)

Definition at line 182 of file embedder_unittests_util.cc.

References GetTotalMutationTransformationMatrix(), FlutterPlatformView::mutations, and FlutterPlatformView::mutations_count.

182  {
184  view->mutations_count);
185 }
size_t mutations_count
Definition: embedder.h:825
const FlutterPlatformViewMutation ** mutations
Definition: embedder.h:838
SkMatrix GetTotalMutationTransformationMatrix(const FlutterPlatformView *view)

◆ ImageMatchesFixture() [1/2]

bool flutter::testing::ImageMatchesFixture ( const std::string &  fixture_file_name,
sk_sp< SkImage >  scene_image 
)

Definition at line 82 of file embedder_unittests_util.cc.

References FML_CHECK, FML_LOG, GetFixturesPath(), fml::FileMapping::GetMapping(), fml::FileMapping::GetSize(), fml::paths::JoinPaths(), OpenFixture(), OpenFixturesDirectory(), RasterImagesAreSame(), and WriteImageToDisk().

Referenced by ImageMatchesFixture(), and TEST_F().

83  {
84  fml::FileMapping fixture_image_mapping(OpenFixture(fixture_file_name));
85 
86  FML_CHECK(fixture_image_mapping.GetSize() != 0u)
87  << "Could not find fixture: " << fixture_file_name;
88 
89  auto encoded_image = SkData::MakeWithoutCopy(
90  fixture_image_mapping.GetMapping(), fixture_image_mapping.GetSize());
91  auto fixture_image =
92  SkImage::MakeFromEncoded(std::move(encoded_image))->makeRasterImage();
93 
94  FML_CHECK(fixture_image) << "Could not create image from fixture: "
95  << fixture_file_name;
96 
97  auto scene_image_subset = scene_image->makeSubset(
98  SkIRect::MakeWH(fixture_image->width(), fixture_image->height()));
99 
100  FML_CHECK(scene_image_subset)
101  << "Could not create image subset for fixture comparison: "
102  << scene_image_subset;
103 
104  const auto images_are_same =
105  RasterImagesAreSame(scene_image_subset, fixture_image);
106 
107  // If the images are not the same, this predicate is going to indicate test
108  // failure. Dump both the actual image and the expectation to disk to the
109  // test author can figure out what went wrong.
110  if (!images_are_same) {
111  const auto fixtures_path = GetFixturesPath();
112 
113  const auto actual_file_name = "actual_" + fixture_file_name;
114  const auto expect_file_name = "expectation_" + fixture_file_name;
115 
116  auto fixtures_fd = OpenFixturesDirectory();
117 
118  FML_CHECK(
119  WriteImageToDisk(fixtures_fd, actual_file_name, scene_image_subset))
120  << "Could not write file to disk: " << actual_file_name;
121 
122  FML_CHECK(WriteImageToDisk(fixtures_fd, expect_file_name, fixture_image))
123  << "Could not write file to disk: " << expect_file_name;
124 
125  FML_LOG(ERROR) << "Image did not match expectation." << std::endl
126  << "Expected:"
127  << fml::paths::JoinPaths({fixtures_path, expect_file_name})
128  << std::endl
129  << "Got:"
130  << fml::paths::JoinPaths({fixtures_path, actual_file_name})
131  << std::endl;
132  }
133  return images_are_same;
134 }
#define FML_LOG(severity)
Definition: logging.h:65
fml::UniqueFD OpenFixturesDirectory()
Opens the fixtures directory for the unit-test harness.
Definition: testing.cc:16
std::string JoinPaths(std::initializer_list< std::string > components)
Definition: paths.cc:14
bool RasterImagesAreSame(sk_sp< SkImage > a, sk_sp< SkImage > b)
fml::UniqueFD OpenFixture(std::string fixture_name)
Opens a fixture of the given file name.
Definition: testing.cc:30
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...
#define FML_CHECK(condition)
Definition: logging.h:68
bool WriteImageToDisk(const fml::UniqueFD &directory, const std::string &name, sk_sp< SkImage > image)

◆ ImageMatchesFixture() [2/2]

bool flutter::testing::ImageMatchesFixture ( const std::string &  fixture_file_name,
std::future< sk_sp< SkImage >> &  scene_image 
)

Definition at line 136 of file embedder_unittests_util.cc.

References ImageMatchesFixture().

137  {
138  return ImageMatchesFixture(fixture_file_name, scene_image.get());
139 }
bool ImageMatchesFixture(const std::string &fixture_file_name, std::future< sk_sp< SkImage >> &scene_image)

◆ InitTest()

std::unique_ptr<TestContext> flutter::testing::InitTest ( )

Definition at line 273 of file fuchsia_layer_unittests.cc.

References flutter::kGiantRect.

Referenced by TEST_F().

273  {
274  std::unique_ptr<TestContext> context = std::make_unique<TestContext>();
275 
276  // Init message loop.
277  context->loop = fml::MakeRefCounted<fml::MessageLoopFuchsia>();
278  context->task_runner = fml::MakeRefCounted<fml::TaskRunner>(context->loop);
279 
280  // Init Session.
281  fuchsia::ui::scenic::SessionPtr session_ptr;
282  fuchsia::ui::scenic::SessionListenerPtr listener;
283  context->listener_request = listener.NewRequest();
284  context->mock_session.Bind(session_ptr.NewRequest(), std::move(listener));
285  context->mock_session_wrapper =
286  std::make_unique<MockSessionWrapper>(std::move(session_ptr));
287 
288  // Init SceneUpdateContext.
289  context->scene_update_context = std::make_shared<SceneUpdateContext>(
290  "fuchsia_layer_unittest", fuchsia::ui::views::ViewToken(),
291  scenic::ViewRefPair::New(), *(context->mock_session_wrapper));
292 
293  // Init PrerollContext.
294  context->preroll_context = std::unique_ptr<PrerollContext>(new PrerollContext{
295  nullptr, // raster_cache (don't consult the cache)
296  nullptr, // gr_context (used for the raster cache)
297  nullptr, // external view embedder
298  context->unused_stack, // mutator stack
299  nullptr, // SkColorSpace* dst_color_space
300  kGiantRect, // SkRect cull_rect
301  false, // layer reads from surface
302  context->unused_stopwatch, // frame time (dont care)
303  context->unused_stopwatch, // engine time (dont care)
304  context->unused_texture_registry, // texture registry (not
305  // supported)
306  false, // checkerboard_offscreen_layers
307  1.f // ratio between logical and physical
308  });
309 
310  return context;
311 }
static constexpr SkRect kGiantRect
Definition: layer.h:38

◆ InvokeAllCallbacks()

static void flutter::testing::InvokeAllCallbacks ( const std::vector< fml::closure > &  callbacks)
static

Definition at line 22 of file embedder_test_compositor.cc.

Referenced by flutter::testing::EmbedderTestCompositor::CollectBackingStore(), flutter::testing::EmbedderTestCompositor::CreateBackingStore(), and flutter::testing::EmbedderTestCompositor::Present().

22  {
23  for (const auto& callback : callbacks) {
24  if (callback) {
25  callback();
26  }
27  }
28 }

◆ LoadELFSymbolFromFixturesIfNeccessary()

ELFAOTSymbols flutter::testing::LoadELFSymbolFromFixturesIfNeccessary ( )

Attempts to resolve AOT symbols from the portable ELF loader. This location is automatically resolved from the fixtures generator. This only returns valid symbols when the VM is configured for AOT.

Returns
The loaded ELF symbols.

Definition at line 15 of file elf_loader.cc.

References error, FML_LOG, GetFixturesPath(), fml::IsFile(), flutter::DartVM::IsRunningPrecompiledCode(), fml::paths::JoinPaths(), kAOTAppELFFileName, flutter::testing::ELFAOTSymbols::loaded_elf, flutter::testing::ELFAOTSymbols::vm_isolate_data, flutter::testing::ELFAOTSymbols::vm_isolate_instrs, flutter::testing::ELFAOTSymbols::vm_snapshot_data, and flutter::testing::ELFAOTSymbols::vm_snapshot_instrs.

Referenced by flutter::StartupAndShutdownShell().

15  {
16  if (!DartVM::IsRunningPrecompiledCode()) {
17  return {};
18  }
19 
20  const auto elf_path =
22 
23  if (!fml::IsFile(elf_path)) {
24  FML_LOG(ERROR) << "App AOT file does not exist for this fixture. Attempts "
25  "to launch the Dart VM with these AOT symbols will fail.";
26  return {};
27  }
28 
29  ELFAOTSymbols symbols;
30 
31  // Must not be freed.
32  const char* error = nullptr;
33 
34 #if OS_FUCHSIA
35  // TODO(gw280): https://github.com/flutter/flutter/issues/50285
36  // Dart doesn't implement Dart_LoadELF on Fuchsia
37  auto loaded_elf = nullptr;
38 #else
39  auto loaded_elf =
40  Dart_LoadELF(elf_path.c_str(), // file path
41  0, // file offset
42  &error, // error (out)
43  &symbols.vm_snapshot_data, // vm snapshot data (out)
44  &symbols.vm_snapshot_instrs, // vm snapshot instrs (out)
45  &symbols.vm_isolate_data, // vm isolate data (out)
46  &symbols.vm_isolate_instrs // vm isolate instr (out)
47  );
48 #endif
49 
50  if (loaded_elf == nullptr) {
51  FML_LOG(ERROR)
52  << "Could not fetch AOT symbols from loaded ELF. Attempts "
53  "to launch the Dart VM with these AOT symbols will fail. Error: "
54  << error;
55  return {};
56  }
57 
58  symbols.loaded_elf.reset(loaded_elf);
59 
60  return symbols;
61 }
FlMethodResponse GError ** error
#define FML_LOG(severity)
Definition: logging.h:65
std::string JoinPaths(std::initializer_list< std::string > components)
Definition: paths.cc:14
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...
bool IsFile(const std::string &path)
Definition: file_posix.cc:143
constexpr const char * kAOTAppELFFileName
Definition: elf_loader.h:17

◆ LogSkData()

static void flutter::testing::LogSkData ( sk_sp< SkData >  data,
const char *  title 
)
static

Definition at line 1616 of file shell_unittests.cc.

References FML_LOG.

Referenced by TEST_F().

1616  {
1617  FML_LOG(ERROR) << "---------- " << title;
1618  std::ostringstream ostr;
1619  for (size_t i = 0; i < data->size();) {
1620  ostr << std::hex << std::setfill('0') << std::setw(2)
1621  << static_cast<int>(data->bytes()[i]) << " ";
1622  i++;
1623  if (i % 16 == 0 || i == data->size()) {
1624  FML_LOG(ERROR) << ostr.str();
1625  ostr.str("");
1626  ostr.clear();
1627  }
1628  }
1629 }
#define FML_LOG(severity)
Definition: logging.h:65

◆ MakeSizedPicture()

static sk_sp<SkPicture> flutter::testing::MakeSizedPicture ( int  width,
int  height 
)
static

Definition at line 1929 of file shell_unittests.cc.

Referenced by TEST_F().

1929  {
1930  SkPictureRecorder recorder;
1931  SkCanvas* recording_canvas =
1932  recorder.beginRecording(SkRect::MakeXYWH(0, 0, width, height));
1933  recording_canvas->drawRect(SkRect::MakeXYWH(0, 0, width, height),
1934  SkPaint(SkColor4f::FromColor(SK_ColorRED)));
1935  return recorder.finishRecordingAsPicture();
1936 }
int32_t height
int32_t width

◆ MemsetPatternSetOrCheck() [1/2]

bool flutter::testing::MemsetPatternSetOrCheck ( uint8_t *  buffer,
size_t  size,
MemsetPatternOp  op 
)

Depending on the operation, either scribbles a known pattern into the buffer or checks if that pattern is present in an existing buffer. This is a portable variant of the memset_pattern class of methods that also happen to do assert that the same pattern exists.

Parameters
bufferThe buffer
[in]sizeThe size
[in]opThe operation
Returns
If the result of the operation was a success.

Definition at line 56 of file testing.cc.

References kMemsetPatternOpCheckBuffer, and kMemsetPatternOpSetBuffer.

Referenced by MemsetPatternSetOrCheck(), and TEST_F().

56  {
57  if (buffer == nullptr) {
58  return false;
59  }
60 
61  auto pattern = reinterpret_cast<const uint8_t*>("dErP");
62  constexpr auto pattern_length = 4;
63 
64  uint8_t* start = buffer;
65  uint8_t* p = buffer;
66 
67  while ((start + size) - p >= pattern_length) {
68  switch (op) {
69  case MemsetPatternOp::kMemsetPatternOpSetBuffer:
70  memmove(p, pattern, pattern_length);
71  break;
72  case MemsetPatternOp::kMemsetPatternOpCheckBuffer:
73  if (memcmp(pattern, p, pattern_length) != 0) {
74  return false;
75  }
76  break;
77  };
78  p += pattern_length;
79  }
80 
81  if ((start + size) - p != 0) {
82  switch (op) {
83  case MemsetPatternOp::kMemsetPatternOpSetBuffer:
84  memmove(p, pattern, (start + size) - p);
85  break;
86  case MemsetPatternOp::kMemsetPatternOpCheckBuffer:
87  if (memcmp(pattern, p, (start + size) - p) != 0) {
88  return false;
89  }
90  break;
91  }
92  }
93 
94  return true;
95 }
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13

◆ MemsetPatternSetOrCheck() [2/2]

bool flutter::testing::MemsetPatternSetOrCheck ( std::vector< uint8_t > &  buffer,
MemsetPatternOp  op 
)

Definition at line 97 of file testing.cc.

References MemsetPatternSetOrCheck().

97  {
98  return MemsetPatternSetOrCheck(buffer.data(), buffer.size(), op);
99 }
bool MemsetPatternSetOrCheck(std::vector< uint8_t > &buffer, MemsetPatternOp op)
Definition: testing.cc:97

◆ mockViewController()

id flutter::testing::mockViewController ( NSString *  pasteboardString)

Definition at line 18 of file FlutterViewControllerTest.mm.

References GetFixturesPath().

Referenced by TEST().

18  {
19  NSString* fixtures = @(testing::GetFixturesPath());
20  FlutterDartProject* project = [[FlutterDartProject alloc]
21  initWithAssetsPath:fixtures
22  ICUDataPath:[fixtures stringByAppendingString:@"/icudtl.dat"]];
23  FlutterViewController* viewController = [[FlutterViewController alloc] initWithProject:project];
24 
25  // Mock pasteboard so that this test will work in environments without a
26  // real pasteboard.
27  id pasteboardMock = OCMClassMock([NSPasteboard class]);
28  OCMExpect([pasteboardMock stringForType:[OCMArg any]]).andDo(^(NSInvocation* invocation) {
29  NSString* returnValue = pasteboardString.length > 0 ? pasteboardString : nil;
30  [invocation setReturnValue:&returnValue];
31  });
32  id viewControllerMock = OCMPartialMock(viewController);
33  OCMStub([viewControllerMock pasteboard]).andReturn(pasteboardMock);
34  return viewControllerMock;
35 }
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...

◆ NumberNear()

bool flutter::testing::NumberNear ( double  a,
double  b 
)
inline

Definition at line 13 of file assertions.h.

Referenced by operator==().

13  {
14  static const double epsilon = 1e-3;
15  return (a > (b - epsilon)) && (a < (b + epsilon));
16 }

◆ OpenFixture()

fml::UniqueFD flutter::testing::OpenFixture ( std::string  fixture_name)

Opens a fixture of the given file name.

Parameters
[in]fixture_nameThe fixture name
Returns
The file descriptor of the given fixture. An invalid file descriptor is returned in case the fixture is not found.

Definition at line 30 of file testing.cc.

References FML_LOG, GetFixturesPath(), fml::kRead, fml::OpenFile(), and OpenFixturesDirectory().

Referenced by ImageMatchesFixture(), and OpenFixtureAsMapping().

30  {
31  if (fixture_name.size() == 0) {
32  FML_LOG(ERROR) << "Invalid fixture name.";
33  return {};
34  }
35 
36  auto fixtures_directory = OpenFixturesDirectory();
37 
38  auto fixture_fd = fml::OpenFile(fixtures_directory, // base directory
39  fixture_name.c_str(), // path
40  false, // create
41  fml::FilePermission::kRead // permission
42  );
43  if (!fixture_fd.is_valid()) {
44  FML_LOG(ERROR) << "Could not open fixture for path: " << GetFixturesPath()
45  << "/" << fixture_name << ".";
46  return {};
47  }
48 
49  return fixture_fd;
50 }
#define FML_LOG(severity)
Definition: logging.h:65
fml::UniqueFD OpenFixturesDirectory()
Opens the fixtures directory for the unit-test harness.
Definition: testing.cc:16
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...
fml::UniqueFD OpenFile(const char *path, bool create_if_necessary, FilePermission permission)
This can open a directory on POSIX, but not on Windows.
Definition: file_posix.cc:64

◆ OpenFixtureAsMapping()

std::unique_ptr< fml::Mapping > flutter::testing::OpenFixtureAsMapping ( std::string  fixture_name)

Opens a fixture of the given file name and returns a mapping to its contents.

Parameters
[in]fixture_nameThe fixture name
Returns
A mapping to the contents of fixture or null if the fixture does not exist or its contents cannot be mapped in.

Definition at line 52 of file testing.cc.

References fml::FileMapping::CreateReadOnly(), and OpenFixture().

Referenced by TEST_F().

52  {
53  return fml::FileMapping::CreateReadOnly(OpenFixture(fixture_name));
54 }
fml::UniqueFD OpenFixture(std::string fixture_name)
Opens a fixture of the given file name.
Definition: testing.cc:30
static std::unique_ptr< FileMapping > CreateReadOnly(const std::string &path)
Definition: mapping.cc:18

◆ OpenFixtureAsSkData()

static sk_sp<SkData> flutter::testing::OpenFixtureAsSkData ( const char *  name)
static

Definition at line 95 of file image_decoder_unittests.cc.

References fml::FileMapping::CreateReadOnly(), GetFixturesPath(), fml::kRead, and fml::OpenDirectory().

Referenced by TEST(), and TEST_F().

95  {
96  auto fixtures_directory =
98  if (!fixtures_directory.is_valid()) {
99  return nullptr;
100  }
101 
102  auto fixture_mapping =
103  fml::FileMapping::CreateReadOnly(fixtures_directory, name);
104 
105  if (!fixture_mapping) {
106  return nullptr;
107  }
108 
109  SkData::ReleaseProc on_release = [](const void* ptr, void* context) -> void {
110  delete reinterpret_cast<fml::FileMapping*>(context);
111  };
112 
113  auto data = SkData::MakeWithProc(fixture_mapping->GetMapping(),
114  fixture_mapping->GetSize(), on_release,
115  fixture_mapping.get());
116 
117  if (!data) {
118  return nullptr;
119  }
120  // The data is now owned by Skia.
121  fixture_mapping.release();
122  return data;
123 }
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
Definition: file_posix.cc:94
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...
const char * name
Definition: fuchsia.cc:50
static std::unique_ptr< FileMapping > CreateReadOnly(const std::string &path)
Definition: mapping.cc:18

◆ OpenFixturesDirectory()

fml::UniqueFD flutter::testing::OpenFixturesDirectory ( )

Opens the fixtures directory for the unit-test harness.

Returns
The file descriptor of the fixtures directory.

Definition at line 16 of file testing.cc.

References FML_LOG, GetFixturesPath(), fml::kRead, and fml::OpenDirectory().

Referenced by ImageMatchesFixture(), and OpenFixture().

16  {
17  auto fixtures_directory =
19  false, // create
20  fml::FilePermission::kRead // permission
21  );
22 
23  if (!fixtures_directory.is_valid()) {
24  FML_LOG(ERROR) << "Could not open fixtures directory.";
25  return {};
26  }
27  return fixtures_directory;
28 }
#define FML_LOG(severity)
Definition: logging.h:65
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
Definition: file_posix.cc:94
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...

◆ operator<<() [1/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkClipOp &  o 
)

Definition at line 10 of file assertions_skia.cc.

10  {
11  switch (o) {
12  case SkClipOp::kDifference:
13  os << "ClipOpDifference";
14  break;
15  case SkClipOp::kIntersect:
16  os << "ClipOpIntersect";
17  break;
18 #ifdef SK_SUPPORT_DEPRECATED_CLIPOPS
19  case SkClipOp::kUnion_deprecated:
20  os << "ClipOpUnion_deprecated";
21  break;
22  case SkClipOp::kXOR_deprecated:
23  os << "ClipOpXOR_deprecated";
24  break;
25  case SkClipOp::kReverseDifference_deprecated:
26  os << "ClipOpReverseDifference_deprecated";
27  break;
28  case SkClipOp::kReplace_deprecated:
29  os << "ClipOpReplace_deprectaed";
30  break;
31 #else
32  case SkClipOp::kExtraEnumNeedInternallyPleaseIgnoreWillGoAway2:
33  os << "ClipOpReserved2";
34  break;
35  case SkClipOp::kExtraEnumNeedInternallyPleaseIgnoreWillGoAway3:
36  os << "ClipOpReserved3";
37  break;
38  case SkClipOp::kExtraEnumNeedInternallyPleaseIgnoreWillGoAway4:
39  os << "ClipOpReserved4";
40  break;
41  case SkClipOp::kExtraEnumNeedInternallyPleaseIgnoreWillGoAway5:
42  os << "ClipOpReserved5";
43  break;
44 #endif
45  }
46  return os;
47 }

◆ operator<<() [2/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockTexture::PaintCall data 
)

◆ operator<<() [3/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkMatrix &  m 
)

Definition at line 49 of file assertions_skia.cc.

49  {
50  os << std::endl;
51  os << "Scale X: " << m[SkMatrix::kMScaleX] << ", ";
52  os << "Skew X: " << m[SkMatrix::kMSkewX] << ", ";
53  os << "Trans X: " << m[SkMatrix::kMTransX] << std::endl;
54  os << "Skew Y: " << m[SkMatrix::kMSkewY] << ", ";
55  os << "Scale Y: " << m[SkMatrix::kMScaleY] << ", ";
56  os << "Trans Y: " << m[SkMatrix::kMTransY] << std::endl;
57  os << "Persp X: " << m[SkMatrix::kMPersp0] << ", ";
58  os << "Persp Y: " << m[SkMatrix::kMPersp1] << ", ";
59  os << "Persp Z: " << m[SkMatrix::kMPersp2];
60  os << std::endl;
61  return os;
62 }

◆ operator<<() [4/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkM44 &  m 
)

Definition at line 64 of file assertions_skia.cc.

64  {
65  os << m.rc(0, 0) << ", " << m.rc(0, 1) << ", " << m.rc(0, 2) << ", "
66  << m.rc(0, 3) << std::endl;
67  os << m.rc(1, 0) << ", " << m.rc(1, 1) << ", " << m.rc(1, 2) << ", "
68  << m.rc(1, 3) << std::endl;
69  os << m.rc(2, 0) << ", " << m.rc(2, 1) << ", " << m.rc(2, 2) << ", "
70  << m.rc(2, 3) << std::endl;
71  os << m.rc(3, 0) << ", " << m.rc(3, 1) << ", " << m.rc(3, 2) << ", "
72  << m.rc(3, 3);
73  return os;
74 }

◆ operator<<() [5/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkVector3 &  v 
)

Definition at line 76 of file assertions_skia.cc.

76  {
77  return os << v.x() << ", " << v.y() << ", " << v.z();
78 }

◆ operator<<() [6/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkRect &  r 
)

Definition at line 80 of file assertions_skia.cc.

80  {
81  return os << "LTRB: " << r.fLeft << ", " << r.fTop << ", " << r.fRight << ", "
82  << r.fBottom;
83 }

◆ operator<<() [7/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkRRect &  r 
)

Definition at line 85 of file assertions_skia.cc.

85  {
86  return os << "LTRB: " << r.rect().fLeft << ", " << r.rect().fTop << ", "
87  << r.rect().fRight << ", " << r.rect().fBottom;
88 }

◆ operator<<() [8/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkPath &  r 
)

Definition at line 90 of file assertions_skia.cc.

90  {
91  return os << "Valid: " << r.isValid()
92  << ", FillType: " << static_cast<int>(r.getFillType())
93  << ", Bounds: " << r.getBounds();
94 }

◆ operator<<() [9/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkPoint &  r 
)

Definition at line 96 of file assertions_skia.cc.

96  {
97  return os << "XY: " << r.fX << ", " << r.fY;
98 }

◆ operator<<() [10/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkISize &  size 
)

Definition at line 100 of file assertions_skia.cc.

100  {
101  return os << size.width() << ", " << size.height();
102 }
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13

◆ operator<<() [11/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkColor4f &  r 
)

Definition at line 104 of file assertions_skia.cc.

104  {
105  return os << r.fR << ", " << r.fG << ", " << r.fB << ", " << r.fA;
106 }

◆ operator<<() [12/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const SkPaint &  r 
)

Definition at line 108 of file assertions_skia.cc.

108  {
109  return os << "Color: " << r.getColor4f() << ", Style: " << r.getStyle()
110  << ", AA: " << r.isAntiAlias() << ", Shader: " << r.getShader();
111 }

◆ operator<<() [13/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::SaveData data 
)

Definition at line 298 of file mock_canvas.cc.

References flutter::testing::MockCanvas::SaveData::save_to_layer.

298  {
299  return os << data.save_to_layer;
300 }

◆ operator<<() [14/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::SaveLayerData data 
)

Definition at line 309 of file mock_canvas.cc.

References flutter::testing::MockCanvas::SaveLayerData::backdrop_filter, flutter::testing::MockCanvas::SaveLayerData::restore_paint, flutter::testing::MockCanvas::SaveLayerData::save_bounds, and flutter::testing::MockCanvas::SaveLayerData::save_to_layer.

310  {
311  return os << data.save_bounds << " " << data.restore_paint << " "
312  << data.backdrop_filter << " " << data.save_to_layer;
313 }

◆ operator<<() [15/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::RestoreData data 
)

Definition at line 320 of file mock_canvas.cc.

References flutter::testing::MockCanvas::RestoreData::restore_to_layer.

321  {
322  return os << data.restore_to_layer;
323 }

◆ operator<<() [16/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::ConcatMatrixData data 
)

Definition at line 330 of file mock_canvas.cc.

References flutter::testing::MockCanvas::ConcatMatrixData::matrix.

331  {
332  return os << data.matrix;
333 }

◆ operator<<() [17/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::ConcatMatrix44Data data 
)

Definition at line 340 of file mock_canvas.cc.

References flutter::testing::MockCanvas::ConcatMatrix44Data::matrix.

341  {
342  return os << data.matrix;
343 }

◆ operator<<() [18/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::SetMatrixData data 
)

Definition at line 350 of file mock_canvas.cc.

References flutter::testing::MockCanvas::SetMatrixData::matrix.

351  {
352  return os << data.matrix;
353 }

◆ operator<<() [19/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::DrawRectData data 
)

Definition at line 360 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawRectData::paint, and flutter::testing::MockCanvas::DrawRectData::rect.

361  {
362  return os << data.rect << " " << data.paint;
363 }

◆ operator<<() [20/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::DrawPathData data 
)

Definition at line 370 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawPathData::paint, and flutter::testing::MockCanvas::DrawPathData::path.

371  {
372  return os << data.path << " " << data.paint;
373 }

◆ operator<<() [21/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::DrawTextData data 
)

Definition at line 381 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawTextData::offset, flutter::testing::MockCanvas::DrawTextData::paint, and flutter::testing::MockCanvas::DrawTextData::serialized_text.

382  {
383  return os << data.serialized_text << " " << data.paint << " " << data.offset;
384 }

◆ operator<<() [22/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::DrawPictureData data 
)

Definition at line 392 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawPictureData::matrix, flutter::testing::MockCanvas::DrawPictureData::paint, and flutter::testing::MockCanvas::DrawPictureData::serialized_picture.

393  {
394  return os << data.serialized_picture << " " << data.paint << " "
395  << data.matrix;
396 }

◆ operator<<() [23/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::DrawShadowData data 
)

Definition at line 403 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawShadowData::path.

404  {
405  return os << data.path;
406 }

◆ operator<<() [24/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::ClipRectData data 
)

Definition at line 413 of file mock_canvas.cc.

References flutter::testing::MockCanvas::ClipRectData::clip_op, flutter::testing::MockCanvas::ClipRectData::rect, and flutter::testing::MockCanvas::ClipRectData::style.

414  {
415  return os << data.rect << " " << data.clip_op << " " << data.style;
416 }

◆ operator<<() [25/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::ClipRRectData data 
)

Definition at line 423 of file mock_canvas.cc.

References flutter::testing::MockCanvas::ClipRRectData::clip_op, flutter::testing::MockCanvas::ClipRRectData::rrect, and flutter::testing::MockCanvas::ClipRRectData::style.

424  {
425  return os << data.rrect << " " << data.clip_op << " " << data.style;
426 }

◆ operator<<() [26/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::ClipPathData data 
)

Definition at line 433 of file mock_canvas.cc.

References flutter::testing::MockCanvas::ClipPathData::clip_op, flutter::testing::MockCanvas::ClipPathData::path, and flutter::testing::MockCanvas::ClipPathData::style.

434  {
435  return os << data.path << " " << data.clip_op << " " << data.style;
436 }

◆ operator<<() [27/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::DrawCallData data 
)

Definition at line 438 of file mock_canvas.cc.

439  {
440  std::visit([&os](auto& d) { os << d; }, data);
441  return os;
442 }

◆ operator<<() [28/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::DrawCall draw 
)

Definition at line 448 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawCall::data, and flutter::testing::MockCanvas::DrawCall::layer.

448  {
449  return os << "[Layer: " << draw.layer << ", Data: " << draw.data << "]";
450 }

◆ operator<<() [29/29]

std::ostream & flutter::testing::operator<< ( std::ostream &  os,
const MockCanvas::DrawPaint data 
)

Definition at line 457 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawPaint::paint.

457  {
458  return os << data.paint;
459 }

◆ operator==() [1/17]

bool flutter::testing::operator== ( const MockTexture::PaintCall a,
const MockTexture::PaintCall b 
)

Definition at line 21 of file mock_texture.cc.

References flutter::testing::MockTexture::PaintCall::bounds, flutter::testing::MockTexture::PaintCall::canvas, flutter::testing::MockTexture::PaintCall::context, flutter::testing::MockTexture::PaintCall::filter_quality, and flutter::testing::MockTexture::PaintCall::freeze.

Referenced by flutter::testing::MockCanvas::didRestore(), and flutter::testing::MockTexture::unregistered().

22  {
23  return &a.canvas == &b.canvas && a.bounds == b.bounds &&
24  a.context == b.context && a.freeze == b.freeze &&
25  a.filter_quality == b.filter_quality;
26 }

◆ operator==() [2/17]

bool flutter::testing::operator== ( const MockCanvas::SaveData a,
const MockCanvas::SaveData b 
)

Definition at line 294 of file mock_canvas.cc.

References flutter::testing::MockCanvas::SaveData::save_to_layer.

294  {
295  return a.save_to_layer == b.save_to_layer;
296 }

◆ operator==() [3/17]

bool flutter::testing::operator== ( const MockCanvas::SaveLayerData a,
const MockCanvas::SaveLayerData b 
)

Definition at line 302 of file mock_canvas.cc.

References flutter::testing::MockCanvas::SaveLayerData::backdrop_filter, flutter::testing::MockCanvas::SaveLayerData::restore_paint, flutter::testing::MockCanvas::SaveLayerData::save_bounds, and flutter::testing::MockCanvas::SaveLayerData::save_to_layer.

303  {
304  return a.save_bounds == b.save_bounds && a.restore_paint == b.restore_paint &&
305  a.backdrop_filter == b.backdrop_filter &&
306  a.save_to_layer == b.save_to_layer;
307 }

◆ operator==() [4/17]

bool flutter::testing::operator== ( const MockCanvas::RestoreData a,
const MockCanvas::RestoreData b 
)

Definition at line 315 of file mock_canvas.cc.

References flutter::testing::MockCanvas::RestoreData::restore_to_layer.

316  {
317  return a.restore_to_layer == b.restore_to_layer;
318 }

◆ operator==() [5/17]

bool flutter::testing::operator== ( const MockCanvas::ConcatMatrixData a,
const MockCanvas::ConcatMatrixData b 
)

Definition at line 325 of file mock_canvas.cc.

References flutter::testing::MockCanvas::ConcatMatrixData::matrix.

326  {
327  return a.matrix == b.matrix;
328 }

◆ operator==() [6/17]

bool flutter::testing::operator== ( const MockCanvas::ConcatMatrix44Data a,
const MockCanvas::ConcatMatrix44Data b 
)

Definition at line 335 of file mock_canvas.cc.

References flutter::testing::MockCanvas::ConcatMatrix44Data::matrix.

336  {
337  return a.matrix == b.matrix;
338 }

◆ operator==() [7/17]

bool flutter::testing::operator== ( const MockCanvas::SetMatrixData a,
const MockCanvas::SetMatrixData b 
)

Definition at line 345 of file mock_canvas.cc.

References flutter::testing::MockCanvas::SetMatrixData::matrix.

346  {
347  return a.matrix == b.matrix;
348 }

◆ operator==() [8/17]

bool flutter::testing::operator== ( const MockCanvas::DrawRectData a,
const MockCanvas::DrawRectData b 
)

Definition at line 355 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawRectData::paint, and flutter::testing::MockCanvas::DrawRectData::rect.

356  {
357  return a.rect == b.rect && a.paint == b.paint;
358 }

◆ operator==() [9/17]

bool flutter::testing::operator== ( const MockCanvas::DrawPathData a,
const MockCanvas::DrawPathData b 
)

Definition at line 365 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawPathData::paint, and flutter::testing::MockCanvas::DrawPathData::path.

366  {
367  return a.path == b.path && a.paint == b.paint;
368 }

◆ operator==() [10/17]

bool flutter::testing::operator== ( const MockCanvas::DrawTextData a,
const MockCanvas::DrawTextData b 
)

Definition at line 375 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawTextData::offset, flutter::testing::MockCanvas::DrawTextData::paint, and flutter::testing::MockCanvas::DrawTextData::serialized_text.

376  {
377  return a.serialized_text->equals(b.serialized_text.get()) &&
378  a.paint == b.paint && a.offset == b.offset;
379 }

◆ operator==() [11/17]

bool flutter::testing::operator== ( const MockCanvas::DrawPictureData a,
const MockCanvas::DrawPictureData b 
)

Definition at line 386 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawPictureData::matrix, flutter::testing::MockCanvas::DrawPictureData::paint, and flutter::testing::MockCanvas::DrawPictureData::serialized_picture.

387  {
388  return a.serialized_picture->equals(b.serialized_picture.get()) &&
389  a.paint == b.paint && a.matrix == b.matrix;
390 }

◆ operator==() [12/17]

bool flutter::testing::operator== ( const MockCanvas::DrawShadowData a,
const MockCanvas::DrawShadowData b 
)

Definition at line 398 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawShadowData::path.

399  {
400  return a.path == b.path;
401 }

◆ operator==() [13/17]

bool flutter::testing::operator== ( const MockCanvas::ClipRectData a,
const MockCanvas::ClipRectData b 
)

Definition at line 408 of file mock_canvas.cc.

References flutter::testing::MockCanvas::ClipRectData::clip_op, flutter::testing::MockCanvas::ClipRectData::rect, and flutter::testing::MockCanvas::ClipRectData::style.

409  {
410  return a.rect == b.rect && a.clip_op == b.clip_op && a.style == b.style;
411 }

◆ operator==() [14/17]

bool flutter::testing::operator== ( const MockCanvas::ClipRRectData a,
const MockCanvas::ClipRRectData b 
)

Definition at line 418 of file mock_canvas.cc.

References flutter::testing::MockCanvas::ClipRRectData::clip_op, flutter::testing::MockCanvas::ClipRRectData::rrect, and flutter::testing::MockCanvas::ClipRRectData::style.

419  {
420  return a.rrect == b.rrect && a.clip_op == b.clip_op && a.style == b.style;
421 }

◆ operator==() [15/17]

bool flutter::testing::operator== ( const MockCanvas::ClipPathData a,
const MockCanvas::ClipPathData b 
)

Definition at line 428 of file mock_canvas.cc.

References flutter::testing::MockCanvas::ClipPathData::clip_op, flutter::testing::MockCanvas::ClipPathData::path, and flutter::testing::MockCanvas::ClipPathData::style.

429  {
430  return a.path == b.path && a.clip_op == b.clip_op && a.style == b.style;
431 }

◆ operator==() [16/17]

bool flutter::testing::operator== ( const MockCanvas::DrawCall a,
const MockCanvas::DrawCall b 
)

Definition at line 444 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawCall::data, and flutter::testing::MockCanvas::DrawCall::layer.

444  {
445  return a.layer == b.layer && a.data == b.data;
446 }

◆ operator==() [17/17]

bool flutter::testing::operator== ( const MockCanvas::DrawPaint a,
const MockCanvas::DrawPaint b 
)

Definition at line 452 of file mock_canvas.cc.

References flutter::testing::MockCanvas::DrawPaint::paint.

453  {
454  return a.paint == b.paint;
455 }

◆ PrepareSettingsForAOTWithSymbols()

bool flutter::testing::PrepareSettingsForAOTWithSymbols ( Settings settings,
const ELFAOTSymbols symbols 
)

Prepare the settings objects various AOT mappings resolvers with the symbols already loaded. This method does nothing in non-AOT runtime modes.

Warning
The symbols must not be collected till all shell instantiations made using the settings object are collected.
Parameters

Definition at line 63 of file elf_loader.cc.

References flutter::Settings::isolate_snapshot_data, flutter::Settings::isolate_snapshot_instr, flutter::DartVM::IsRunningPrecompiledCode(), flutter::testing::ELFAOTSymbols::vm_isolate_data, flutter::testing::ELFAOTSymbols::vm_isolate_instrs, flutter::testing::ELFAOTSymbols::vm_snapshot_data, flutter::Settings::vm_snapshot_data, flutter::Settings::vm_snapshot_instr, and flutter::testing::ELFAOTSymbols::vm_snapshot_instrs.

Referenced by flutter::testing::FixtureTest::SetSnapshotsAndAssets(), and flutter::StartupAndShutdownShell().

64  {
65  if (!DartVM::IsRunningPrecompiledCode()) {
66  return false;
67  }
68  settings.vm_snapshot_data = [&]() {
69  return std::make_unique<fml::NonOwnedMapping>(symbols.vm_snapshot_data, 0u);
70  };
71  settings.isolate_snapshot_data = [&]() {
72  return std::make_unique<fml::NonOwnedMapping>(symbols.vm_isolate_data, 0u);
73  };
74  settings.vm_snapshot_instr = [&]() {
75  return std::make_unique<fml::NonOwnedMapping>(symbols.vm_snapshot_instrs,
76  0u);
77  };
78  settings.isolate_snapshot_instr = [&]() {
79  return std::make_unique<fml::NonOwnedMapping>(symbols.vm_isolate_instrs,
80  0u);
81  };
82  return true;
83 }

◆ RasterImagesAreSame()

bool flutter::testing::RasterImagesAreSame ( sk_sp< SkImage >  a,
sk_sp< SkImage >  b 
)

Definition at line 31 of file embedder_unittests_util.cc.

References FML_CHECK, and FML_LOG.

Referenced by ImageMatchesFixture().

31  {
32  FML_CHECK(!a->isTextureBacked());
33  FML_CHECK(!b->isTextureBacked());
34 
35  if (!a || !b) {
36  return false;
37  }
38 
39  SkPixmap pixmapA;
40  SkPixmap pixmapB;
41 
42  if (!a->peekPixels(&pixmapA)) {
43  FML_LOG(ERROR) << "Could not peek pixels of image A.";
44  return false;
45  }
46 
47  if (!b->peekPixels(&pixmapB)) {
48  FML_LOG(ERROR) << "Could not peek pixels of image B.";
49 
50  return false;
51  }
52 
53  const auto sizeA = pixmapA.rowBytes() * pixmapA.height();
54  const auto sizeB = pixmapB.rowBytes() * pixmapB.height();
55 
56  if (sizeA != sizeB) {
57  FML_LOG(ERROR) << "Pixmap sizes were inconsistent.";
58  return false;
59  }
60 
61  return ::memcmp(pixmapA.addr(), pixmapB.addr(), sizeA) == 0;
62 }
#define FML_LOG(severity)
Definition: logging.h:65
#define FML_CHECK(condition)
Definition: logging.h:68

◆ RasterizerHasLayerTree()

static bool flutter::testing::RasterizerHasLayerTree ( Shell shell)
static

Definition at line 69 of file shell_unittests.cc.

References flutter::Shell::GetRasterizer(), flutter::TaskRunners::GetRasterTaskRunner(), flutter::Shell::GetTaskRunners(), and fml::TaskRunner::RunNowOrPostTask().

Referenced by ValidateDestroyPlatformView().

69  {
71  bool has_layer_tree = false;
73  shell->GetTaskRunners().GetRasterTaskRunner(),
74  [shell, &latch, &has_layer_tree]() {
75  has_layer_tree = shell->GetRasterizer()->GetLastLayerTree() != nullptr;
76  latch.Signal();
77  });
78  latch.Wait();
79  return has_layer_tree;
80 }
static void RunNowOrPostTask(fml::RefPtr< fml::TaskRunner > runner, const fml::closure &task)
Definition: task_runner.cc:55

◆ ReadbackResult() [1/4]

static bool flutter::testing::ReadbackResult ( PrerollContext context,
Clip  clip_behavior,
std::shared_ptr< Layer child,
bool  before 
)
static

Definition at line 193 of file clip_rect_layer_unittests.cc.

References flutter::antiAlias, flutter::antiAliasWithSaveLayer, flutter::hardEdge, flutter::path, ReadbackResult(), flutter::PrerollContext::surface_needs_readback, and TEST_F().

196  {
197  const SkMatrix initial_matrix = SkMatrix();
198  const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
199  auto layer = std::make_shared<ClipRectLayer>(layer_bounds, clip_behavior);
200  if (child != nullptr) {
201  layer->Add(child);
202  }
203  context->surface_needs_readback = before;
204  layer->Preroll(context, initial_matrix);
205  return context->surface_needs_readback;
206 }

◆ ReadbackResult() [2/4]

static bool flutter::testing::ReadbackResult ( PrerollContext context,
Clip  clip_behavior,
std::shared_ptr< Layer child,
bool  before 
)
static

Definition at line 195 of file clip_path_layer_unittests.cc.

References flutter::antiAlias, flutter::antiAliasWithSaveLayer, flutter::hardEdge, flutter::path, flutter::PrerollContext::surface_needs_readback, and TEST_F().

Referenced by ReadbackResult().

198  {
199  const SkMatrix initial_matrix = SkMatrix();
200  const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
201  const SkPath layer_path = SkPath().addRect(layer_bounds);
202  auto layer = std::make_shared<ClipPathLayer>(layer_path, clip_behavior);
203  if (child != nullptr) {
204  layer->Add(child);
205  }
206  context->surface_needs_readback = before;
207  layer->Preroll(context, initial_matrix);
208  return context->surface_needs_readback;
209 }

◆ ReadbackResult() [3/4]

static bool flutter::testing::ReadbackResult ( PrerollContext context,
Clip  clip_behavior,
std::shared_ptr< Layer child,
bool  before 
)
static

Definition at line 198 of file clip_rrect_layer_unittests.cc.

References flutter::antiAlias, flutter::antiAliasWithSaveLayer, flutter::hardEdge, flutter::path, ReadbackResult(), flutter::PrerollContext::surface_needs_readback, and TEST_F().

201  {
202  const SkMatrix initial_matrix = SkMatrix();
203  const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
204  const SkRRect layer_rrect = SkRRect::MakeRect(layer_bounds);
205  auto layer = std::make_shared<ClipRRectLayer>(layer_rrect, clip_behavior);
206  if (child != nullptr) {
207  layer->Add(child);
208  }
209  context->surface_needs_readback = before;
210  layer->Preroll(context, initial_matrix);
211  return context->surface_needs_readback;
212 }

◆ ReadbackResult() [4/4]

static bool flutter::testing::ReadbackResult ( PrerollContext context,
Clip  clip_behavior,
std::shared_ptr< Layer child,
bool  before 
)
static

Definition at line 216 of file physical_shape_layer_unittests.cc.

References flutter::antiAlias, flutter::antiAliasWithSaveLayer, flutter::hardEdge, flutter::path, ReadbackResult(), flutter::PrerollContext::surface_needs_readback, and TEST_F().

219  {
220  const SkMatrix initial_matrix = SkMatrix();
221  const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
222  const SkPath layer_path = SkPath().addRect(layer_bounds);
223  auto layer =
224  std::make_shared<PhysicalShapeLayer>(SK_ColorGREEN, SK_ColorBLACK,
225  0.0f, // elevation
226  layer_path, clip_behavior);
227  if (child != nullptr) {
228  layer->Add(child);
229  }
230  context->surface_needs_readback = before;
231  layer->Preroll(context, initial_matrix);
232  return context->surface_needs_readback;
233 }

◆ ResetAssetManager()

static void flutter::testing::ResetAssetManager ( )
static

Definition at line 141 of file persistent_cache_unittests.cc.

References flutter::PersistentCache::GetCacheForProcess(), flutter::PersistentCache::SetAssetManager(), and fml::size().

Referenced by TEST_F().

141  {
142  PersistentCache::SetAssetManager(nullptr);
143  ASSERT_EQ(PersistentCache::GetCacheForProcess()->LoadSkSLs().size(), 0u);
144 }
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13

◆ RunCoroutineWithRetry()

static void flutter::testing::RunCoroutineWithRetry ( int  retries,
fml::AutoResetWaitableEvent tick,
fml::AutoResetWaitableEvent tock,
std::function< bool()>  f 
)
static

Definition at line 131 of file shell_fuchsia_unittests.cc.

References FML_LOG, fml::AutoResetWaitableEvent::Signal(), and fml::AutoResetWaitableEvent::Wait().

Referenced by TEST_F().

134  {
135  for (; retries > 0; retries--) {
136  // Do a single coroutine step.
137  tick->Signal();
138  tock->Wait();
139  if (f()) {
140  break;
141  }
142  FML_LOG(INFO) << "Retries left: " << retries;
143  sleep(1);
144  }
145 }
#define FML_LOG(severity)
Definition: logging.h:65

◆ RunDartCodeInIsolate() [1/2]

void flutter::testing::RunDartCodeInIsolate ( DartVMRef vm_ref,
std::unique_ptr< AutoIsolateShutdown > &  result,
const Settings settings,
const TaskRunners task_runners,
std::string  entrypoint,
const std::vector< std::string > &  args,
const std::string &  fixtures_path,
fml::WeakPtr< IOManager io_manager = {} 
)

◆ RunDartCodeInIsolate() [2/2]

std::unique_ptr< AutoIsolateShutdown > flutter::testing::RunDartCodeInIsolate ( DartVMRef vm_ref,
const Settings settings,
const TaskRunners task_runners,
std::string  entrypoint,
const std::vector< std::string > &  args,
const std::string &  fixtures_path,
fml::WeakPtr< IOManager io_manager 
)

Definition at line 142 of file dart_isolate_runner.cc.

References flutter::TaskRunners::GetUITaskRunner(), fml::MakeCopyable(), RunDartCodeInIsolateOnUITaskRunner(), fml::TaskRunner::RunNowOrPostTask(), fml::AutoResetWaitableEvent::Signal(), and fml::AutoResetWaitableEvent::Wait().

Referenced by flutter::BM_PlatformMessageResponseDartComplete(), flutter::testing::AutoIsolateShutdown::get(), flutter::testing::TypeConversionsTest::RunWithEntrypoint(), and TEST_F().

149  {
150  std::unique_ptr<AutoIsolateShutdown> result;
153  task_runners.GetUITaskRunner(), fml::MakeCopyable([&]() mutable {
155  vm_ref, settings, task_runners, entrypoint, args, fixtures_path,
156  io_manager);
157  latch.Signal();
158  }));
159  latch.Wait();
160  return result;
161 }
G_BEGIN_DECLS FlValue * args
static void RunNowOrPostTask(fml::RefPtr< fml::TaskRunner > runner, const fml::closure &task)
Definition: task_runner.cc:55
internal::CopyableLambda< T > MakeCopyable(T lambda)
Definition: make_copyable.h:57
std::unique_ptr< AutoIsolateShutdown > RunDartCodeInIsolateOnUITaskRunner(DartVMRef &vm_ref, const Settings &p_settings, const TaskRunners &task_runners, std::string entrypoint, const std::vector< std::string > &args, const std::string &fixtures_path, fml::WeakPtr< IOManager > io_manager)

◆ RunDartCodeInIsolateOnUITaskRunner()

std::unique_ptr<AutoIsolateShutdown> flutter::testing::RunDartCodeInIsolateOnUITaskRunner ( DartVMRef vm_ref,
const Settings p_settings,
const TaskRunners task_runners,
std::string  entrypoint,
const std::vector< std::string > &  args,
const std::string &  fixtures_path,
fml::WeakPtr< IOManager io_manager 
)

Definition at line 52 of file dart_isolate_runner.cc.

References args, flutter::DartIsolate::CreateRunningRootIsolate(), flutter::Settings::dart_entrypoint_args, FML_CHECK, FML_LOG, flutter::TaskRunners::GetUITaskRunner(), flutter::DartVMRef::GetVMData(), flutter::IsolateConfiguration::InferFromSettings(), fml::IsFile(), flutter::DartVM::IsRunningPrecompiledCode(), fml::paths::JoinPaths(), fml::kRead, fml::MakeCopyable(), fml::OpenFile(), and fml::TaskRunner::RunsTasksOnCurrentThread().

Referenced by RunDartCodeInIsolate().

59  {
60  FML_CHECK(task_runners.GetUITaskRunner()->RunsTasksOnCurrentThread());
61 
62  if (!vm_ref) {
63  return nullptr;
64  }
65 
66  auto vm_data = vm_ref.GetVMData();
67 
68  if (!vm_data) {
69  return nullptr;
70  }
71 
72  auto settings = p_settings;
73 
74  settings.dart_entrypoint_args = args;
75 
76  if (!DartVM::IsRunningPrecompiledCode()) {
77  auto kernel_file_path =
78  fml::paths::JoinPaths({fixtures_path, "kernel_blob.bin"});
79 
80  if (!fml::IsFile(kernel_file_path)) {
81  FML_LOG(ERROR) << "Could not locate kernel file.";
82  return nullptr;
83  }
84 
85  auto kernel_file = fml::OpenFile(kernel_file_path.c_str(), false,
87 
88  if (!kernel_file.is_valid()) {
89  FML_LOG(ERROR) << "Kernel file descriptor was invalid.";
90  return nullptr;
91  }
92 
93  auto kernel_mapping = std::make_unique<fml::FileMapping>(kernel_file);
94 
95  if (kernel_mapping->GetMapping() == nullptr) {
96  FML_LOG(ERROR) << "Could not setup kernel mapping.";
97  return nullptr;
98  }
99 
100  settings.application_kernels = fml::MakeCopyable(
101  [kernel_mapping = std::move(kernel_mapping)]() mutable -> Mappings {
102  Mappings mappings;
103  mappings.emplace_back(std::move(kernel_mapping));
104  return mappings;
105  });
106  }
107 
108  auto isolate_configuration =
109  IsolateConfiguration::InferFromSettings(settings);
110 
111  auto isolate =
112  DartIsolate::CreateRunningRootIsolate(
113  settings, // settings
114  vm_data->GetIsolateSnapshot(), // isolate snapshot
115  std::move(task_runners), // task runners
116  nullptr, // window
117  {}, // snapshot delegate
118  {}, // hint freed delegate
119  io_manager, // io manager
120  {}, // unref queue
121  {}, // image decoder
122  "main.dart", // advisory uri
123  entrypoint.c_str(), // advisory entrypoint
124  DartIsolate::Flags{}, // flags
125  settings.isolate_create_callback, // isolate create callback
126  settings.isolate_shutdown_callback, // isolate shutdown callback
127  entrypoint, // entrypoint
128  std::nullopt, // library
129  std::move(isolate_configuration) // isolate configuration
130  )
131  .lock();
132 
133  if (!isolate) {
134  FML_LOG(ERROR) << "Could not create running isolate.";
135  return nullptr;
136  }
137 
138  return std::make_unique<AutoIsolateShutdown>(isolate,
139  task_runners.GetUITaskRunner());
140 }
G_BEGIN_DECLS FlValue * args
#define FML_LOG(severity)
Definition: logging.h:65
std::vector< std::unique_ptr< const fml::Mapping > > Mappings
Definition: settings.h:57
internal::CopyableLambda< T > MakeCopyable(T lambda)
Definition: make_copyable.h:57
std::string JoinPaths(std::initializer_list< std::string > components)
Definition: paths.cc:14
#define FML_CHECK(condition)
Definition: logging.h:68
bool IsFile(const std::string &path)
Definition: file_posix.cc:143
fml::UniqueFD OpenFile(const char *path, bool create_if_necessary, FilePermission permission)
This can open a directory on POSIX, but not on Windows.
Definition: file_posix.cc:64

◆ TEST() [1/130]

flutter::testing::TEST ( MutatorsStack  ,
Initialization   
)

Definition at line 11 of file mutators_stack_unittests.cc.

11  {
12  MutatorsStack stack;
13  ASSERT_TRUE(true);
14 }

◆ TEST() [2/130]

flutter::testing::TEST ( FlutterProjectBundle  ,
BasicPropertiesAbsolutePaths   
)

Definition at line 11 of file flutter_project_bundle_unittests.cc.

References flutter::FlutterProjectBundle::assets_path(), FlutterDesktopEngineProperties::assets_path, flutter::FlutterProjectBundle::HasValidPaths(), FlutterDesktopEngineProperties::icu_data_path, and flutter::FlutterProjectBundle::icu_path().

11  {
12  FlutterDesktopEngineProperties properties = {};
13  properties.assets_path = L"C:\\foo\\flutter_assets";
14  properties.icu_data_path = L"C:\\foo\\icudtl.dat";
15 
16  FlutterProjectBundle project(properties);
17 
18  EXPECT_TRUE(project.HasValidPaths());
19  EXPECT_EQ(project.assets_path().string(), "C:\\foo\\flutter_assets");
20  EXPECT_EQ(project.icu_path().string(), "C:\\foo\\icudtl.dat");
21 }

◆ TEST() [3/130]

flutter::testing::TEST ( Win32FlutterWindowTest  ,
CreateDestroy   
)

Definition at line 11 of file win32_flutter_window_unittests.cc.

References TRUE.

11  {
12  Win32FlutterWindowTest window(800, 600);
13  ASSERT_TRUE(TRUE);
14 }
return TRUE
Definition: fl_view.cc:107

◆ TEST() [4/130]

flutter::testing::TEST ( MockWin32Window  ,
CreateDestroy   
)

Definition at line 11 of file win32_window_unittests.cc.

References TRUE.

11  {
12  MockWin32Window window;
13  ASSERT_TRUE(TRUE);
14 }
return TRUE
Definition: fl_view.cc:107

◆ TEST() [5/130]

flutter::testing::TEST ( TestMetalSurface  ,
EmptySurfaceIsInvalid   
)

Definition at line 11 of file test_metal_surface_unittests.cc.

References flutter::TestMetalSurface::Create(), and flutter::TestMetalSurface::PlatformSupportsMetal().

11  {
12  if (!TestMetalSurface::PlatformSupportsMetal()) {
13  GTEST_SKIP();
14  }
15 
16  auto surface = TestMetalSurface::Create();
17  ASSERT_NE(surface, nullptr);
18  ASSERT_FALSE(surface->IsValid());
19 }

◆ TEST() [6/130]

flutter::testing::TEST ( FlutterEngineTest  ,
FlutterEngineCanLaunch   
)

Definition at line 12 of file FlutterEngineUnittests.mm.

References engine, and GetFixturesPath().

12  {
13  NSString* fixtures = @(testing::GetFixturesPath());
14  FlutterDartProject* project = [[FlutterDartProject alloc]
15  initWithAssetsPath:fixtures
16  ICUDataPath:[fixtures stringByAppendingString:@"/icudtl.dat"]];
17  FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"test"
18  project:project
19  allowHeadlessExecution:true];
20  ASSERT_TRUE([engine runWithEntrypoint:@"main"]);
21  ASSERT_TRUE(engine.running);
22  [engine shutDownEngine];
23 }
const char * GetFixturesPath()
Returns the directory containing the test fixture for the target if this target has fixtures configur...

◆ TEST() [7/130]

flutter::testing::TEST ( StringConversion  ,
Utf16FromUtf8Empty   
)

Definition at line 12 of file string_conversion_unittests.cc.

References flutter::Utf16FromUtf8().

12  {
13  EXPECT_EQ(Utf16FromUtf8(""), L"");
14 }
std::wstring Utf16FromUtf8(const std::string &utf8_string)

◆ TEST() [8/130]

flutter::testing::TEST ( MockTextureTest  ,
Callbacks   
)

Definition at line 12 of file mock_texture_unittests.cc.

12  {
13  auto texture = std::make_shared<MockTexture>(0);
14 
15  ASSERT_FALSE(texture->gr_context_created());
16  texture->OnGrContextCreated();
17  ASSERT_TRUE(texture->gr_context_created());
18 
19  ASSERT_FALSE(texture->gr_context_destroyed());
20  texture->OnGrContextDestroyed();
21  ASSERT_TRUE(texture->gr_context_destroyed());
22 
23  ASSERT_FALSE(texture->unregistered());
24  texture->OnTextureUnregistered();
25  ASSERT_TRUE(texture->unregistered());
26 }

◆ TEST() [9/130]

flutter::testing::TEST ( EmbeddedViewParams  ,
GetBoundingRectAfterMutationsWithNoMutations   
)

Definition at line 12 of file embedded_view_params_unittests.cc.

References flutter::EmbeddedViewParams::finalBoundingRect().

12  {
13  MutatorsStack stack;
14  SkMatrix matrix;
15 
16  EmbeddedViewParams params(matrix, SkSize::Make(1, 1), stack);
17  const SkRect& rect = params.finalBoundingRect();
18  ASSERT_TRUE(SkScalarNearlyEqual(rect.x(), 0));
19  ASSERT_TRUE(SkScalarNearlyEqual(rect.y(), 0));
20  ASSERT_TRUE(SkScalarNearlyEqual(rect.width(), 1));
21  ASSERT_TRUE(SkScalarNearlyEqual(rect.height(), 1));
22 }

◆ TEST() [10/130]

flutter::testing::TEST ( JNIMock  ,
FlutterViewHandlePlatformMessage   
)

Definition at line 13 of file jni_mock_unittest.cc.

References flutter::PlatformViewAndroidJNI::FlutterViewHandlePlatformMessage().

13  {
14  JNIMock mock;
15 
16  auto message =
17  fml::MakeRefCounted<PlatformMessage>("<channel-name>", nullptr);
18  auto response_id = 1;
19 
20  EXPECT_CALL(mock, FlutterViewHandlePlatformMessage(message, response_id));
21 
22  mock.FlutterViewHandlePlatformMessage(message, response_id);
23 }

◆ TEST() [11/130]

flutter::testing::TEST ( SystemUtils  ,
GetPreferredLanguageInfo   
)

Definition at line 13 of file system_utils_unittests.cc.

References flutter::GetPreferredLanguageInfo().

13  {
14  std::vector<LanguageInfo> languages = GetPreferredLanguageInfo();
15  // There should be at least one language.
16  ASSERT_GE(languages.size(), 1);
17  // The info should have a valid languge.
18  EXPECT_GE(languages[0].language.size(), 2);
19 }
std::vector< LanguageInfo > GetPreferredLanguageInfo()

◆ TEST() [12/130]

flutter::testing::TEST ( DpiUtilsTest  ,
NonZero   
)

Definition at line 13 of file win32_dpi_utils_unittests.cc.

References flutter::GetDpiForHWND(), and flutter::GetDpiForMonitor().

13  {
14  ASSERT_GT(GetDpiForHWND(nullptr), 0);
15  ASSERT_GT(GetDpiForMonitor(nullptr), 0);
16 };
UINT GetDpiForMonitor(HMONITOR monitor)
UINT GetDpiForHWND(HWND hwnd)

◆ TEST() [13/130]

flutter::testing::TEST ( TextureRegistryTest  ,
UnregisterTextureCallbackTriggered   
)

Definition at line 13 of file texture_unittests.cc.

References flutter::TextureRegistry::GetTexture(), flutter::TextureRegistry::RegisterTexture(), and flutter::TextureRegistry::UnregisterTexture().

13  {
14  TextureRegistry registry;
15  auto mock_texture1 = std::make_shared<MockTexture>(0);
16  auto mock_texture2 = std::make_shared<MockTexture>(1);
17 
18  registry.RegisterTexture(mock_texture1);
19  registry.RegisterTexture(mock_texture2);
20  ASSERT_EQ(registry.GetTexture(0), mock_texture1);
21  ASSERT_EQ(registry.GetTexture(1), mock_texture2);
22  ASSERT_FALSE(mock_texture1->unregistered());
23  ASSERT_FALSE(mock_texture2->unregistered());
24 
25  registry.UnregisterTexture(0);
26  ASSERT_EQ(registry.GetTexture(0), nullptr);
27  ASSERT_TRUE(mock_texture1->unregistered());
28  ASSERT_FALSE(mock_texture2->unregistered());
29 
30  registry.UnregisterTexture(1);
31  ASSERT_EQ(registry.GetTexture(1), nullptr);
32  ASSERT_TRUE(mock_texture1->unregistered());
33  ASSERT_TRUE(mock_texture2->unregistered());
34 }

◆ TEST() [14/130]

flutter::testing::TEST ( PlatformViewShell  ,
UpdateSemanticsDoesFlutterViewUpdateSemantics   
)

Definition at line 14 of file platform_view_android_delegate_unittests.cc.

References flutter::SemanticsNode::actions, flutter::SemanticsNode::currentValueLength, flutter::SemanticsNode::flags, flutter::SemanticsNode::id, flutter::SemanticsNode::label, flutter::SemanticsNode::maxValueLength, flutter::SemanticsNode::platformViewId, flutter::SemanticsNode::rect, flutter::SemanticsNode::scrollChildren, flutter::SemanticsNode::scrollExtentMax, flutter::SemanticsNode::scrollExtentMin, flutter::SemanticsNode::scrollIndex, flutter::SemanticsNode::scrollPosition, flutter::SemanticsNode::textDirection, flutter::SemanticsNode::textSelectionBase, flutter::SemanticsNode::textSelectionExtent, and flutter::SemanticsNode::transform.

14  {
15  auto jni_mock = std::make_shared<JNIMock>();
16  auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
17 
20  node0.id = 0;
21  node0.label = "label";
22  update.insert(std::make_pair(0, std::move(node0)));
23 
24  std::vector<uint8_t> expected_buffer(164);
25  size_t position = 0;
26  int32_t* buffer_int32 = reinterpret_cast<int32_t*>(&expected_buffer[0]);
27  float* buffer_float32 = reinterpret_cast<float*>(&expected_buffer[0]);
28  std::vector<std::string> expected_strings;
29  buffer_int32[position++] = node0.id;
30  buffer_int32[position++] = node0.flags;
31  buffer_int32[position++] = node0.actions;
32  buffer_int32[position++] = node0.maxValueLength;
33  buffer_int32[position++] = node0.currentValueLength;
34  buffer_int32[position++] = node0.textSelectionBase;
35  buffer_int32[position++] = node0.textSelectionExtent;
36  buffer_int32[position++] = node0.platformViewId;
37  buffer_int32[position++] = node0.scrollChildren;
38  buffer_int32[position++] = node0.scrollIndex;
39  buffer_float32[position++] = static_cast<float>(node0.scrollPosition);
40  buffer_float32[position++] = static_cast<float>(node0.scrollExtentMax);
41  buffer_float32[position++] = static_cast<float>(node0.scrollExtentMin);
42  buffer_int32[position++] = expected_strings.size(); // node0.label
43  expected_strings.push_back(node0.label);
44  buffer_int32[position++] = -1; // node0.value
45  buffer_int32[position++] = -1; // node0.increasedValue
46  buffer_int32[position++] = -1; // node0.decreasedValue
47  buffer_int32[position++] = -1; // node0.hint
48  buffer_int32[position++] = node0.textDirection;
49  buffer_float32[position++] = node0.rect.left();
50  buffer_float32[position++] = node0.rect.top();
51  buffer_float32[position++] = node0.rect.right();
52  buffer_float32[position++] = node0.rect.bottom();
53  node0.transform.getColMajor(&buffer_float32[position]);
54  position += 16;
55  buffer_int32[position++] = 0; // node0.childrenInTraversalOrder.size();
56  buffer_int32[position++] = 0; // node0.customAccessibilityActions.size();
57 
58  EXPECT_CALL(*jni_mock,
59  FlutterViewUpdateSemantics(expected_buffer, expected_strings));
60  // Creates empty custom actions.
62  delegate->UpdateSemantics(update, actions);
63 }
std::unordered_map< int32_t, SemanticsNode > SemanticsNodeUpdates
std::unordered_map< int32_t, CustomAccessibilityAction > CustomAccessibilityActionUpdates

◆ TEST() [15/130]

flutter::testing::TEST ( MatrixDecomposition  ,
Rotation   
)

Definition at line 14 of file matrix_decomposition_unittests.cc.

References flutter::MatrixDecomposition::IsValid(), and flutter::MatrixDecomposition::rotation().

14  {
15  SkM44 matrix;
16 
17  const auto angle = M_PI_4;
18  matrix.setRotate({0.0, 0.0, 1.0}, angle);
19 
20  flutter::MatrixDecomposition decomposition(matrix);
21  ASSERT_TRUE(decomposition.IsValid());
22 
23  const auto sine = sin(angle * 0.5);
24 
25  ASSERT_FLOAT_EQ(0, decomposition.rotation().x);
26  ASSERT_FLOAT_EQ(0, decomposition.rotation().y);
27  ASSERT_FLOAT_EQ(sine, decomposition.rotation().z);
28  ASSERT_FLOAT_EQ(cos(angle * 0.5), decomposition.rotation().w);
29 }

◆ TEST() [16/130]

flutter::testing::TEST ( CanvasSpyTest  ,
DrawingIsTracked   
)

Definition at line 14 of file canvas_spy_unittests.cc.

References flutter::CanvasSpy::DidDrawIntoCanvas(), and flutter::CanvasSpy::GetSpyingCanvas().

14  {
15  SkPictureRecorder picture_recorder;
16  SkCanvas* canvas = picture_recorder.beginRecording(100, 100);
17  CanvasSpy canvas_spy = CanvasSpy(canvas);
18  SkCanvas* spy = canvas_spy.GetSpyingCanvas();
19 
20  ASSERT_FALSE(canvas_spy.DidDrawIntoCanvas());
21 
22  spy->translate(128, 128);
23  spy->clear(SK_ColorTRANSPARENT);
24  ASSERT_FALSE(canvas_spy.DidDrawIntoCanvas());
25 
26  SkPaint paint;
27  spy->drawCircle(0, 0, 60, paint);
28  ASSERT_TRUE(canvas_spy.DidDrawIntoCanvas());
29 }

◆ TEST() [17/130]

flutter::testing::TEST ( RTree  ,
searchNonOverlappingDrawnRectsNoIntersection   
)

Definition at line 14 of file rtree_unittests.cc.

14  {
15  auto rtree_factory = RTreeFactory();
16  auto recorder = std::make_unique<SkPictureRecorder>();
17  auto recording_canvas =
18  recorder->beginRecording(SkRect::MakeIWH(1000, 1000), &rtree_factory);
19 
20  auto rect_paint = SkPaint();
21  rect_paint.setColor(SkColors::kCyan);
22  rect_paint.setStyle(SkPaint::Style::kFill_Style);
23 
24  // If no rect is intersected with the query rect, then the result list is
25  // empty.
26  recording_canvas->drawRect(SkRect::MakeLTRB(20, 20, 40, 40), rect_paint);
27  recorder->finishRecordingAsPicture();
28 
29  auto hits = rtree_factory.getInstance()->searchNonOverlappingDrawnRects(
30  SkRect::MakeLTRB(40, 40, 80, 80));
31  ASSERT_TRUE(hits.empty());
32 }

◆ TEST() [18/130]

flutter::testing::TEST ( MutatorsStack  ,
CopyConstructor   
)

Definition at line 16 of file mutators_stack_unittests.cc.

References flutter::MutatorsStack::PushClipRect(), and flutter::MutatorsStack::PushClipRRect().

16  {
17  MutatorsStack stack;
18  auto rrect = SkRRect::MakeEmpty();
19  auto rect = SkRect::MakeEmpty();
20  stack.PushClipRect(rect);
21  stack.PushClipRRect(rrect);
22  MutatorsStack copy = MutatorsStack(stack);
23  ASSERT_TRUE(copy == stack);
24 }

◆ TEST() [19/130]

flutter::testing::TEST ( StringConversion  ,
Utf16FromUtf8Ascii   
)

Definition at line 16 of file string_conversion_unittests.cc.

References flutter::Utf16FromUtf8().

16  {
17  EXPECT_EQ(Utf16FromUtf8("abc123"), L"abc123");
18 }
std::wstring Utf16FromUtf8(const std::string &utf8_string)

◆ TEST() [20/130]

flutter::testing::TEST ( MockWin32Window  ,
GetDpiAfterCreate   
)

Definition at line 16 of file win32_window_unittests.cc.

References flutter::testing::MockWin32Window::GetDpi().

16  {
17  MockWin32Window window;
18  ASSERT_TRUE(window.GetDpi() > 0);
19 }

◆ TEST() [21/130]

flutter::testing::TEST ( GLContextSwitchTest  ,
SwitchKeepsContextCurrentWhileInScope   
)

Definition at line 18 of file gl_context_switch_unittests.cc.

References flutter::testing::TestSwitchableGLContext::GetCurrentContext().

18  {
19  {
20  auto test_gl_context = std::make_unique<TestSwitchableGLContext>(0);
21  auto context_switch = GLContextSwitch(std::move(test_gl_context));
22  ASSERT_EQ(TestSwitchableGLContext::GetCurrentContext(), 0);
23  }
24  ASSERT_EQ(TestSwitchableGLContext::GetCurrentContext(), -1);
25 }

◆ TEST() [22/130]

flutter::testing::TEST ( DpiUtilsTest  ,
NullHwndUsesPrimaryMonitor   
)

Definition at line 18 of file win32_dpi_utils_unittests.cc.

References flutter::GetDpiForHWND(), and flutter::GetDpiForMonitor().

18  {
19  const POINT target_point = {0, 0};
20  HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTOPRIMARY);
21  ASSERT_EQ(GetDpiForHWND(nullptr), GetDpiForMonitor(monitor));
22 };
UINT GetDpiForMonitor(HMONITOR monitor)
UINT GetDpiForHWND(HWND hwnd)

◆ TEST() [23/130]

flutter::testing::TEST ( StringConversion  ,
Utf16FromUtf8Unicode   
)

Definition at line 20 of file string_conversion_unittests.cc.

References flutter::Utf16FromUtf8().

20  {
21  EXPECT_EQ(Utf16FromUtf8("\xe2\x98\x83"), L"\x2603");
22 }
std::wstring Utf16FromUtf8(const std::string &utf8_string)

◆ TEST() [24/130]

flutter::testing::TEST ( PipelineTest  ,
ConsumeOneVal   
)

Definition at line 21 of file pipeline_unittests.cc.

References flutter::Pipeline< R >::ProducerContinuation::Complete(), flutter::Pipeline< R >::Consume(), flutter::Done, and flutter::Pipeline< R >::Produce().

21  {
22  fml::RefPtr<IntPipeline> pipeline = fml::MakeRefCounted<IntPipeline>(2);
23 
24  Continuation continuation = pipeline->Produce();
25 
26  const int test_val = 1;
27  bool result = continuation.Complete(std::make_unique<int>(test_val));
28  ASSERT_EQ(result, true);
29 
30  PipelineConsumeResult consume_result = pipeline->Consume(
31  [&test_val](std::unique_ptr<int> v) { ASSERT_EQ(*v, test_val); });
32 
33  ASSERT_EQ(consume_result, PipelineConsumeResult::Done);
34 }
PipelineConsumeResult
Definition: pipeline.h:19
IntPipeline::ProducerContinuation Continuation

◆ TEST() [25/130]

flutter::testing::TEST ( SystemUtils  ,
GetPreferredLanguages   
)

Definition at line 21 of file system_utils_unittests.cc.

References flutter::GetPreferredLanguages(), and fml::size().

21  {
22  std::vector<std::wstring> languages = GetPreferredLanguages();
23  // There should be at least one language.
24  ASSERT_GE(languages.size(), 1);
25  // The language should be non-empty.
26  EXPECT_FALSE(languages[0].empty());
27  // There should not be a trailing null from the parsing step.
28  EXPECT_EQ(languages[0].size(), wcslen(languages[0].c_str()));
29 }
std::vector< std::wstring > GetPreferredLanguages()
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13

◆ TEST() [26/130]

flutter::testing::TEST ( MockWin32Window  ,
VerticalScroll   
)

Definition at line 21 of file win32_window_unittests.cc.

References flutter::testing::MockWin32Window::InjectWindowMessage().

21  {
22  MockWin32Window window;
23  const int scroll_amount = 10;
24  // Vertical scroll should be passed along, adjusted for scroll tick size
25  // and direction.
26  EXPECT_CALL(window, OnScroll(0, -scroll_amount / 120.0)).Times(1);
27 
28  window.InjectWindowMessage(WM_MOUSEWHEEL, MAKEWPARAM(0, scroll_amount), 0);
29 }

◆ TEST() [27/130]

flutter::testing::TEST ( TestMetalSurface  ,
CanCreateValidTestMetalSurface   
)

Definition at line 21 of file test_metal_surface_unittests.cc.

References flutter::TestMetalSurface::Create(), and flutter::TestMetalSurface::PlatformSupportsMetal().

21  {
22  if (!TestMetalSurface::PlatformSupportsMetal()) {
23  GTEST_SKIP();
24  }
25 
26  auto surface = TestMetalSurface::Create(SkISize::Make(100, 100));
27  ASSERT_NE(surface, nullptr);
28  ASSERT_TRUE(surface->IsValid());
29  ASSERT_NE(surface->GetSurface(), nullptr);
30  ASSERT_NE(surface->GetGrContext(), nullptr);
31 }

◆ TEST() [28/130]

flutter::testing::TEST ( FlutterProjectBundle  ,
BasicPropertiesRelativePaths   
)

Definition at line 23 of file flutter_project_bundle_unittests.cc.

References flutter::FlutterProjectBundle::assets_path(), FlutterDesktopEngineProperties::assets_path, flutter::FlutterProjectBundle::HasValidPaths(), FlutterDesktopEngineProperties::icu_data_path, and flutter::FlutterProjectBundle::icu_path().

23  {
24  FlutterDesktopEngineProperties properties = {};
25  properties.assets_path = L"foo\\flutter_assets";
26  properties.icu_data_path = L"foo\\icudtl.dat";
27 
28  FlutterProjectBundle project(properties);
29 
30  EXPECT_TRUE(project.HasValidPaths());
31  EXPECT_TRUE(project.assets_path().is_absolute());
32  EXPECT_EQ(project.assets_path().filename().string(), "flutter_assets");
33  EXPECT_TRUE(project.icu_path().is_absolute());
34  EXPECT_EQ(project.icu_path().filename().string(), "icudtl.dat");
35 }

◆ TEST() [29/130]

flutter::testing::TEST ( EmbeddedViewParams  ,
GetBoundingRectAfterMutationsWithScale   
)

Definition at line 24 of file embedded_view_params_unittests.cc.

References flutter::EmbeddedViewParams::finalBoundingRect(), and flutter::MutatorsStack::PushTransform().

24  {
25  MutatorsStack stack;
26  SkMatrix matrix = SkMatrix::Scale(2, 2);
27  stack.PushTransform(matrix);
28 
29  EmbeddedViewParams params(matrix, SkSize::Make(1, 1), stack);
30  const SkRect& rect = params.finalBoundingRect();
31  ASSERT_TRUE(SkScalarNearlyEqual(rect.x(), 0));
32  ASSERT_TRUE(SkScalarNearlyEqual(rect.y(), 0));
33  ASSERT_TRUE(SkScalarNearlyEqual(rect.width(), 2));
34  ASSERT_TRUE(SkScalarNearlyEqual(rect.height(), 2));
35 }

◆ TEST() [30/130]

flutter::testing::TEST ( StringConversion  ,
Utf8FromUtf16Empty   
)

Definition at line 24 of file string_conversion_unittests.cc.

References flutter::Utf8FromUtf16().

24  {
25  EXPECT_EQ(Utf8FromUtf16(L""), "");
26 }
std::string Utf8FromUtf16(const std::wstring &utf16_string)

◆ TEST() [31/130]

flutter::testing::TEST ( MutatorsStack  ,
CopyAndUpdateTheCopy   
)

Definition at line 26 of file mutators_stack_unittests.cc.

References flutter::MutatorsStack::Bottom(), flutter::clip_rect, flutter::clip_rrect, flutter::MutatorsStack::is_empty(), flutter::MutatorsStack::Pop(), flutter::MutatorsStack::PushClipRect(), and flutter::MutatorsStack::PushClipRRect().

26  {
27  MutatorsStack stack;
28  auto rrect = SkRRect::MakeEmpty();
29  auto rect = SkRect::MakeEmpty();
30  stack.PushClipRect(rect);
31  stack.PushClipRRect(rrect);
32  MutatorsStack copy = MutatorsStack(stack);
33  copy.Pop();
34  copy.Pop();
35  ASSERT_TRUE(copy != stack);
36  ASSERT_TRUE(copy.is_empty());
37  ASSERT_TRUE(!stack.is_empty());
38  auto iter = stack.Bottom();
39  ASSERT_TRUE(iter->get()->GetType() == MutatorType::clip_rrect);
40  ASSERT_TRUE(iter->get()->GetRRect() == rrect);
41  ++iter;
42  ASSERT_TRUE(iter->get()->GetType() == MutatorType::clip_rect);
43  ASSERT_TRUE(iter->get()->GetRect() == rect);
44 }

◆ TEST() [32/130]

flutter::testing::TEST ( StringConversion  ,
Utf8FromUtf16Ascii   
)

Definition at line 28 of file string_conversion_unittests.cc.

References flutter::Utf8FromUtf16().

28  {
29  EXPECT_EQ(Utf8FromUtf16(L"abc123"), "abc123");
30 }
std::string Utf8FromUtf16(const std::wstring &utf16_string)

◆ TEST() [33/130]

flutter::testing::TEST ( MockTextureTest  ,
PaintCalls   
)

Definition at line 28 of file mock_texture_unittests.cc.

28  {
29  SkCanvas canvas;
30  const SkRect paint_bounds1 = SkRect::MakeWH(1.0f, 1.0f);
31  const SkRect paint_bounds2 = SkRect::MakeWH(2.0f, 2.0f);
32  const auto expected_paint_calls =
33  std::vector{MockTexture::PaintCall{canvas, paint_bounds1, false, nullptr,
34  kNone_SkFilterQuality},
35  MockTexture::PaintCall{canvas, paint_bounds2, true, nullptr,
36  kNone_SkFilterQuality}};
37  auto texture = std::make_shared<MockTexture>(0);
38 
39  texture->Paint(canvas, paint_bounds1, false, nullptr, kNone_SkFilterQuality);
40  texture->Paint(canvas, paint_bounds2, true, nullptr, kNone_SkFilterQuality);
41  EXPECT_EQ(texture->paint_calls(), expected_paint_calls);
42 }

◆ TEST() [34/130]

flutter::testing::TEST ( RasterCache  ,
SimpleInitialization   
)

Definition at line 29 of file raster_cache_unittests.cc.

29  {
31  ASSERT_TRUE(true);
32 }

◆ TEST() [35/130]

flutter::testing::TEST ( MatrixDecomposition  ,
Scale   
)

Definition at line 31 of file matrix_decomposition_unittests.cc.

References flutter::MatrixDecomposition::IsValid(), and flutter::MatrixDecomposition::scale().

31  {
32  SkM44 matrix;
33 
34  const auto scale = 5.0;
35  matrix.setScale(scale + 0, scale + 1, scale + 2);
36 
37  flutter::MatrixDecomposition decomposition(matrix);
38  ASSERT_TRUE(decomposition.IsValid());
39 
40  ASSERT_FLOAT_EQ(scale + 0, decomposition.scale().x);
41  ASSERT_FLOAT_EQ(scale + 1, decomposition.scale().y);
42  ASSERT_FLOAT_EQ(scale + 2, decomposition.scale().z);
43 }

◆ TEST() [36/130]

flutter::testing::TEST ( CanvasSpyTest  ,
SpiedCanvasIsDrawing   
)

Definition at line 31 of file canvas_spy_unittests.cc.

References flutter::CanvasSpy::DidDrawIntoCanvas(), flutter::CanvasSpy::GetSpyingCanvas(), and fml::size().

31  {
32  auto actual_surface =
33  SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(100, 100));
34  SkCanvas* actual_canvas = actual_surface->getCanvas();
35 
36  auto expected_surface =
37  SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(100, 100));
38  SkCanvas* expected_canvas = expected_surface->getCanvas();
39 
40  CanvasSpy canvas_spy = CanvasSpy(actual_canvas);
41  SkCanvas* spy = canvas_spy.GetSpyingCanvas();
42 
43  SkNWayCanvas multi_canvas = SkNWayCanvas(100, 100);
44  multi_canvas.addCanvas(spy);
45  multi_canvas.addCanvas(expected_canvas);
46 
47  multi_canvas.clipRect(SkRect::MakeWH(100, 100));
48  multi_canvas.clear(SK_ColorRED);
49  multi_canvas.scale(.5, .5);
50  multi_canvas.clipRect(SkRect::MakeWH(100, 100));
51  multi_canvas.clear(SK_ColorBLUE);
52 
53  ASSERT_TRUE(canvas_spy.DidDrawIntoCanvas());
54 
55  SkPixmap actual;
56  SkPixmap expected;
57 
58  ASSERT_TRUE(actual_surface->peekPixels(&actual));
59  ASSERT_TRUE(expected_surface->peekPixels(&expected));
60 
61  const auto size = actual.rowBytes() * actual.height();
62  ASSERT_NE(size, 0u);
63 
64  ASSERT_EQ(::memcmp(actual.addr(), expected.addr(), size), 0);
65 }
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13

◆ TEST() [37/130]

flutter::testing::TEST ( SystemUtils  ,
ParseLanguageNameGeneric   
)

Definition at line 31 of file system_utils_unittests.cc.

References flutter::LanguageInfo::language, flutter::ParseLanguageName(), flutter::LanguageInfo::region, and flutter::LanguageInfo::script.

31  {
32  LanguageInfo info = ParseLanguageName(L"en");
33  EXPECT_EQ(info.language, "en");
34  EXPECT_TRUE(info.region.empty());
35  EXPECT_TRUE(info.script.empty());
36 }
LanguageInfo ParseLanguageName(std::wstring language_name)

◆ TEST() [38/130]

flutter::testing::TEST ( MockWin32Window  ,
HorizontalScroll   
)

Definition at line 31 of file win32_window_unittests.cc.

References flutter::testing::MockWin32Window::InjectWindowMessage().

31  {
32  MockWin32Window window;
33  const int scroll_amount = 10;
34  // Vertical scroll should be passed along, adjusted for scroll tick size.
35  EXPECT_CALL(window, OnScroll(scroll_amount / 120.0, 0)).Times(1);
36 
37  window.InjectWindowMessage(WM_MOUSEHWHEEL, MAKEWPARAM(0, scroll_amount), 0);
38 }

◆ TEST() [39/130]

flutter::testing::TEST ( StringConversion  ,
Utf8FromUtf16Unicode   
)

Definition at line 32 of file string_conversion_unittests.cc.

References flutter::Utf8FromUtf16().

32  {
33  EXPECT_EQ(Utf8FromUtf16(L"\x2603"), "\xe2\x98\x83");
34 }
std::string Utf8FromUtf16(const std::wstring &utf16_string)

◆ TEST() [40/130]

flutter::testing::TEST ( RasterCache  ,
ThresholdIsRespected   
)

Definition at line 34 of file raster_cache_unittests.cc.

References flutter::RasterCache::Draw(), flutter::RasterCache::Prepare(), and flutter::RasterCache::SweepAfterFrame().

34  {
35  size_t threshold = 2;
36  flutter::RasterCache cache(threshold);
37 
38  SkMatrix matrix = SkMatrix::I();
39 
40  auto picture = GetSamplePicture();
41 
42  sk_sp<SkImage> image;
43 
44  SkCanvas dummy_canvas;
45 
46  sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
47  ASSERT_FALSE(
48  cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, false));
49  // 1st access.
50  ASSERT_FALSE(cache.Draw(*picture, dummy_canvas));
51 
52  cache.SweepAfterFrame();
53 
54  ASSERT_FALSE(
55  cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, false));
56 
57  // 2nd access.
58  ASSERT_FALSE(cache.Draw(*picture, dummy_canvas));
59 
60  cache.SweepAfterFrame();
61 
62  // Now Prepare should cache it.
63  ASSERT_TRUE(
64  cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, false));
65  ASSERT_TRUE(cache.Draw(*picture, dummy_canvas));
66 }

◆ TEST() [41/130]

flutter::testing::TEST ( RTree  ,
searchNonOverlappingDrawnRectsSingleRectIntersection   
)

Definition at line 34 of file rtree_unittests.cc.

34  {
35  auto rtree_factory = RTreeFactory();
36  auto recorder = std::make_unique<SkPictureRecorder>();
37  auto recording_canvas =
38  recorder->beginRecording(SkRect::MakeIWH(1000, 1000), &rtree_factory);
39 
40  auto rect_paint = SkPaint();
41  rect_paint.setColor(SkColors::kCyan);
42  rect_paint.setStyle(SkPaint::Style::kFill_Style);
43 
44  // Given a single rect A that intersects with the query rect,
45  // the result list contains this rect.
46  recording_canvas->drawRect(SkRect::MakeLTRB(120, 120, 160, 160), rect_paint);
47 
48  recorder->finishRecordingAsPicture();
49 
50  auto hits = rtree_factory.getInstance()->searchNonOverlappingDrawnRects(
51  SkRect::MakeLTRB(140, 140, 150, 150));
52  ASSERT_EQ(1UL, hits.size());
53  ASSERT_EQ(*hits.begin(), SkRect::MakeLTRB(120, 120, 160, 160));
54 }

◆ TEST() [42/130]

flutter::testing::TEST ( PipelineTest  ,
ContinuationCanOnlyBeUsedOnce   
)

Definition at line 36 of file pipeline_unittests.cc.

References flutter::Pipeline< R >::ProducerContinuation::Complete(), flutter::Pipeline< R >::Consume(), flutter::Done, flutter::NoneAvailable, and flutter::Pipeline< R >::Produce().

36  {
37  fml::RefPtr<IntPipeline> pipeline = fml::MakeRefCounted<IntPipeline>(2);
38 
39  Continuation continuation = pipeline->Produce();
40 
41  const int test_val = 1;
42  bool result = continuation.Complete(std::make_unique<int>(test_val));
43  ASSERT_EQ(result, true);
44 
45  PipelineConsumeResult consume_result_1 = pipeline->Consume(
46  [&test_val](std::unique_ptr<int> v) { ASSERT_EQ(*v, test_val); });
47 
48  result = continuation.Complete(std::make_unique<int>(test_val));
49  ASSERT_EQ(result, false);
50  ASSERT_EQ(consume_result_1, PipelineConsumeResult::Done);
51 
52  PipelineConsumeResult consume_result_2 =
53  pipeline->Consume([](std::unique_ptr<int> v) { FAIL(); });
54 
55  result = continuation.Complete(std::make_unique<int>(test_val));
56  ASSERT_EQ(result, false);
57  ASSERT_EQ(consume_result_2, PipelineConsumeResult::NoneAvailable);
58 }
PipelineConsumeResult
Definition: pipeline.h:19
IntPipeline::ProducerContinuation Continuation

◆ TEST() [43/130]

flutter::testing::TEST ( EmbedderTestNoFixture  ,
MustNotRunWithInvalidArgs   
)

Definition at line 36 of file embedder_unittests.cc.

References engine, flutter::testing::EmbedderConfigBuilder::kNoInitialize, and flutter::testing::EmbedderConfigBuilder::LaunchEngine().

36  {
37  EmbedderTestContextSoftware context;
38  EmbedderConfigBuilder builder(
39  context, EmbedderConfigBuilder::InitializationPreference::kNoInitialize);
40  auto engine = builder.LaunchEngine();
41  ASSERT_FALSE(engine.is_valid());
42 }

◆ TEST() [44/130]

flutter::testing::TEST ( TextureRegistryTest  ,
GrContextCallbackTriggered   
)

Definition at line 36 of file texture_unittests.cc.

References flutter::TextureRegistry::OnGrContextCreated(), flutter::TextureRegistry::OnGrContextDestroyed(), flutter::TextureRegistry::RegisterTexture(), and flutter::TextureRegistry::UnregisterTexture().

36  {
37  TextureRegistry registry;
38  auto mock_texture1 = std::make_shared<MockTexture>(0);
39  auto mock_texture2 = std::make_shared<MockTexture>(1);
40 
41  registry.RegisterTexture(mock_texture1);
42  registry.RegisterTexture(mock_texture2);
43  ASSERT_FALSE(mock_texture1->gr_context_created());
44  ASSERT_FALSE(mock_texture2->gr_context_created());
45  ASSERT_FALSE(mock_texture1->gr_context_destroyed());
46  ASSERT_FALSE(mock_texture2->gr_context_destroyed());
47 
48  registry.OnGrContextCreated();
49  ASSERT_TRUE(mock_texture1->gr_context_created());
50  ASSERT_TRUE(mock_texture2->gr_context_created());
51 
52  registry.UnregisterTexture(0);
53  registry.OnGrContextDestroyed();
54  ASSERT_FALSE(mock_texture1->gr_context_destroyed());
55  ASSERT_TRUE(mock_texture2->gr_context_created());
56 }

◆ TEST() [45/130]

flutter::testing::TEST ( FlutterViewControllerTest  ,
HasStringsWhenPasteboardEmpty   
)

Definition at line 37 of file FlutterViewControllerTest.mm.

References mockViewController().

37  {
38  // Mock FlutterViewController so that it behaves like the pasteboard is empty.
39  id viewControllerMock = mockViewController(nil);
40 
41  // Call hasStrings and expect it to be false.
42  __block bool calledAfterClear = false;
43  __block bool valueAfterClear;
44  FlutterResult resultAfterClear = ^(id result) {
45  calledAfterClear = true;
46  NSNumber* valueNumber = [result valueForKey:@"value"];
47  valueAfterClear = [valueNumber boolValue];
48  };
49  FlutterMethodCall* methodCallAfterClear =
50  [FlutterMethodCall methodCallWithMethodName:@"Clipboard.hasStrings" arguments:nil];
51  [viewControllerMock handleMethodCall:methodCallAfterClear result:resultAfterClear];
52  ASSERT_TRUE(calledAfterClear);
53  ASSERT_FALSE(valueAfterClear);
54 }
id mockViewController(NSString *pasteboardString)
void(^ FlutterResult)(id _Nullable result)

◆ TEST() [46/130]

flutter::testing::TEST ( FlutterProjectBundle  ,
SwitchesEmpty   
)

Definition at line 37 of file flutter_project_bundle_unittests.cc.

References FlutterDesktopEngineProperties::assets_path, flutter::FlutterProjectBundle::GetSwitches(), and FlutterDesktopEngineProperties::icu_data_path.

37  {
38  FlutterDesktopEngineProperties properties = {};
39  properties.assets_path = L"foo\\flutter_assets";
40  properties.icu_data_path = L"foo\\icudtl.dat";
41 
42  // Clear the main environment variable, since test order is not guaranteed.
43  _putenv_s("FLUTTER_ENGINE_SWITCHES", "");
44 
45  FlutterProjectBundle project(properties);
46 
47  EXPECT_EQ(project.GetSwitches().size(), 0);
48 }

◆ TEST() [47/130]

flutter::testing::TEST ( EmbeddedViewParams  ,
GetBoundingRectAfterMutationsWithTranslate   
)

Definition at line 37 of file embedded_view_params_unittests.cc.

References flutter::EmbeddedViewParams::finalBoundingRect(), and flutter::MutatorsStack::PushTransform().

37  {
38  MutatorsStack stack;
39  SkMatrix matrix = SkMatrix::MakeTrans(1, 1);
40  stack.PushTransform(matrix);
41 
42  EmbeddedViewParams params(matrix, SkSize::Make(1, 1), stack);
43  const SkRect& rect = params.finalBoundingRect();
44  ASSERT_TRUE(SkScalarNearlyEqual(rect.x(), 1));
45  ASSERT_TRUE(SkScalarNearlyEqual(rect.y(), 1));
46  ASSERT_TRUE(SkScalarNearlyEqual(rect.width(), 1));
47  ASSERT_TRUE(SkScalarNearlyEqual(rect.height(), 1));
48 }

◆ TEST() [48/130]

flutter::testing::TEST ( SurfacePool  ,
GetLayer__AllocateOneLayer   
)

Definition at line 38 of file surface_pool_unittests.cc.

References flutter::kSoftware.

38  {
39  auto pool = std::make_unique<SurfacePool>();
40 
41  auto gr_context = GrDirectContext::MakeMock(nullptr);
42  auto android_context =
43  std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
44 
45  auto jni_mock = std::make_shared<JNIMock>();
46  auto window = fml::MakeRefCounted<AndroidNativeWindow>(nullptr);
47  EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface())
48  .WillOnce(Return(
49  ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
50  0, window))));
51 
52  auto surface_factory =
53  std::make_shared<TestAndroidSurfaceFactory>([gr_context, window]() {
54  auto android_surface_mock = std::make_unique<AndroidSurfaceMock>();
55  EXPECT_CALL(*android_surface_mock, CreateGPUSurface(gr_context.get()));
56  EXPECT_CALL(*android_surface_mock, SetNativeWindow(window));
57  EXPECT_CALL(*android_surface_mock, IsValid()).WillOnce(Return(true));
58  return android_surface_mock;
59  });
60  auto layer = pool->GetLayer(gr_context.get(), android_context, jni_mock,
61  surface_factory);
62 
63  ASSERT_NE(nullptr, layer);
64  ASSERT_EQ(reinterpret_cast<intptr_t>(gr_context.get()),
65  layer->gr_context_key);
66 }

◆ TEST() [49/130]

flutter::testing::TEST ( SystemUtils  ,
ParseLanguageNameWithRegion   
)

Definition at line 38 of file system_utils_unittests.cc.

References flutter::LanguageInfo::language, flutter::ParseLanguageName(), flutter::LanguageInfo::region, and flutter::LanguageInfo::script.

38  {
39  LanguageInfo info = ParseLanguageName(L"hu-HU");
40  EXPECT_EQ(info.language, "hu");
41  EXPECT_EQ(info.region, "HU");
42  EXPECT_TRUE(info.script.empty());
43 }
LanguageInfo ParseLanguageName(std::wstring language_name)

◆ TEST() [50/130]

flutter::testing::TEST ( MockTextureTest  ,
PaintCallsWithLowFilterQuality   
)

Definition at line 44 of file mock_texture_unittests.cc.

44  {
45  SkCanvas canvas;
46  const SkRect paint_bounds1 = SkRect::MakeWH(1.0f, 1.0f);
47  const SkRect paint_bounds2 = SkRect::MakeWH(2.0f, 2.0f);
48  const auto expected_paint_calls =
49  std::vector{MockTexture::PaintCall{canvas, paint_bounds1, false, nullptr,
50  kLow_SkFilterQuality},
51  MockTexture::PaintCall{canvas, paint_bounds2, true, nullptr,
52  kLow_SkFilterQuality}};
53  auto texture = std::make_shared<MockTexture>(0);
54 
55  texture->Paint(canvas, paint_bounds1, false, nullptr, kLow_SkFilterQuality);
56  texture->Paint(canvas, paint_bounds2, true, nullptr, kLow_SkFilterQuality);
57  EXPECT_EQ(texture->paint_calls(), expected_paint_calls);
58 }

◆ TEST() [51/130]

flutter::testing::TEST ( MatrixDecomposition  ,
Translate   
)

Definition at line 45 of file matrix_decomposition_unittests.cc.

References flutter::MatrixDecomposition::IsValid(), and flutter::MatrixDecomposition::translation().

45  {
46  SkM44 matrix;
47 
48  const auto translate = 125.0;
49  matrix.setTranslate(translate + 0, translate + 1, translate + 2);
50 
51  flutter::MatrixDecomposition decomposition(matrix);
52  ASSERT_TRUE(decomposition.IsValid());
53 
54  ASSERT_FLOAT_EQ(translate + 0, decomposition.translation().x);
55  ASSERT_FLOAT_EQ(translate + 1, decomposition.translation().y);
56  ASSERT_FLOAT_EQ(translate + 2, decomposition.translation().z);
57 }

◆ TEST() [52/130]

flutter::testing::TEST ( SystemUtils  ,
ParseLanguageNameWithScript   
)

Definition at line 45 of file system_utils_unittests.cc.

References flutter::LanguageInfo::language, flutter::ParseLanguageName(), flutter::LanguageInfo::region, and flutter::LanguageInfo::script.

45  {
46  LanguageInfo info = ParseLanguageName(L"us-Latn");
47  EXPECT_EQ(info.language, "us");
48  EXPECT_TRUE(info.region.empty());
49  EXPECT_EQ(info.script, "Latn");
50 }
LanguageInfo ParseLanguageName(std::wstring language_name)

◆ TEST() [53/130]

flutter::testing::TEST ( MutatorsStack  ,
PushClipRect   
)

Definition at line 46 of file mutators_stack_unittests.cc.

References flutter::MutatorsStack::Bottom(), flutter::clip_rect, and flutter::MutatorsStack::PushClipRect().

46  {
47  MutatorsStack stack;
48  auto rect = SkRect::MakeEmpty();
49  stack.PushClipRect(rect);
50  auto iter = stack.Bottom();
51  ASSERT_TRUE(iter->get()->GetType() == MutatorType::clip_rect);
52  ASSERT_TRUE(iter->get()->GetRect() == rect);
53 }

◆ TEST() [54/130]

flutter::testing::TEST ( Win32WindowProcDelegateManagerTest  ,
CallsCorrectly   
)

Definition at line 47 of file win32_window_proc_delegate_manager_unittests.cc.

References flutter::Win32WindowProcDelegateManager::OnTopLevelWindowProc(), and flutter::Win32WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate().

47  {
48  Win32WindowProcDelegateManager manager;
49  HWND dummy_hwnd;
50 
51  bool called = false;
52  TestWindowProcDelegate delegate = [&called, &dummy_hwnd](
53  HWND hwnd, UINT message, WPARAM wparam,
54  LPARAM lparam) {
55  called = true;
56  EXPECT_EQ(hwnd, dummy_hwnd);
57  EXPECT_EQ(message, 2);
58  EXPECT_EQ(wparam, 3);
59  EXPECT_EQ(lparam, 4);
60  return std::optional<LRESULT>();
61  };
62  manager.RegisterTopLevelWindowProcDelegate(TestWindowProcCallback, &delegate);
63  auto result = manager.OnTopLevelWindowProc(dummy_hwnd, 2, 3, 4);
64 
65  EXPECT_TRUE(called);
66  EXPECT_FALSE(result);
67 }

◆ TEST() [55/130]

flutter::testing::TEST ( EmbeddedViewParams  ,
GetBoundingRectAfterMutationsWithRotation90   
)

Definition at line 50 of file embedded_view_params_unittests.cc.

References flutter::EmbeddedViewParams::finalBoundingRect(), FML_DLOG, and flutter::MutatorsStack::PushTransform().

50  {
51  MutatorsStack stack;
52  SkMatrix matrix;
53  matrix.setRotate(90);
54  stack.PushTransform(matrix);
55 
56  EmbeddedViewParams params(matrix, SkSize::Make(1, 1), stack);
57  const SkRect& rect = params.finalBoundingRect();
58 
59  FML_DLOG(ERROR) << rect.x();
60  ASSERT_TRUE(SkScalarNearlyEqual(rect.x(), -1));
61  ASSERT_TRUE(SkScalarNearlyEqual(rect.y(), 0));
62  ASSERT_TRUE(SkScalarNearlyEqual(rect.width(), 1));
63  ASSERT_TRUE(SkScalarNearlyEqual(rect.height(), 1));
64 }
#define FML_DLOG(severity)
Definition: logging.h:85

◆ TEST() [56/130]

flutter::testing::TEST ( FlutterProjectBundle  ,
Switches   
)

Definition at line 51 of file flutter_project_bundle_unittests.cc.

References FlutterDesktopEngineProperties::assets_path, flutter::FlutterProjectBundle::GetSwitches(), and FlutterDesktopEngineProperties::icu_data_path.

51  {
52  FlutterDesktopEngineProperties properties = {};
53  properties.assets_path = L"foo\\flutter_assets";
54  properties.icu_data_path = L"foo\\icudtl.dat";
55 
56  _putenv_s("FLUTTER_ENGINE_SWITCHES", "2");
57  _putenv_s("FLUTTER_ENGINE_SWITCH_1", "abc");
58  _putenv_s("FLUTTER_ENGINE_SWITCH_2", "foo=\"bar, baz\"");
59 
60  FlutterProjectBundle project(properties);
61 
62  std::vector<std::string> switches = project.GetSwitches();
63  EXPECT_EQ(switches.size(), 2);
64  EXPECT_EQ(switches[0], "--abc");
65  EXPECT_EQ(switches[1], "--foo=\"bar, baz\"");
66 }

◆ TEST() [57/130]

flutter::testing::TEST ( SystemUtils  ,
ParseLanguageNameWithRegionAndScript   
)

Definition at line 52 of file system_utils_unittests.cc.

References flutter::LanguageInfo::language, flutter::ParseLanguageName(), flutter::LanguageInfo::region, and flutter::LanguageInfo::script.

52  {
53  LanguageInfo info = ParseLanguageName(L"uz-Latn-UZ");
54  EXPECT_EQ(info.language, "uz");
55  EXPECT_EQ(info.region, "UZ");
56  EXPECT_EQ(info.script, "Latn");
57 }
LanguageInfo ParseLanguageName(std::wstring language_name)

◆ TEST() [58/130]

flutter::testing::TEST ( MutatorsStack  ,
PushClipRRect   
)

Definition at line 55 of file mutators_stack_unittests.cc.

References flutter::MutatorsStack::Bottom(), flutter::clip_rrect, and flutter::MutatorsStack::PushClipRRect().

55  {
56  MutatorsStack stack;
57  auto rrect = SkRRect::MakeEmpty();
58  stack.PushClipRRect(rrect);
59  auto iter = stack.Bottom();
60  ASSERT_TRUE(iter->get()->GetType() == MutatorType::clip_rrect);
61  ASSERT_TRUE(iter->get()->GetRRect() == rrect);
62 }

◆ TEST() [59/130]

flutter::testing::TEST ( FlutterViewControllerTest  ,
HasStringsWhenPasteboardFull   
)

Definition at line 56 of file FlutterViewControllerTest.mm.

References mockViewController(), and value.

56  {
57  // Mock FlutterViewController so that it behaves like the pasteboard has a
58  // valid string.
59  id viewControllerMock = mockViewController(@"some string");
60 
61  // Call hasStrings and expect it to be true.
62  __block bool called = false;
63  __block bool value;
64  FlutterResult result = ^(id result) {
65  called = true;
66  NSNumber* valueNumber = [result valueForKey:@"value"];
67  value = [valueNumber boolValue];
68  };
69  FlutterMethodCall* methodCall =
70  [FlutterMethodCall methodCallWithMethodName:@"Clipboard.hasStrings" arguments:nil];
71  [viewControllerMock handleMethodCall:methodCall result:result];
72  ASSERT_TRUE(called);
73  ASSERT_TRUE(value);
74 }
id mockViewController(NSString *pasteboardString)
uint8_t value
void(^ FlutterResult)(id _Nullable result)

◆ TEST() [60/130]

flutter::testing::TEST ( RTree  ,
searchNonOverlappingDrawnRectsIgnoresNonDrawingRecords   
)

Definition at line 56 of file rtree_unittests.cc.

56  {
57  auto rtree_factory = RTreeFactory();
58  auto recorder = std::make_unique<SkPictureRecorder>();
59  auto recording_canvas =
60  recorder->beginRecording(SkRect::MakeIWH(1000, 1000), &rtree_factory);
61 
62  auto rect_paint = SkPaint();
63  rect_paint.setColor(SkColors::kCyan);
64  rect_paint.setStyle(SkPaint::Style::kFill_Style);
65 
66  // Creates two non drawing records.
67  recording_canvas->translate(100, 100);
68  // The result list should only contain the clipping rect.
69  recording_canvas->clipRect(SkRect::MakeLTRB(40, 40, 50, 50),
70  SkClipOp::kIntersect);
71  recording_canvas->drawRect(SkRect::MakeLTRB(20, 20, 80, 80), rect_paint);
72 
73  recorder->finishRecordingAsPicture();
74 
75  // The rtree has a translate, a clip and a rect record.
76  ASSERT_EQ(3, rtree_factory.getInstance()->getCount());
77 
78  auto hits = rtree_factory.getInstance()->searchNonOverlappingDrawnRects(
79  SkRect::MakeLTRB(0, 0, 1000, 1000));
80  ASSERT_EQ(1UL, hits.size());
81  ASSERT_EQ(*hits.begin(), SkRect::MakeLTRB(120, 120, 180, 180));
82 }

◆ TEST() [61/130]

flutter::testing::TEST ( TextureRegistryTest  ,
RegisterTextureTwice   
)

Definition at line 58 of file texture_unittests.cc.

References flutter::TextureRegistry::GetTexture(), flutter::TextureRegistry::RegisterTexture(), and flutter::TextureRegistry::UnregisterTexture().

58  {
59  TextureRegistry registry;
60  auto mock_texture1 = std::make_shared<MockTexture>(0);
61  auto mock_texture2 = std::make_shared<MockTexture>(0);
62 
63  registry.RegisterTexture(mock_texture1);
64  ASSERT_EQ(registry.GetTexture(0), mock_texture1);
65  registry.RegisterTexture(mock_texture2);
66  ASSERT_EQ(registry.GetTexture(0), mock_texture2);
67  ASSERT_FALSE(mock_texture1->unregistered());
68  ASSERT_FALSE(mock_texture2->unregistered());
69 
70  registry.UnregisterTexture(0);
71  ASSERT_EQ(registry.GetTexture(0), nullptr);
72  ASSERT_FALSE(mock_texture1->unregistered());
73  ASSERT_TRUE(mock_texture2->unregistered());
74 }

◆ TEST() [62/130]

flutter::testing::TEST ( SystemUtils  ,
ParseLanguageNameWithSuplementalLanguage   
)

Definition at line 59 of file system_utils_unittests.cc.

References flutter::LanguageInfo::language, flutter::ParseLanguageName(), flutter::LanguageInfo::region, and flutter::LanguageInfo::script.

59  {
60  LanguageInfo info = ParseLanguageName(L"en-US-x-fabricam");
61  EXPECT_EQ(info.language, "en");
62  EXPECT_EQ(info.region, "US");
63  EXPECT_TRUE(info.script.empty());
64 }
LanguageInfo ParseLanguageName(std::wstring language_name)

◆ TEST() [63/130]

flutter::testing::TEST ( MatrixDecomposition  ,
Combination   
)

Definition at line 59 of file matrix_decomposition_unittests.cc.

References flutter::MatrixDecomposition::IsValid(), flutter::MatrixDecomposition::rotation(), flutter::MatrixDecomposition::scale(), and flutter::MatrixDecomposition::translation().

59  {
60  const auto rotation = M_PI_4;
61  const auto scale = 5;
62  const auto translate = 125.0;
63 
64  SkM44 m1;
65  m1.setRotate({0, 0, 1}, rotation);
66 
67  SkM44 m2;
68  m2.setScale(scale, scale, scale);
69 
70  SkM44 m3;
71  m3.setTranslate(translate, translate, translate);
72 
73  SkM44 combined = m3 * m2 * m1;
74 
75  flutter::MatrixDecomposition decomposition(combined);
76  ASSERT_TRUE(decomposition.IsValid());
77 
78  ASSERT_FLOAT_EQ(translate, decomposition.translation().x);
79  ASSERT_FLOAT_EQ(translate, decomposition.translation().y);
80  ASSERT_FLOAT_EQ(translate, decomposition.translation().z);
81 
82  ASSERT_FLOAT_EQ(scale, decomposition.scale().x);
83  ASSERT_FLOAT_EQ(scale, decomposition.scale().y);
84  ASSERT_FLOAT_EQ(scale, decomposition.scale().z);
85 
86  const auto sine = sin(rotation * 0.5);
87 
88  ASSERT_FLOAT_EQ(0, decomposition.rotation().x);
89  ASSERT_FLOAT_EQ(0, decomposition.rotation().y);
90  ASSERT_FLOAT_EQ(sine, decomposition.rotation().z);
91  ASSERT_FLOAT_EQ(cos(rotation * 0.5), decomposition.rotation().w);
92 }

◆ TEST() [64/130]

flutter::testing::TEST ( PipelineTest  ,
PushingMoreThanDepthCompletesFirstSubmission   
)

Definition at line 60 of file pipeline_unittests.cc.

References flutter::Pipeline< R >::ProducerContinuation::Complete(), flutter::Pipeline< R >::Consume(), flutter::Done, and flutter::Pipeline< R >::Produce().

60  {
61  const int depth = 1;
62  fml::RefPtr<IntPipeline> pipeline = fml::MakeRefCounted<IntPipeline>(depth);
63 
64  Continuation continuation_1 = pipeline->Produce();
65  Continuation continuation_2 = pipeline->Produce();
66 
67  const int test_val_1 = 1, test_val_2 = 2;
68  bool result = continuation_1.Complete(std::make_unique<int>(test_val_1));
69  ASSERT_EQ(result, true);
70  result = continuation_2.Complete(std::make_unique<int>(test_val_2));
71  ASSERT_EQ(result, false);
72 
73  PipelineConsumeResult consume_result_1 = pipeline->Consume(
74  [&test_val_1](std::unique_ptr<int> v) { ASSERT_EQ(*v, test_val_1); });
75 
76  ASSERT_EQ(consume_result_1, PipelineConsumeResult::Done);
77 }
PipelineConsumeResult
Definition: pipeline.h:19
IntPipeline::ProducerContinuation Continuation

◆ TEST() [65/130]

flutter::testing::TEST ( MutatorsStack  ,
PushClipPath   
)

Definition at line 64 of file mutators_stack_unittests.cc.

References flutter::MutatorsStack::Bottom(), flutter::clip_path, flutter::path, and flutter::MutatorsStack::PushClipPath().

64  {
65  MutatorsStack stack;
66  SkPath path;
67  stack.PushClipPath(path);
68  auto iter = stack.Bottom();
69  ASSERT_TRUE(iter->get()->GetType() == flutter::MutatorType::clip_path);
70  ASSERT_TRUE(iter->get()->GetPath() == path);
71 }
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32

◆ TEST() [66/130]

flutter::testing::TEST ( PlatformViewShell  ,
UpdateSemanticsDoesFlutterViewUpdateCustomAccessibilityActions   
)

Definition at line 65 of file platform_view_android_delegate_unittests.cc.

References flutter::CustomAccessibilityAction::hint, flutter::CustomAccessibilityAction::id, flutter::CustomAccessibilityAction::label, and flutter::CustomAccessibilityAction::overrideId.

66  {
67  auto jni_mock = std::make_shared<JNIMock>();
68  auto delegate = std::make_unique<PlatformViewAndroidDelegate>(jni_mock);
69 
72  action0.id = 0;
73  action0.overrideId = 1;
74  action0.label = "label";
75  action0.hint = "hint";
76  actions.insert(std::make_pair(0, std::move(action0)));
77 
78  std::vector<uint8_t> expected_actions_buffer(16);
79  int32_t* actions_buffer_int32 =
80  reinterpret_cast<int32_t*>(&expected_actions_buffer[0]);
81  std::vector<std::string> expected_action_strings;
82  actions_buffer_int32[0] = action0.id;
83  actions_buffer_int32[1] = action0.overrideId;
84  actions_buffer_int32[2] = expected_action_strings.size();
85  expected_action_strings.push_back(action0.label);
86  actions_buffer_int32[3] = expected_action_strings.size();
87  expected_action_strings.push_back(action0.hint);
88 
89  EXPECT_CALL(*jni_mock, FlutterViewUpdateCustomAccessibilityActions(
90  expected_actions_buffer, expected_action_strings));
91  // Creates empty update.
93  delegate->UpdateSemantics(update, actions);
94 }
std::unordered_map< int32_t, SemanticsNode > SemanticsNodeUpdates
std::unordered_map< int32_t, CustomAccessibilityAction > CustomAccessibilityActionUpdates

◆ TEST() [67/130]

flutter::testing::TEST ( EmbeddedViewParams  ,
GetBoundingRectAfterMutationsWithRotation45   
)

Definition at line 66 of file embedded_view_params_unittests.cc.

References flutter::EmbeddedViewParams::finalBoundingRect(), and flutter::MutatorsStack::PushTransform().

66  {
67  MutatorsStack stack;
68  SkMatrix matrix;
69  matrix.setRotate(45);
70  stack.PushTransform(matrix);
71 
72  EmbeddedViewParams params(matrix, SkSize::Make(1, 1), stack);
73  const SkRect& rect = params.finalBoundingRect();
74  ASSERT_TRUE(SkScalarNearlyEqual(rect.x(), -sqrt(2) / 2));
75  ASSERT_TRUE(SkScalarNearlyEqual(rect.y(), 0));
76  ASSERT_TRUE(SkScalarNearlyEqual(rect.width(), sqrt(2)));
77  ASSERT_TRUE(SkScalarNearlyEqual(rect.height(), sqrt(2)));
78 }

◆ TEST() [68/130]

flutter::testing::TEST ( SystemUtils  ,
ParseLanguageNameWithThreeCharacterLanguage   
)

Definition at line 67 of file system_utils_unittests.cc.

References flutter::LanguageInfo::language, flutter::ParseLanguageName(), flutter::LanguageInfo::region, and flutter::LanguageInfo::script.

67  {
68  LanguageInfo info = ParseLanguageName(L"ale-ZZ");
69  EXPECT_EQ(info.language, "ale");
70  EXPECT_EQ(info.region, "ZZ");
71  EXPECT_TRUE(info.script.empty());
72 }
LanguageInfo ParseLanguageName(std::wstring language_name)

◆ TEST() [69/130]

flutter::testing::TEST ( SurfacePool  ,
GetUnusedLayers   
)

Definition at line 68 of file surface_pool_unittests.cc.

References flutter::kSoftware.

68  {
69  auto pool = std::make_unique<SurfacePool>();
70 
71  auto gr_context = GrDirectContext::MakeMock(nullptr);
72  auto android_context =
73  std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
74 
75  auto jni_mock = std::make_shared<JNIMock>();
76  auto window = fml::MakeRefCounted<AndroidNativeWindow>(nullptr);
77  EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface())
78  .WillOnce(Return(
79  ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
80  0, window))));
81 
82  auto surface_factory =
83  std::make_shared<TestAndroidSurfaceFactory>([gr_context, window]() {
84  auto android_surface_mock = std::make_unique<AndroidSurfaceMock>();
85  EXPECT_CALL(*android_surface_mock, CreateGPUSurface(gr_context.get()));
86  EXPECT_CALL(*android_surface_mock, SetNativeWindow(window));
87  EXPECT_CALL(*android_surface_mock, IsValid()).WillOnce(Return(true));
88  return android_surface_mock;
89  });
90  auto layer = pool->GetLayer(gr_context.get(), android_context, jni_mock,
91  surface_factory);
92  ASSERT_EQ(0UL, pool->GetUnusedLayers().size());
93 
94  pool->RecycleLayers();
95 
96  ASSERT_EQ(1UL, pool->GetUnusedLayers().size());
97  ASSERT_EQ(layer, pool->GetUnusedLayers()[0]);
98 }

◆ TEST() [70/130]

flutter::testing::TEST ( RasterCache  ,
AccessThresholdOfZeroDisablesCaching   
)

Definition at line 68 of file raster_cache_unittests.cc.

References flutter::RasterCache::Draw(), and flutter::RasterCache::Prepare().

68  {
69  size_t threshold = 0;
70  flutter::RasterCache cache(threshold);
71 
72  SkMatrix matrix = SkMatrix::I();
73 
74  auto picture = GetSamplePicture();
75 
76  sk_sp<SkImage> image;
77 
78  SkCanvas dummy_canvas;
79 
80  sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
81  ASSERT_FALSE(
82  cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, false));
83 
84  ASSERT_FALSE(cache.Draw(*picture, dummy_canvas));
85 }

◆ TEST() [71/130]

flutter::testing::TEST ( Win32WindowProcDelegateManagerTest  ,
ReplacementRegister   
)

Definition at line 69 of file win32_window_proc_delegate_manager_unittests.cc.

References flutter::Win32WindowProcDelegateManager::OnTopLevelWindowProc(), and flutter::Win32WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate().

69  {
70  Win32WindowProcDelegateManager manager;
71 
72  bool called_a = false;
73  TestWindowProcDelegate delegate_a =
74  [&called_a](HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
75  called_a = true;
76  return std::optional<LRESULT>();
77  };
78  bool called_b = false;
79  TestWindowProcDelegate delegate_b =
80  [&called_b](HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
81  called_b = true;
82  return std::optional<LRESULT>();
83  };
84  manager.RegisterTopLevelWindowProcDelegate(TestWindowProcCallback,
85  &delegate_a);
86  // The function pointer is the same, so this should replace, not add.
87  manager.RegisterTopLevelWindowProcDelegate(TestWindowProcCallback,
88  &delegate_b);
89  manager.OnTopLevelWindowProc(nullptr, 0, 0, 0);
90 
91  EXPECT_FALSE(called_a);
92  EXPECT_TRUE(called_b);
93 }

◆ TEST() [72/130]

flutter::testing::TEST ( MutatorsStack  ,
PushTransform   
)

Definition at line 73 of file mutators_stack_unittests.cc.

References flutter::MutatorsStack::Bottom(), flutter::MutatorsStack::PushTransform(), and flutter::transform.

73  {
74  MutatorsStack stack;
75  SkMatrix matrix;
76  matrix.setIdentity();
77  stack.PushTransform(matrix);
78  auto iter = stack.Bottom();
79  ASSERT_TRUE(iter->get()->GetType() == MutatorType::transform);
80  ASSERT_TRUE(iter->get()->GetMatrix() == matrix);
81 }

◆ TEST() [73/130]

flutter::testing::TEST ( TextureRegistryTest  ,
ReuseSameTextureSlot   
)

Definition at line 76 of file texture_unittests.cc.

References flutter::TextureRegistry::GetTexture(), flutter::TextureRegistry::RegisterTexture(), and flutter::TextureRegistry::UnregisterTexture().

76  {
77  TextureRegistry registry;
78  auto mock_texture1 = std::make_shared<MockTexture>(0);
79  auto mock_texture2 = std::make_shared<MockTexture>(0);
80 
81  registry.RegisterTexture(mock_texture1);
82  ASSERT_EQ(registry.GetTexture(0), mock_texture1);
83 
84  registry.UnregisterTexture(0);
85  ASSERT_EQ(registry.GetTexture(0), nullptr);
86  ASSERT_TRUE(mock_texture1->unregistered());
87  ASSERT_FALSE(mock_texture2->unregistered());
88 
89  registry.RegisterTexture(mock_texture2);
90  ASSERT_EQ(registry.GetTexture(0), mock_texture2);
91 
92  registry.UnregisterTexture(0);
93  ASSERT_EQ(registry.GetTexture(0), nullptr);
94  ASSERT_TRUE(mock_texture1->unregistered());
95  ASSERT_TRUE(mock_texture2->unregistered());
96 }

◆ TEST() [74/130]

flutter::testing::TEST ( PipelineTest  ,
PushingMultiProcessesInOrder   
)

Definition at line 79 of file pipeline_unittests.cc.

References flutter::Pipeline< R >::ProducerContinuation::Complete(), flutter::Pipeline< R >::Consume(), flutter::Done, flutter::MoreAvailable, and flutter::Pipeline< R >::Produce().

79  {
80  const int depth = 2;
81  fml::RefPtr<IntPipeline> pipeline = fml::MakeRefCounted<IntPipeline>(depth);
82 
83  Continuation continuation_1 = pipeline->Produce();
84  Continuation continuation_2 = pipeline->Produce();
85 
86  const int test_val_1 = 1, test_val_2 = 2;
87  bool result = continuation_1.Complete(std::make_unique<int>(test_val_1));
88  ASSERT_EQ(result, true);
89  result = continuation_2.Complete(std::make_unique<int>(test_val_2));
90  ASSERT_EQ(result, true);
91 
92  PipelineConsumeResult consume_result_1 = pipeline->Consume(
93  [&test_val_1](std::unique_ptr<int> v) { ASSERT_EQ(*v, test_val_1); });
94  ASSERT_EQ(consume_result_1, PipelineConsumeResult::MoreAvailable);
95 
96  PipelineConsumeResult consume_result_2 = pipeline->Consume(
97  [&test_val_2](std::unique_ptr<int> v) { ASSERT_EQ(*v, test_val_2); });
98  ASSERT_EQ(consume_result_2, PipelineConsumeResult::Done);
99 }
PipelineConsumeResult
Definition: pipeline.h:19
IntPipeline::ProducerContinuation Continuation

◆ TEST() [75/130]

flutter::testing::TEST ( EmbeddedViewParams  ,
GetBoundingRectAfterMutationsWithTranslateScaleAndRotation   
)

Definition at line 80 of file embedded_view_params_unittests.cc.

References flutter::EmbeddedViewParams::finalBoundingRect(), and flutter::MutatorsStack::PushTransform().

81  {
82  SkMatrix matrix = SkMatrix::MakeTrans(2, 2);
83  matrix.preScale(3, 3);
84  matrix.preRotate(90);
85 
86  MutatorsStack stack;
87  stack.PushTransform(matrix);
88 
89  EmbeddedViewParams params(matrix, SkSize::Make(1, 1), stack);
90  const SkRect& rect = params.finalBoundingRect();
91  ASSERT_TRUE(SkScalarNearlyEqual(rect.x(), -1));
92  ASSERT_TRUE(SkScalarNearlyEqual(rect.y(), 2));
93  ASSERT_TRUE(SkScalarNearlyEqual(rect.width(), 3));
94  ASSERT_TRUE(SkScalarNearlyEqual(rect.height(), 3));
95 }

◆ TEST() [76/130]

flutter::testing::TEST ( MutatorsStack  ,
PushOpacity   
)

Definition at line 83 of file mutators_stack_unittests.cc.

References flutter::MutatorsStack::Bottom(), flutter::opacity, and flutter::MutatorsStack::PushOpacity().

83  {
84  MutatorsStack stack;
85  int alpha = 240;
86  stack.PushOpacity(alpha);
87  auto iter = stack.Bottom();
88  ASSERT_TRUE(iter->get()->GetType() == MutatorType::opacity);
89  ASSERT_TRUE(iter->get()->GetAlpha() == 240);
90 }

◆ TEST() [77/130]

flutter::testing::TEST ( RTree  ,
searchNonOverlappingDrawnRectsMultipleRectIntersection   
)

Definition at line 84 of file rtree_unittests.cc.

84  {
85  auto rtree_factory = RTreeFactory();
86  auto recorder = std::make_unique<SkPictureRecorder>();
87  auto recording_canvas =
88  recorder->beginRecording(SkRect::MakeIWH(1000, 1000), &rtree_factory);
89 
90  auto rect_paint = SkPaint();
91  rect_paint.setColor(SkColors::kCyan);
92  rect_paint.setStyle(SkPaint::Style::kFill_Style);
93 
94  // Given the A, B that intersect with the query rect,
95  // there should be A and B in the result list since
96  // they don't intersect with each other.
97  //
98  // +-----+ +-----+
99  // | A | | B |
100  // +-----+ +-----+
101  // A
102  recording_canvas->drawRect(SkRect::MakeLTRB(100, 100, 200, 200), rect_paint);
103  // B
104  recording_canvas->drawRect(SkRect::MakeLTRB(300, 100, 400, 200), rect_paint);
105 
106  recorder->finishRecordingAsPicture();
107 
108  auto hits = rtree_factory.getInstance()->searchNonOverlappingDrawnRects(
109  SkRect::MakeLTRB(0, 0, 1000, 1050));
110  ASSERT_EQ(2UL, hits.size());
111  ASSERT_EQ(*hits.begin(), SkRect::MakeLTRB(100, 100, 200, 200));
112  ASSERT_EQ(*std::next(hits.begin(), 1), SkRect::MakeLTRB(300, 100, 400, 200));
113 }

◆ TEST() [78/130]

flutter::testing::TEST ( RasterCache  ,
PictureCacheLimitPerFrameIsRespectedWhenZero   
)

Definition at line 87 of file raster_cache_unittests.cc.

References flutter::RasterCache::Draw(), and flutter::RasterCache::Prepare().

87  {
88  size_t picture_cache_limit_per_frame = 0;
89  flutter::RasterCache cache(3, picture_cache_limit_per_frame);
90 
91  SkMatrix matrix = SkMatrix::I();
92 
93  auto picture = GetSamplePicture();
94 
95  sk_sp<SkImage> image;
96 
97  SkCanvas dummy_canvas;
98 
99  sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
100  ASSERT_FALSE(
101  cache.Prepare(NULL, picture.get(), matrix, srgb.get(), true, false));
102 
103  ASSERT_FALSE(cache.Draw(*picture, dummy_canvas));
104 }

◆ TEST() [79/130]

flutter::testing::TEST ( MutatorsStack  ,
Pop   
)

Definition at line 92 of file mutators_stack_unittests.cc.

References flutter::MutatorsStack::Bottom(), flutter::MutatorsStack::Pop(), flutter::MutatorsStack::PushTransform(), and flutter::MutatorsStack::Top().

92  {
93  MutatorsStack stack;
94  SkMatrix matrix;
95  matrix.setIdentity();
96  stack.PushTransform(matrix);
97  stack.Pop();
98  auto iter = stack.Bottom();
99  ASSERT_TRUE(iter == stack.Top());
100 }

◆ TEST() [80/130]

flutter::testing::TEST ( MatrixDecomposition  ,
ScaleFloatError   
)

Definition at line 94 of file matrix_decomposition_unittests.cc.

References flutter::MatrixDecomposition::IsValid(), flutter::MatrixDecomposition::rotation(), and flutter::MatrixDecomposition::scale().

94  {
95  constexpr float scale_increment = 0.00001f;
96  float scale = 0.0001f;
97  while (scale < 2.0f) {
98  SkM44 matrix;
99  matrix.setScale(scale, scale, 1.0f);
100 
101  flutter::MatrixDecomposition decomposition3(matrix);
102  ASSERT_TRUE(decomposition3.IsValid());
103 
104  ASSERT_FLOAT_EQ(scale, decomposition3.scale().x);
105  ASSERT_FLOAT_EQ(scale, decomposition3.scale().y);
106  ASSERT_FLOAT_EQ(1.f, decomposition3.scale().z);
107  ASSERT_FLOAT_EQ(0, decomposition3.rotation().x);
108  ASSERT_FLOAT_EQ(0, decomposition3.rotation().y);
109  ASSERT_FLOAT_EQ(0, decomposition3.rotation().z);
110  scale += scale_increment;
111  }
112 
113  SkM44 matrix;
114  const auto scale1 = 1.7734375f;
115  matrix.setScale(scale1, scale1, 1.f);
116 
117  // Bug upper bound (empirical)
118  const auto scale2 = 1.773437559603f;
119  SkM44 matrix2;
120  matrix2.setScale(scale2, scale2, 1.f);
121 
122  // Bug lower bound (empirical)
123  const auto scale3 = 1.7734374403954f;
124  SkM44 matrix3;
125  matrix3.setScale(scale3, scale3, 1.f);
126 
127  flutter::MatrixDecomposition decomposition(matrix);
128  ASSERT_TRUE(decomposition.IsValid());
129 
130  flutter::MatrixDecomposition decomposition2(matrix2);
131  ASSERT_TRUE(decomposition2.IsValid());
132 
133  flutter::MatrixDecomposition decomposition3(matrix3);
134  ASSERT_TRUE(decomposition3.IsValid());
135 
136  ASSERT_FLOAT_EQ(scale1, decomposition.scale().x);
137  ASSERT_FLOAT_EQ(scale1, decomposition.scale().y);
138  ASSERT_FLOAT_EQ(1.f, decomposition.scale().z);
139  ASSERT_FLOAT_EQ(0, decomposition.rotation().x);
140  ASSERT_FLOAT_EQ(0, decomposition.rotation().y);
141  ASSERT_FLOAT_EQ(0, decomposition.rotation().z);
142 
143  ASSERT_FLOAT_EQ(scale2, decomposition2.scale().x);
144  ASSERT_FLOAT_EQ(scale2, decomposition2.scale().y);
145  ASSERT_FLOAT_EQ(1.f, decomposition2.scale().z);
146  ASSERT_FLOAT_EQ(0, decomposition2.rotation().x);
147  ASSERT_FLOAT_EQ(0, decomposition2.rotation().y);
148  ASSERT_FLOAT_EQ(0, decomposition2.rotation().z);
149 
150  ASSERT_FLOAT_EQ(scale3, decomposition3.scale().x);
151  ASSERT_FLOAT_EQ(scale3, decomposition3.scale().y);
152  ASSERT_FLOAT_EQ(1.f, decomposition3.scale().z);
153  ASSERT_FLOAT_EQ(0, decomposition3.rotation().x);
154  ASSERT_FLOAT_EQ(0, decomposition3.rotation().y);
155  ASSERT_FLOAT_EQ(0, decomposition3.rotation().z);
156 }

◆ TEST() [81/130]

flutter::testing::TEST ( AndroidExternalViewEmbedder  ,
GetCurrentCanvases   
)

Definition at line 95 of file external_view_embedder_unittests.cc.

References GetThreadMergerFromPlatformThread().

95  {
96  auto jni_mock = std::make_shared<JNIMock>();
97 
98  auto embedder =
99  std::make_unique<AndroidExternalViewEmbedder>(nullptr, jni_mock, nullptr);
100  auto raster_thread_merger = GetThreadMergerFromPlatformThread();
101 
102  EXPECT_CALL(*jni_mock, FlutterViewBeginFrame());
103  embedder->BeginFrame(SkISize::Make(10, 20), nullptr, 1.0,
104  raster_thread_merger);
105 
106  embedder->PrerollCompositeEmbeddedView(
107  0, std::make_unique<EmbeddedViewParams>());
108  embedder->PrerollCompositeEmbeddedView(
109  1, std::make_unique<EmbeddedViewParams>());
110 
111  auto canvases = embedder->GetCurrentCanvases();
112  ASSERT_EQ(2UL, canvases.size());
113  ASSERT_EQ(SkISize::Make(10, 20), canvases[0]->getBaseLayerSize());
114  ASSERT_EQ(SkISize::Make(10, 20), canvases[1]->getBaseLayerSize());
115 }
fml::RefPtr< fml::RasterThreadMerger > GetThreadMergerFromPlatformThread(bool merged=false)

◆ TEST() [82/130]

flutter::testing::TEST ( Win32WindowProcDelegateManagerTest  ,
RegisterMultiple   
)

Definition at line 95 of file win32_window_proc_delegate_manager_unittests.cc.

References flutter::Win32WindowProcDelegateManager::OnTopLevelWindowProc(), and flutter::Win32WindowProcDelegateManager::RegisterTopLevelWindowProcDelegate().

95  {
96  Win32WindowProcDelegateManager manager;
97 
98  bool called_a = false;
99  TestWindowProcDelegate delegate_a =
100  [&called_a](HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
101  called_a = true;
102  return std::optional<LRESULT>();
103  };
104  bool called_b = false;
105  TestWindowProcDelegate delegate_b =
106  [&called_b](HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
107  called_b = true;
108  return std::optional<LRESULT>();
109  };
110  manager.RegisterTopLevelWindowProcDelegate(TestWindowProcCallback,
111  &delegate_a);
112  // Function pointer is different, so both should be called.
113  manager.RegisterTopLevelWindowProcDelegate(TestWindowProcCallback2,
114  &delegate_b);
115  manager.OnTopLevelWindowProc(nullptr, 0, 0, 0);
116 
117  EXPECT_TRUE(called_a);
118  EXPECT_TRUE(called_b);
119 }

◆ TEST() [83/130]

flutter::testing::TEST ( SurfacePool  ,
GetLayer__Recycle   
)

Definition at line 100 of file surface_pool_unittests.cc.

References flutter::kSoftware.

100  {
101  auto pool = std::make_unique<SurfacePool>();
102 
103  auto gr_context_1 = GrDirectContext::MakeMock(nullptr);
104  auto jni_mock = std::make_shared<JNIMock>();
105  auto window = fml::MakeRefCounted<AndroidNativeWindow>(nullptr);
106  EXPECT_CALL(*jni_mock, FlutterViewCreateOverlaySurface())
107  .WillOnce(Return(
108  ByMove(std::make_unique<PlatformViewAndroidJNI::OverlayMetadata>(
109  0, window))));
110 
111  auto android_context =
112  std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);