| Flutter Windows Embedder |

Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
flutter Namespace Reference

## Namespaces
| internal
| testing

## Classes
class | AccessibilityBridge
class | AccessibilityBridgeWindows
class | AlertPlatformNodeDelegate
class | AngleSurfaceManager
class | BasicMessageChannel
class | BinaryMessenger
class | BinaryMessengerImpl
class | ByteBufferStreamReader
class | ByteBufferStreamWriter
class | ByteStreamReader
class | ByteStreamWriter
class | CursorHandler
class | CustomEncodableValue
class | DartProject
class | DartProjectTest
class | DirectManipulationEventHandler
class | DirectManipulationOwner
class | EncodableValue
class | EngineMethodResult
class | EventChannel
class | EventSink
class | EventWatcher
class | ExternalTexture
class | ExternalTextureD3d
class | ExternalTexturePixelBuffer
class | FlutterDesktopMessenger
class | FlutterEngine
class | FlutterPlatformNodeDelegate
class | FlutterPlatformNodeDelegateWindows
class | FlutterProjectBundle
class | FlutterView
class | FlutterViewController
class | FlutterWindow
class | FlutterWindowsEngine
class | FlutterWindowsTextureRegistrar
class | FlutterWindowsView
struct | GlProcs
class | GpuSurfaceTexture
class | ImmContext
class | IncomingMessageDispatcher
class | JsonMessageCodec
class | JsonMethodCodec
class | KeyboardHandlerBase
class | KeyboardKeyChannelHandler
class | KeyboardKeyEmbedderHandler
class | KeyboardKeyHandler
class | KeyboardManager
struct | LanguageInfo
class | MessageCodec
class | MethodCall
class | MethodChannel
class | MethodCodec
class | MethodResult
class | MethodResultFunctions
struct | PhysicalWindowBounds
class | PixelBufferTexture
class | PlatformHandler
class | Plugin
class | PluginRegistrar
class | PluginRegistrarManager
class | PluginRegistrarWindows
class | PluginRegistry
class | Point
struct | PointerLocation
class | Rect
class | ScopedClipboardInterface
class | SequentialIdGenerator
class | SettingsPlugin
class | Size
class | StandardCodecSerializer
class | StandardMessageCodec
class | StandardMethodCodec
class | StreamHandler
struct | StreamHandlerError
class | StreamHandlerFunctions
class | TaskRunner
class | TaskRunnerWindow
class | TestAccessibilityBridge
class | TestCustomValue
struct | TextEditingDelta
| A change in the state of an input field. More...
class | TextInputManager
class | TextInputModel
class | TextInputPlugin
class | TextInputPluginDelegate
class | TextRange
class | TextureRegistrar
class | TextureRegistrarImpl
class | ThreadSnapshot
class | WindowBindingHandler
class | WindowBindingHandlerDelegate
class | WindowProcDelegateManager
class | WindowsLifecycleManager
class | WindowsProcTable

## Typedefs
using | WindowProcDelegate = std::function< std::optional< LRESULT >(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)>
typedef void(* | glGenTexturesProc) (GLsizei n, GLuint *textures)
typedef void(* | glDeleteTexturesProc) (GLsizei n, const GLuint *textures)
typedef void(* | glBindTextureProc) (GLenum target, GLuint texture)
typedef void(* | glTexParameteriProc) (GLenum target, GLenum pname, GLint param)
typedef void(* | glTexImage2DProc) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data)
using | UniqueAotDataPtr = std::unique_ptr< _FlutterEngineAOTData, FlutterEngineCollectAOTDataFnPtr >
typedef uint64_t(* | CurrentTimeProc) ()
using | PlatformWindow = HWND
using | WindowsRenderTarget = std::variant< HWND >
template<typename T >
using | MessageReply = std::function< void(const T &reply)>
template<typename T >
using | MessageHandler = std::function< void(const T &message, const MessageReply< T > &reply)>
typedef std::function< void(const uint8_t *reply, size_t reply_size)> | BinaryReply
typedef std::function< void(const uint8_t *message, size_t message_size, BinaryReply reply)> | BinaryMessageHandler
using | EncodableList = std::vector< EncodableValue >
using | EncodableMap = std::map< EncodableValue, EncodableValue >
template<typename T >
using | StreamHandlerListen = std::function< std::unique_ptr< StreamHandlerError< T > >(const T *arguments, std::unique_ptr< EventSink< T > > &&events)>
template<typename T >
using | StreamHandlerCancel = std::function< std::unique_ptr< StreamHandlerError< T > >(const T *arguments)>
template<typename T >
using | MethodCallHandler = std::function< void(const MethodCall< T > &call, std::unique_ptr< MethodResult< T > > result)>
template<typename T >
using | ResultHandlerSuccess = std::function< void(const T *result)>
template<typename T >
using | ResultHandlerError = std::function< void(const std::string &error_code, const std::string &error_message, const T *error_details)>
template<typename T >
using | ResultHandlerNotImplemented = std::function< void()>
typedef std::variant< PixelBufferTexture, GpuSurfaceTexture > | TextureVariant
typedef ui::AXNode::AXID | AccessibilityNodeId

## Enumerations
enum | AppExitType { AppExitType::required, AppExitType::cancelable }
enum | WindowStateEvent { WindowStateEvent::kShow, WindowStateEvent::kHide, WindowStateEvent::kFocus, WindowStateEvent::kUnfocus }
| An event representing a change in window state that may update the. More...
enum | AppLifecycleState { AppLifecycleState::kDetached, AppLifecycleState::kResumed, AppLifecycleState::kInactive, AppLifecycleState::kHidden, AppLifecycleState::kPaused }
enum | PlatformProvidedMenu { PlatformProvidedMenu::kAbout, PlatformProvidedMenu::kQuit, PlatformProvidedMenu::kServicesSubmenu, PlatformProvidedMenu::kHide, PlatformProvidedMenu::kHideOtherApplications, PlatformProvidedMenu::kShowAllApplications, PlatformProvidedMenu::kStartSpeaking, PlatformProvidedMenu::kStopSpeaking, PlatformProvidedMenu::kToggleFullScreen, PlatformProvidedMenu::kMinimizeWindow, PlatformProvidedMenu::kZoomWindow, PlatformProvidedMenu::kArrangeWindowsInFront }

## Functions
| TEST_F (DartProjectTest, StandardProjectFormat)
| TEST_F (DartProjectTest, ProjectWithCustomPaths)
| TEST_F (DartProjectTest, DartEntrypointArguments)
| TEST (FlutterEngineTest, CreateDestroy)
| TEST (FlutterEngineTest, CreateDestroyWithCustomEntrypoint)
| TEST (FlutterEngineTest, ExplicitShutDown)
| TEST (FlutterEngineTest, ProcessMessages)
| TEST (FlutterEngineTest, ReloadFonts)
| TEST (FlutterEngineTest, GetMessenger)
| TEST (FlutterEngineTest, DartEntrypointArgs)
| TEST (FlutterEngineTest, SetNextFrameCallback)
| TEST (FlutterEngineTest, ProcessExternalWindowMessage)
| TEST (FlutterViewControllerTest, CreateDestroy)
| TEST (FlutterViewControllerTest, GetEngine)
| TEST (FlutterViewControllerTest, GetView)
| TEST (FlutterViewControllerTest, ForceRedraw)
| TEST (FlutterViewTest, HwndAccessPassesThrough)
| TEST (FlutterViewTest, GraphicsAdapterAccessPassesThrough)
| TEST (PluginRegistrarWindowsTest, GetView)
| TEST (PluginRegistrarWindowsTest, PluginDestroyedBeforeRegistrar)
| TEST (PluginRegistrarWindowsTest, RegisterUnregister)
| TEST (PluginRegistrarWindowsTest, CallsRegisteredDelegates)
| TEST (PluginRegistrarWindowsTest, StopsOnceHandled)
HCURSOR | GetCursorFromBuffer (const std::vector< uint8_t > &buffer, double hot_x, double hot_y, int width, int height)
void | GetMaskBitmaps (HBITMAP bitmap, HBITMAP &mask_bitmap)
UINT | GetDpiForHWND (HWND hwnd)
UINT | GetDpiForMonitor (HMONITOR monitor)
static void | WindowsPlatformThreadPrioritySetter (FlutterThreadPriority priority)
std::string | ConvertChar32ToUtf8 (char32_t ch)
static bool | isEasciiPrintable (int codeUnit)
static uint64_t | toLower (uint64_t n)
static uint16_t | normalizeScancode (int windowsScanCode, bool extended)
std::u16string | EncodeUtf16 (char32_t character)
uint32_t | UndeadChar (uint32_t ch)
static AppExitType | StringToAppExitType (const std::string &string)
std::vector< LanguageInfo > | GetPreferredLanguageInfo (const WindowsProcTable &windows_proc_table)
std::wstring | GetPreferredLanguagesFromMUI (const WindowsProcTable &windows_proc_table)
std::vector< std::wstring > | GetPreferredLanguages (const WindowsProcTable &windows_proc_table)
LanguageInfo | ParseLanguageName (std::wstring language_name)
std::wstring | GetUserTimeFormat ()
bool | Prefer24HourTime (std::wstring time_format)
static int64_t | NumWindowsForThread (const THREADENTRY32 &thread)
constexpr const char * | AppLifecycleStateToString (AppLifecycleState state)
| TEST (BasicMessageChannelTest, Registration)
| TEST (BasicMessageChannelTest, Unregistration)
| TEST (EncodableValueTest, Null)
| TEST (EncodableValueTest, Bool)
| TEST (EncodableValueTest, Int)
| TEST (EncodableValueTest, LongValue)
| TEST (EncodableValueTest, Long)
| TEST (EncodableValueTest, Double)
| TEST (EncodableValueTest, String)
| TEST (EncodableValueTest, CString)
| TEST (EncodableValueTest, UInt8List)
| TEST (EncodableValueTest, Int32List)
| TEST (EncodableValueTest, Int64List)
| TEST (EncodableValueTest, DoubleList)
| TEST (EncodableValueTest, List)
| TEST (EncodableValueTest, Map)
| TEST (EncodableValueTest, Comparison)
| TEST (EncodableValueTest, DeepCopy)
| TEST (EncodableValueTest, TypeIndexesCorrect)
| TEST (EventChannelTest, Registration)
| TEST (EventChannelTest, Unregistration)
| TEST (EventChannelTest, Cancel)
| TEST (EventChannelTest, ListenNotCancel)
| TEST (EventChannelTest, ReRegistration)
| TEST (EventChannelTest, HandlerOutlivesEventChannel)
| TEST (EventChannelTest, StreamHandlerErrorPassByValue)
| TEST (EventChannelTest, StreamHandlerErrorNullptr)
| TEST (MethodCallTest, Basic)
| TEST (MethodChannelTest, Registration)
| TEST (MethodChannelTest, Unregistration)
| TEST (MethodChannelTest, InvokeWithoutResponse)
| TEST (MethodChannelTest, InvokeWithResponse)
| TEST (MethodChannelTest, InvokeNotImplemented)
| TEST (MethodChannelTest, NoHandlers)
| TEST (MethodChannelTest, Success)
| TEST (MethodChannelTest, Error)
| TEST (MethodChannelTest, NotImplemented)
| TEST (PluginRegistrarTest, PluginDestroyedBeforeRegistrar)
| TEST (PluginRegistrarTest, MessengerSend)
| TEST (PluginRegistrarTest, MessengerSetMessageHandler)
| TEST (PluginRegistrarTest, ManagerSameInstance)
| TEST (PluginRegistrarTest, ManagerDifferentInstances)
| TEST (PluginRegistrarTest, ManagerRemovesOnDestruction)
| TEST (PluginRegistrarTest, TextureRegistrarNotNull)
static void | CheckEncodeDecode (const EncodableValue &value, const std::vector< uint8_t > &expected_encoding, const StandardCodecSerializer *serializer=nullptr, const std::function< bool(const EncodableValue &a, const EncodableValue &b)> &custom_comparator=nullptr)
static void | CheckEncodeDecodeWithEncodePrefix (const EncodableValue &value, const std::vector< uint8_t > &expected_encoding_prefix, size_t expected_encoding_length)
| TEST (StandardMessageCodec, GetInstanceCachesInstance)
| TEST (StandardMessageCodec, CanEncodeAndDecodeNull)
| TEST (StandardMessageCodec, CanDecodeEmptyBytesAsNullWithoutCallingSerializer)
| TEST (StandardMessageCodec, CanEncodeAndDecodeTrue)
| TEST (StandardMessageCodec, CanEncodeAndDecodeFalse)
| TEST (StandardMessageCodec, CanEncodeAndDecodeInt32)
| TEST (StandardMessageCodec, CanEncodeAndDecodeInt64)
| TEST (StandardMessageCodec, CanEncodeAndDecodeDouble)
| TEST (StandardMessageCodec, CanEncodeAndDecodeString)
| TEST (StandardMessageCodec, CanEncodeAndDecodeStringWithNonAsciiCodePoint)
| TEST (StandardMessageCodec, CanEncodeAndDecodeStringWithNonBMPCodePoint)
| TEST (StandardMessageCodec, CanEncodeAndDecodeEmptyString)
| TEST (StandardMessageCodec, CanEncodeAndDecodeList)
| TEST (StandardMessageCodec, CanEncodeAndDecodeEmptyList)
| TEST (StandardMessageCodec, CanEncodeAndDecodeMap)
| TEST (StandardMessageCodec, CanEncodeAndDecodeByteArray)
| TEST (StandardMessageCodec, CanEncodeAndDecodeInt32Array)
| TEST (StandardMessageCodec, CanEncodeAndDecodeInt64Array)
| TEST (StandardMessageCodec, CanEncodeAndDecodeFloat32Array)
| TEST (StandardMessageCodec, CanEncodeAndDecodeFloat64Array)
| TEST (StandardMessageCodec, CanEncodeAndDecodeSimpleCustomType)
| TEST (StandardMessageCodec, CanEncodeAndDecodeVariableLengthCustomType)
| TEST (StandardMethodCodec, GetInstanceCachesInstance)
| TEST (StandardMethodCodec, HandlesMethodCallsWithNullArguments)
| TEST (StandardMethodCodec, HandlesMethodCallsWithArgument)
| TEST (StandardMethodCodec, HandlesSuccessEnvelopesWithNullResult)
| TEST (StandardMethodCodec, HandlesSuccessEnvelopesWithResult)
| TEST (StandardMethodCodec, HandlesErrorEnvelopesWithNulls)
| TEST (StandardMethodCodec, HandlesErrorEnvelopesWithDetails)
| TEST (StandardMethodCodec, HandlesCustomTypeArguments)
| TEST (TextureRegistrarTest, RegisterUnregisterTexture)
| TEST (TextureRegistrarTest, UnregisterInvalidTexture)
| TEST (TextureRegistrarTest, MarkFrameAvailableInvalidTexture)
std::vector< std::string > | GetSwitchesFromEnvironment ()
| TEST (FlutterProjectBundle, SwitchesEmpty)
| TEST (FlutterProjectBundle, Switches)
| TEST (FlutterProjectBundle, SwitchesExtraValues)
| TEST (FlutterProjectBundle, SwitchesMissingValues)
| TEST (Point, SetsCoordinates)
| TEST (Size, SetsDimensions)
| TEST (Size, ClampsDimensionsPositive)
| TEST (Rect, SetsOriginAndSize)
| TEST (Rect, ReturnsLTRB)
| TEST (Rect, ReturnsWidthHeight)
| TEST (IncomingMessageDispatcher, SetHandle)
| TEST (IncomingMessageDispatcher, BlockInputFalse)
| TEST (IncomingMessageDispatcher, BlockInputTrue)
| TEST (JsonMessageCodec, EncodeDecode)
| TEST (JsonMethodCodec, HandlesMethodCallsWithNullArguments)
| TEST (JsonMethodCodec, HandlesMethodCallsWithArgument)
| TEST (JsonMethodCodec, HandlesSuccessEnvelopesWithNullResult)
| TEST (JsonMethodCodec, HandlesSuccessEnvelopesWithResult)
| TEST (JsonMethodCodec, HandlesErrorEnvelopesWithNulls)
| TEST (JsonMethodCodec, HandlesErrorEnvelopesWithDetails)
std::filesystem::path | GetExecutableDirectory ()
| TEST (PathUtilsTest, ExecutableDirector)
| TEST (TextEditingDeltaTest, TestTextEditingDeltaConstructor)
| TEST (TextEditingDeltaTest, TestTextEditingDeltaNonTextConstructor)
| TEST (TextInputModel, SetText)
| TEST (TextInputModel, SetTextWideCharacters)
| TEST (TextInputModel, SetTextEmpty)
| TEST (TextInputModel, SetTextReplaceText)
| TEST (TextInputModel, SetTextResetsSelection)
| TEST (TextInputModel, SetSelectionStart)
| TEST (TextInputModel, SetSelectionComposingStart)
| TEST (TextInputModel, SetSelectionMiddle)
| TEST (TextInputModel, SetSelectionComposingMiddle)
| TEST (TextInputModel, SetSelectionEnd)
| TEST (TextInputModel, SetSelectionComposingEnd)
| TEST (TextInputModel, SetSelectionWthExtent)
| TEST (TextInputModel, SetSelectionWthExtentComposing)
| TEST (TextInputModel, SetSelectionReverseExtent)
| TEST (TextInputModel, SetSelectionReverseExtentComposing)
| TEST (TextInputModel, SetSelectionOutsideString)
| TEST (TextInputModel, SetSelectionOutsideComposingRange)
| TEST (TextInputModel, SetComposingRangeStart)
| TEST (TextInputModel, SetComposingRangeMiddle)
| TEST (TextInputModel, SetComposingRangeEnd)
| TEST (TextInputModel, SetComposingRangeWithExtent)
| TEST (TextInputModel, SetComposingRangeReverseExtent)
| TEST (TextInputModel, SetComposingRangeOutsideString)
| TEST (TextInputModel, CommitComposingNoTextWithNoSelection)
| TEST (TextInputModel, CommitComposingNoTextWithSelection)
| TEST (TextInputModel, CommitComposingTextWithNoSelection)
| TEST (TextInputModel, CommitComposingTextWithSelection)
| TEST (TextInputModel, UpdateComposingRemovesLastComposingCharacter)
| TEST (TextInputModel, AddCodePoint)
| TEST (TextInputModel, AddCodePointSelection)
| TEST (TextInputModel, AddCodePointReverseSelection)
| TEST (TextInputModel, AddCodePointSelectionWideCharacter)
| TEST (TextInputModel, AddCodePointReverseSelectionWideCharacter)
| TEST (TextInputModel, AddText)
| TEST (TextInputModel, AddTextSelection)
| TEST (TextInputModel, AddTextReverseSelection)
| TEST (TextInputModel, AddTextSelectionWideCharacter)
| TEST (TextInputModel, AddTextReverseSelectionWideCharacter)
| TEST (TextInputModel, DeleteStart)
| TEST (TextInputModel, DeleteMiddle)
| TEST (TextInputModel, DeleteEnd)
| TEST (TextInputModel, DeleteWideCharacters)
| TEST (TextInputModel, DeleteSelection)
| TEST (TextInputModel, DeleteReverseSelection)
| TEST (TextInputModel, DeleteStartComposing)
| TEST (TextInputModel, DeleteStartReverseComposing)
| TEST (TextInputModel, DeleteMiddleComposing)
| TEST (TextInputModel, DeleteMiddleReverseComposing)
| TEST (TextInputModel, DeleteEndComposing)
| TEST (TextInputModel, DeleteEndReverseComposing)
| TEST (TextInputModel, DeleteSurroundingAtCursor)
| TEST (TextInputModel, DeleteSurroundingAtCursorComposing)
| TEST (TextInputModel, DeleteSurroundingAtCursorAll)
| TEST (TextInputModel, DeleteSurroundingAtCursorAllComposing)
| TEST (TextInputModel, DeleteSurroundingAtCursorGreedy)
| TEST (TextInputModel, DeleteSurroundingAtCursorGreedyComposing)
| TEST (TextInputModel, DeleteSurroundingBeforeCursor)
| TEST (TextInputModel, DeleteSurroundingBeforeCursorComposing)
| TEST (TextInputModel, DeleteSurroundingBeforeCursorAll)
| TEST (TextInputModel, DeleteSurroundingBeforeCursorAllComposing)
| TEST (TextInputModel, DeleteSurroundingBeforeCursorGreedy)
| TEST (TextInputModel, DeleteSurroundingBeforeCursorGreedyComposing)
| TEST (TextInputModel, DeleteSurroundingAfterCursor)
| TEST (TextInputModel, DeleteSurroundingAfterCursorComposing)
| TEST (TextInputModel, DeleteSurroundingAfterCursorAll)
| TEST (TextInputModel, DeleteSurroundingAfterCursorAllComposing)
| TEST (TextInputModel, DeleteSurroundingAfterCursorGreedy)
| TEST (TextInputModel, DeleteSurroundingAfterCursorGreedyComposing)
| TEST (TextInputModel, DeleteSurroundingSelection)
| TEST (TextInputModel, DeleteSurroundingReverseSelection)
| TEST (TextInputModel, BackspaceStart)
| TEST (TextInputModel, BackspaceMiddle)
| TEST (TextInputModel, BackspaceEnd)
| TEST (TextInputModel, BackspaceWideCharacters)
| TEST (TextInputModel, BackspaceSelection)
| TEST (TextInputModel, BackspaceReverseSelection)
| TEST (TextInputModel, BackspaceStartComposing)
| TEST (TextInputModel, BackspaceStartReverseComposing)
| TEST (TextInputModel, BackspaceMiddleComposing)
| TEST (TextInputModel, BackspaceMiddleReverseComposing)
| TEST (TextInputModel, BackspaceEndComposing)
| TEST (TextInputModel, BackspaceEndReverseComposing)
| TEST (TextInputModel, MoveCursorForwardStart)
| TEST (TextInputModel, MoveCursorForwardMiddle)
| TEST (TextInputModel, MoveCursorForwardEnd)
| TEST (TextInputModel, MoveCursorForwardWideCharacters)
| TEST (TextInputModel, MoveCursorForwardSelection)
| TEST (TextInputModel, MoveCursorForwardReverseSelection)
| TEST (TextInputModel, MoveCursorForwardStartComposing)
| TEST (TextInputModel, MoveCursorForwardStartReverseComposing)
| TEST (TextInputModel, MoveCursorForwardMiddleComposing)
| TEST (TextInputModel, MoveCursorForwardMiddleReverseComposing)
| TEST (TextInputModel, MoveCursorForwardEndComposing)
| TEST (TextInputModel, MoveCursorForwardEndReverseComposing)
| TEST (TextInputModel, MoveCursorBackStart)
| TEST (TextInputModel, MoveCursorBackMiddle)
| TEST (TextInputModel, MoveCursorBackEnd)
| TEST (TextInputModel, MoveCursorBackWideCharacters)
| TEST (TextInputModel, MoveCursorBackSelection)
| TEST (TextInputModel, MoveCursorBackReverseSelection)
| TEST (TextInputModel, MoveCursorBackStartComposing)
| TEST (TextInputModel, MoveCursorBackStartReverseComposing)
| TEST (TextInputModel, MoveCursorBackMiddleComposing)
| TEST (TextInputModel, MoveCursorBackMiddleReverseComposing)
| TEST (TextInputModel, MoveCursorBackEndComposing)
| TEST (TextInputModel, MoveCursorBackEndReverseComposing)
| TEST (TextInputModel, MoveCursorToBeginningStart)
| TEST (TextInputModel, SelectToBeginningStart)
| TEST (TextInputModel, MoveCursorToBeginningMiddle)
| TEST (TextInputModel, SelectToBeginningMiddle)
| TEST (TextInputModel, MoveCursorToBeginningEnd)
| TEST (TextInputModel, SelectToBeginningEnd)
| TEST (TextInputModel, MoveCursorToBeginningSelection)
| TEST (TextInputModel, SelectToBeginningSelection)
| TEST (TextInputModel, MoveCursorToBeginningReverseSelection)
| TEST (TextInputModel, SelectToBeginningReverseSelection)
| TEST (TextInputModel, MoveCursorToBeginningStartComposing)
| TEST (TextInputModel, SelectToBeginningStartComposing)
| TEST (TextInputModel, MoveCursorToBeginningStartReverseComposing)
| TEST (TextInputModel, SelectToBeginningStartReverseComposing)
| TEST (TextInputModel, MoveCursorToBeginningMiddleComposing)
| TEST (TextInputModel, SelectToBeginningMiddleComposing)
| TEST (TextInputModel, MoveCursorToBeginningMiddleReverseComposing)
| TEST (TextInputModel, SelectToBeginningMiddleReverseComposing)
| TEST (TextInputModel, MoveCursorToBeginningEndComposing)
| TEST (TextInputModel, SelectToBeginningEndComposing)
| TEST (TextInputModel, MoveCursorToBeginningEndReverseComposing)
| TEST (TextInputModel, SelectToBeginningEndReverseComposing)
| TEST (TextInputModel, MoveCursorToEndStart)
| TEST (TextInputModel, SelectToEndStart)
| TEST (TextInputModel, MoveCursorToEndMiddle)
| TEST (TextInputModel, SelectToEndMiddle)
| TEST (TextInputModel, MoveCursorToEndEnd)
| TEST (TextInputModel, SelectToEndEnd)
| TEST (TextInputModel, MoveCursorToEndSelection)
| TEST (TextInputModel, SelectToEndSelection)
| TEST (TextInputModel, MoveCursorToEndReverseSelection)
| TEST (TextInputModel, SelectToEndReverseSelection)
| TEST (TextInputModel, MoveCursorToEndStartComposing)
| TEST (TextInputModel, SelectToEndStartComposing)
| TEST (TextInputModel, MoveCursorToEndStartReverseComposing)
| TEST (TextInputModel, SelectToEndStartReverseComposing)
| TEST (TextInputModel, MoveCursorToEndMiddleComposing)
| TEST (TextInputModel, SelectToEndMiddleComposing)
| TEST (TextInputModel, MoveCursorToEndMiddleReverseComposing)
| TEST (TextInputModel, SelectToEndMiddleReverseComposing)
| TEST (TextInputModel, MoveCursorToEndEndComposing)
| TEST (TextInputModel, SelectToEndEndComposing)
| TEST (TextInputModel, MoveCursorToEndEndReverseComposing)
| TEST (TextInputModel, SelectToEndEndReverseComposing)
| TEST (TextInputModel, GetCursorOffset)
| TEST (TextInputModel, GetCursorOffsetSelection)
| TEST (TextInputModel, GetCursorOffsetReverseSelection)
| TEST (TextRange, TextRangeFromPositionZero)
| TEST (TextRange, TextRangeFromPositionNonZero)
| TEST (TextRange, TextRangeFromRange)
| TEST (TextRange, TextRangeFromReversedRange)
| TEST (TextRange, SetBase)
| TEST (TextRange, SetBaseReversed)
| TEST (TextRange, SetExtent)
| TEST (TextRange, SetExtentReversed)
| TEST (TextRange, SetStart)
| TEST (TextRange, SetStartReversed)
| TEST (TextRange, SetEnd)
| TEST (TextRange, SetEndReversed)
| TEST (TextRange, ContainsPreStartPosition)
| TEST (TextRange, ContainsStartPosition)
| TEST (TextRange, ContainsMiddlePosition)
| TEST (TextRange, ContainsEndPosition)
| TEST (TextRange, ContainsPostEndPosition)
| TEST (TextRange, ContainsPreStartPositionReversed)
| TEST (TextRange, ContainsStartPositionReversed)
| TEST (TextRange, ContainsMiddlePositionReversed)
| TEST (TextRange, ContainsEndPositionReversed)
| TEST (TextRange, ContainsPostEndPositionReversed)
| TEST (TextRange, ContainsRangePreStartPosition)
| TEST (TextRange, ContainsRangeSpanningStartPosition)
| TEST (TextRange, ContainsRangeStartPosition)
| TEST (TextRange, ContainsRangeMiddlePosition)
| TEST (TextRange, ContainsRangeEndPosition)
| TEST (TextRange, ContainsRangeSpanningEndPosition)
| TEST (TextRange, ContainsRangePostEndPosition)
| TEST (TextRange, ContainsRangePreStartPositionReversed)
| TEST (TextRange, ContainsRangeSpanningStartPositionReversed)
| TEST (TextRange, ContainsRangeStartPositionReversed)
| TEST (TextRange, ContainsRangeMiddlePositionReversed)
| TEST (TextRange, ContainsRangeSpanningEndPositionReversed)
| TEST (TextRange, ContainsRangeEndPositionReversed)
| TEST (TextRange, ContainsRangePostEndPositionReversed)
| TEST (TextRange, ReversedForwardRange)
| TEST (TextRange, ReversedCollapsedRange)
| TEST (TextRange, ReversedReversedRange)

## Variables
constexpr uint32_t | kWindowFrameBufferID = 0
constexpr int | kShift = 1 << 0
constexpr int | kControl = 1 << 3
constexpr int | kScanCodeShiftLeft = 0x2a
constexpr int | kScanCodeShiftRight = 0x36
constexpr int | kKeyCodeShiftLeft = 0xa0
constexpr int | kScanCodeControlLeft = 0x1d
constexpr int | kScanCodeControlRight = 0xe01d
constexpr int | kKeyCodeControlLeft = 0xa2
constexpr int | kDeadKeyCharMask = 0x80000000
static constexpr const char * | kExitTypeNames []
constexpr const wchar_t | kGetPreferredLanguageRegKey []
constexpr const wchar_t | kGetPreferredLanguageRegValue [] = L"Languages"
constexpr int | kHasScrollingAction

## Typedef Documentation

## ◆ AccessibilityNodeId

typedef ui::AXNode::AXID flutter::AccessibilityNodeId

Definition at line 15 of file flutter_platform_node_delegate.h.

## ◆ BinaryMessageHandler

typedef std::function< void(const uint8_t* message, size_t message_size, BinaryReply reply)> flutter::BinaryMessageHandler

Definition at line 24 of file binary_messenger.h.

## ◆ BinaryReply

typedef std::function<void(const uint8_t* reply, size_t reply_size)> flutter::BinaryReply

Definition at line 17 of file binary_messenger.h.

## ◆ CurrentTimeProc

typedef uint64_t(* flutter::CurrentTimeProc) ()

Definition at line 21 of file task_runner.h.

## ◆ EncodableList

using flutter::EncodableList = typedef std::vector<EncodableValue>

Definition at line 94 of file encodable_value.h.

## ◆ EncodableMap

using flutter::EncodableMap = typedef std::map<EncodableValue, EncodableValue>

Definition at line 95 of file encodable_value.h.

## ◆ glBindTextureProc

typedef void(* flutter::glBindTextureProc) (GLenum target, GLuint texture)

Definition at line 17 of file external_texture.h.

## ◆ glDeleteTexturesProc

typedef void(* flutter::glDeleteTexturesProc) (GLsizei n, const GLuint *textures)

Definition at line 16 of file external_texture.h.

## ◆ glGenTexturesProc

typedef void(* flutter::glGenTexturesProc) (GLsizei n, GLuint *textures)

Definition at line 15 of file external_texture.h.

## ◆ glTexImage2DProc

typedef void(* flutter::glTexImage2DProc) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data)

Definition at line 19 of file external_texture.h.

## ◆ glTexParameteriProc

typedef void(* flutter::glTexParameteriProc) (GLenum target, GLenum pname, GLint param)

Definition at line 18 of file external_texture.h.

## ◆ MessageHandler

template<typename T >

using flutter::MessageHandler = typedef std::function<void(const T& message, const MessageReply<T>& reply)>

Definition at line 31 of file basic_message_channel.h.

## ◆ MessageReply

template<typename T >

using flutter::MessageReply = typedef std::function<void(const T& reply)>

Definition at line 23 of file basic_message_channel.h.

## ◆ MethodCallHandler

template<typename T >

using flutter::MethodCallHandler = typedef std::function<void(const MethodCall<T>& call, std::unique_ptr<MethodResult<T> > result)>

Definition at line 28 of file method_channel.h.

## ◆ PlatformWindow

using flutter::PlatformWindow = typedef HWND

Definition at line 40 of file window_binding_handler.h.

## ◆ ResultHandlerError

template<typename T >

using flutter::ResultHandlerError = typedef std::function<void(const std::string& error_code, const std::string& error_message, const T* error_details)>

Definition at line 24 of file method_result_functions.h.

## ◆ ResultHandlerNotImplemented

template<typename T >

using flutter::ResultHandlerNotImplemented = typedef std::function<void()>

Definition at line 26 of file method_result_functions.h.

## ◆ ResultHandlerSuccess

template<typename T >

using flutter::ResultHandlerSuccess = typedef std::function<void(const T* result)>

Definition at line 20 of file method_result_functions.h.

## ◆ StreamHandlerCancel

template<typename T >

using flutter::StreamHandlerCancel = typedef std::function<std::unique_ptr<StreamHandlerError<T> >(const T* arguments)>

Definition at line 27 of file event_stream_handler_functions.h.

## ◆ StreamHandlerListen

template<typename T >

using flutter::StreamHandlerListen = typedef std::function<std::unique_ptr<StreamHandlerError<T> >( const T* arguments, std::unique_ptr<EventSink<T> >&& events)>

Definition at line 23 of file event_stream_handler_functions.h.

## ◆ TextureVariant

typedef std::variant<PixelBufferTexture, GpuSurfaceTexture> flutter::TextureVariant

Definition at line 79 of file texture_registrar.h.

## ◆ UniqueAotDataPtr

using flutter::UniqueAotDataPtr = typedef std::unique_ptr<_FlutterEngineAOTData, FlutterEngineCollectAOTDataFnPtr>

Definition at line 18 of file flutter_project_bundle.h.

## ◆ WindowProcDelegate

using flutter::WindowProcDelegate = typedef std::function<std::optional< LRESULT>(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)>

Definition at line 24 of file plugin_registrar_windows.h.

## ◆ WindowsRenderTarget

using flutter::WindowsRenderTarget = typedef std::variant<HWND>

Definition at line 44 of file window_binding_handler.h.

## Enumeration Type Documentation

## ◆ AppExitType

enum flutter::AppExitType
| strong

Enumerator
required |
cancelable |

Definition at line 27 of file platform_handler.h.

27 {
28 required,
29 cancelable,
30 };

## ◆ AppLifecycleState

enum flutter::AppLifecycleState
| strong

These constants describe the possible lifecycle states of the application. They must be kept up to date with changes in the framework's AppLifecycleState enum. They are passed to the embedder's |SetLifecycleState| function.

States not supported on a platform will be synthesized by the framework when transitioning between states which are supported, so that all implementations share the same state machine.

Here is the state machine:

    +-----------+                               +-----------+
    | detached  |------------------------------>|  resumed  |
    +-----------+                               +-----------+
         ^                                              ^
         |                                              |
         |                                              v
    +-----------+        +--------------+       +-----------+
    | paused    |<------>|    hidden    |<----->|  inactive |
    +-----------+        +--------------+       +-----------+

Enumerator
kDetached | Corresponds to the Framework's AppLifecycleState.detached: The initial state of the state machine. On Android and iOS, also the final state of the state machine when all views are detached. Other platforms do not enter this state again after initially leaving it.
kResumed | Corresponds to the Framework's AppLifecycleState.resumed: The nominal "running" state of the application. The application is visible, has input focus, and is running.
kInactive | Corresponds to the Framework's AppLifecycleState.inactive: At least one view of the application is visible, but none have input focus. The application is otherwise running normally.
kHidden | Corresponds to the Framework's AppLifecycleState.hidden: All views of an application are hidden, either because the application is being stopped (on iOS and Android), or because it is being minimized or on a desktop that is no longer visible (on desktop), or on a tab that is no longer visible (on web).
kPaused | Corresponds to the Framework's AppLifecycleState.paused: The application is not running, and can be detached or started again at any time. This state is typically only entered into on iOS and Android.

Definition at line 32 of file app_lifecycle_state.h.

32 {
33 /**
34 * Corresponds to the Framework's AppLifecycleState.detached: The initial
35 * state of the state machine. On Android and iOS, also the final state of the
36 * state machine when all views are detached. Other platforms do not enter
37 * this state again after initially leaving it.
38 */
39 kDetached,
40
41 /**
42 * Corresponds to the Framework's AppLifecycleState.resumed: The nominal
43 * "running" state of the application. The application is visible, has input
44 * focus, and is running.
45 */
46 kResumed,
47
48 /**
49 * Corresponds to the Framework's AppLifecycleState.inactive: At least one
50 * view of the application is visible, but none have input focus. The
51 * application is otherwise running normally.
52 */
53 kInactive,
54
55 /**
56 * Corresponds to the Framework's AppLifecycleState.hidden: All views of an
57 * application are hidden, either because the application is being stopped (on
58 * iOS and Android), or because it is being minimized or on a desktop that is
59 * no longer visible (on desktop), or on a tab that is no longer visible (on
60 * web).
61 */
62 kHidden,
63
64 /**
65 * Corresponds to the Framework's AppLifecycleState.paused: The application is
66 * not running, and can be detached or started again at any time. This state
67 * is typically only entered into on iOS and Android.
68 */
69 kPaused,
70 };

## ◆ PlatformProvidedMenu

enum flutter::PlatformProvidedMenu
| strong

Enumerator
kAbout |
kQuit |
kServicesSubmenu |
kHide |
kHideOtherApplications |
kShowAllApplications |
kStartSpeaking |
kStopSpeaking |
kToggleFullScreen |
kMinimizeWindow |
kZoomWindow |
kArrangeWindowsInFront |

Definition at line 12 of file platform_provided_menu.h.

12 {
13 // orderFrontStandardAboutPanel macOS provided menu
14 kAbout,
15
16 // terminate macOS provided menu
17 kQuit,
18
19 // Services macOS provided submenu.
20 kServicesSubmenu,
21
22 // hide macOS provided menu
23 kHide,
24
25 // hideOtherApplications macOS provided menu
26 kHideOtherApplications,
27
28 // unhideAllApplications macOS provided menu
29 kShowAllApplications,
30
31 // startSpeaking macOS provided menu
32 kStartSpeaking,
33
34 // stopSpeaking macOS provided menu
35 kStopSpeaking,
36
37 // toggleFullScreen macOS provided menu
38 kToggleFullScreen,
39
40 // performMiniaturize macOS provided menu
41 kMinimizeWindow,
42
43 // performZoom macOS provided menu
44 kZoomWindow,
45
46 // arrangeInFront macOS provided menu
47 kArrangeWindowsInFront,
48 };

## ◆ WindowStateEvent

enum flutter::WindowStateEvent
| strong

An event representing a change in window state that may update the.

Enumerator
kShow |
kHide |
kFocus |
kUnfocus |

Definition at line 24 of file windows_lifecycle_manager.h.

24 {
25 kShow,
26 kHide,
27 kFocus,
28 kUnfocus,
29 };

## Function Documentation

## ◆ AppLifecycleStateToString()

constexpr const char* flutter::AppLifecycleStateToString | ( | AppLifecycleState | state | ) |
| constexpr

Definition at line 72 of file app_lifecycle_state.h.

72 {
73 switch (state) {
74 case AppLifecycleState::kDetached:
75 return "AppLifecycleState.detached";
76 case AppLifecycleState::kResumed:
77 return "AppLifecycleState.resumed";
78 case AppLifecycleState::kInactive:
79 return "AppLifecycleState.inactive";
80 case AppLifecycleState::kHidden:
81 return "AppLifecycleState.hidden";
82 case AppLifecycleState::kPaused:
83 return "AppLifecycleState.paused";
84 }
85 }

References kDetached, kHidden, kInactive, kPaused, and kResumed.

## ◆ CheckEncodeDecode()

static void flutter::CheckEncodeDecode | ( | const EncodableValue & | value,
|  | const std::vector< uint8_t > & | expected_encoding,
|  | const StandardCodecSerializer * | serializer = `nullptr`,
|  | const std::function< bool(const EncodableValue &a, const EncodableValue &b)> & | custom_comparator = `nullptr`
| ) |  |
| static

Definition at line 37 of file standard_message_codec_unittests.cc.

42 {
43 const StandardMessageCodec& codec =
44 StandardMessageCodec::GetInstance(serializer);
45 auto encoded = codec.EncodeMessage(value);
46 ASSERT_TRUE(encoded);
47 EXPECT_EQ(*encoded, expected_encoding);
48
49 auto decoded = codec.DecodeMessage(*encoded);
50 if (custom_comparator) {
51 EXPECT_TRUE(custom_comparator(value, *decoded));
52 } else {
53 EXPECT_EQ(value, *decoded);
54 }
55 }

References flutter::MessageCodec< T >::DecodeMessage(), flutter::MessageCodec< T >::EncodeMessage(), and flutter::StandardMessageCodec::GetInstance().

Referenced by TEST().

## ◆ CheckEncodeDecodeWithEncodePrefix()

static void flutter::CheckEncodeDecodeWithEncodePrefix | ( | const EncodableValue & | value,
|  | const std::vector< uint8_t > & | expected_encoding_prefix,
|  | size_t | expected_encoding_length
| ) |  |
| static

Definition at line 62 of file standard_message_codec_unittests.cc.

65 {
66 EXPECT_TRUE(std::holds_alternative<EncodableMap>(value));
67 const StandardMessageCodec& codec = StandardMessageCodec::GetInstance();
68 auto encoded = codec.EncodeMessage(value);
69 ASSERT_TRUE(encoded);
70
71 EXPECT_EQ(encoded->size(), expected_encoding_length);
72 ASSERT_GT(encoded->size(), expected_encoding_prefix.size());
73 EXPECT_TRUE(std::equal(
74 encoded->begin(), encoded->begin() + expected_encoding_prefix.size(),
75 expected_encoding_prefix.begin(), expected_encoding_prefix.end()));
76
77 auto decoded = codec.DecodeMessage(*encoded);
78
79 EXPECT_EQ(value, *decoded);
80 }

References flutter::MessageCodec< T >::DecodeMessage(), flutter::MessageCodec< T >::EncodeMessage(), and flutter::StandardMessageCodec::GetInstance().

Referenced by TEST().

## ◆ ConvertChar32ToUtf8()

std::string flutter::ConvertChar32ToUtf8 | ( | char32_t | ch | ) |

Definition at line 38 of file keyboard_key_embedder_handler.cc.

38 {
39 std::string result;
40 FML_DCHECK(0 <= ch && ch <= 0x10FFFF) << "Character out of range";
41 if (ch <= 0x007F) {
42 result.push_back(ch);
43 } else if (ch <= 0x07FF) {
44 result.push_back(0b11000000 + _GetBit(ch, 11, 6));
45 result.push_back(0b10000000 + _GetBit(ch, 6, 0));
46 } else if (ch <= 0xFFFF) {
47 result.push_back(0b11100000 + _GetBit(ch, 16, 12));
48 result.push_back(0b10000000 + _GetBit(ch, 12, 6));
49 result.push_back(0b10000000 + _GetBit(ch, 6, 0));
50 } else {
51 result.push_back(0b11110000 + _GetBit(ch, 21, 18));
52 result.push_back(0b10000000 + _GetBit(ch, 18, 12));
53 result.push_back(0b10000000 + _GetBit(ch, 12, 6));
54 result.push_back(0b10000000 + _GetBit(ch, 6, 0));
55 }
56 return result;
57 }

Referenced by flutter::testing::TEST().

## ◆ EncodeUtf16()

std::u16string flutter::EncodeUtf16 | ( | char32_t | character | ) |

Definition at line 11 of file keyboard_utils.cc.

11 {
12 // Algorithm: https://en.wikipedia.org/wiki/UTF-16#Description
13 std::u16string result;
14 // Invalid value.
15 FML_DCHECK(!(character >= 0xD800 && character <= 0xDFFF) &&
16 !(character > 0x10FFFF));
17 if ((character >= 0xD800 && character <= 0xDFFF) || (character > 0x10FFFF)) {
18 return result;
19 }
20 if (character <= 0xD7FF || (character >= 0xE000 && character <= 0xFFFF)) {
21 result.push_back((char16_t)character);
22 return result;
23 }
24 uint32_t remnant = character - 0x10000;
25 result.push_back((remnant >> 10) + 0xD800);
26 result.push_back((remnant & 0x3FF) + 0xDC00);
27 return result;
28 }

References character.

Referenced by flutter::testing::TEST().

## ◆ GetCursorFromBuffer()

HCURSOR flutter::GetCursorFromBuffer | ( | const std::vector< uint8_t > & | buffer,
|  | double | hot_x,
|  | double | hot_y,
|  | int | width,
|  | int | height
| ) |  |

Definition at line 199 of file cursor_handler.cc.

203 {
204 HCURSOR cursor = nullptr;
205 HDC display_dc = GetDC(NULL);
206 // Flutter should returns rawBGRA, which has 8bits * 4channels.
207 BITMAPINFO bmi;
208 memset(&bmi, 0, sizeof(bmi));
209 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
210 bmi.bmiHeader.biWidth = width;
211 bmi.bmiHeader.biHeight = -height;
212 bmi.bmiHeader.biPlanes = 1;
213 bmi.bmiHeader.biBitCount = 32;
214 bmi.bmiHeader.biCompression = BI_RGB;
215 bmi.bmiHeader.biSizeImage = width * height * 4;
216 // Create the pixmap DIB section
217 uint8_t* pixels = 0;
218 HBITMAP bitmap =
219 CreateDIBSection(display_dc, &bmi, DIB_RGB_COLORS, (void**)&pixels, 0, 0);
220 ReleaseDC(0, display_dc);
221 if (!bitmap || !pixels) {
222 return nullptr;
223 }
224 int bytes_per_line = width * 4;
225 for (int y = 0; y < height; ++y) {
226 memcpy(pixels + y * bytes_per_line, &buffer[bytes_per_line * y],
227 bytes_per_line);
228 }
229 HBITMAP mask;
230 GetMaskBitmaps(bitmap, mask);
231 ICONINFO icon_info;
232 icon_info.fIcon = 0;
233 icon_info.xHotspot = hot_x;
234 icon_info.yHotspot = hot_y;
235 icon_info.hbmMask = mask;
236 icon_info.hbmColor = bitmap;
237 cursor = CreateIconIndirect(&icon_info);
238 DeleteObject(mask);
239 DeleteObject(bitmap);
240 return cursor;
241 }

References GetMaskBitmaps().

## ◆ GetDpiForHWND()

UINT flutter::GetDpiForHWND | ( | HWND | hwnd | ) |

Returns the DPI for |hwnd|. Supports all DPI awareness modes, and is backward compatible down to Windows Vista. If |hwnd| is nullptr, returns the DPI for the primary monitor. If Per-Monitor DPI awareness is not available, returns the system's DPI.

Definition at line 130 of file dpi_utils.cc.

130 {
131 return GetHelper()->GetDpiForWindow(hwnd);
132 }

Referenced by FlutterDesktopGetDpiForHWND(), flutter::FlutterWindow::FlutterWindow(), flutter::FlutterWindow::HandleMessage(), and flutter::testing::TEST().

## ◆ GetDpiForMonitor()

UINT flutter::GetDpiForMonitor | ( | HMONITOR | monitor | ) |

Returns the DPI of a given monitor. Defaults to 96 if the API is not available.

Definition at line 134 of file dpi_utils.cc.

134 {
135 return GetHelper()->GetDpiForMonitor(monitor);
136 }

Referenced by FlutterDesktopGetDpiForMonitor(), and flutter::testing::TEST().

## ◆ GetExecutableDirectory()

std::filesystem::path flutter::GetExecutableDirectory | ( |  | ) |

Definition at line 16 of file path_utils.cc.

16 {
17 #if defined(_WIN32)
18 wchar_t buffer[MAX_PATH];
19 if (GetModuleFileName(nullptr, buffer, MAX_PATH) == 0) {
20 return std::filesystem::path();
21 }
22 std::filesystem::path executable_path(buffer);
23 return executable_path.remove_filename();
24 #elif defined(__linux__)
25 char buffer[PATH_MAX + 1];
26 ssize_t length = readlink("/proc/self/exe", buffer, sizeof(buffer));
27 if (length > PATH_MAX) {
28 return std::filesystem::path();
29 }
30 std::filesystem::path executable_path(std::string(buffer, length));
31 return executable_path.remove_filename();
32 #else
33 return std::filesystem::path();
34 #endif
35 }

Referenced by flutter::FlutterProjectBundle::FlutterProjectBundle(), and TEST().

## ◆ GetMaskBitmaps()

void flutter::GetMaskBitmaps | ( | HBITMAP | bitmap,
|  | HBITMAP & | mask_bitmap
| ) |  |

Definition at line 243 of file cursor_handler.cc.

243 {
244 HDC h_dc = ::GetDC(NULL);
245 HDC h_main_dc = ::CreateCompatibleDC(h_dc);
246 HDC h_and_mask_dc = ::CreateCompatibleDC(h_dc);
247
248 // Get the dimensions of the source bitmap
249 BITMAP bm;
250 ::GetObject(bitmap, sizeof(BITMAP), &bm);
251 mask_bitmap = ::CreateCompatibleBitmap(h_dc, bm.bmWidth, bm.bmHeight);
252
253 // Select the bitmaps to DC
254 HBITMAP h_old_main_bitmap = (HBITMAP)::SelectObject(h_main_dc, bitmap);
255 HBITMAP h_old_and_mask_bitmap =
256 (HBITMAP)::SelectObject(h_and_mask_dc, mask_bitmap);
257
258 // Scan each pixel of the souce bitmap and create the masks
259 COLORREF main_bit_pixel;
260 for (int x = 0; x < bm.bmWidth; ++x) {
261 for (int y = 0; y < bm.bmHeight; ++y) {
262 main_bit_pixel = ::GetPixel(h_main_dc, x, y);
263 if (main_bit_pixel == RGB(0, 0, 0)) {
264 ::SetPixel(h_and_mask_dc, x, y, RGB(255, 255, 255));
265 } else {
266 ::SetPixel(h_and_mask_dc, x, y, RGB(0, 0, 0));
267 }
268 }
269 }
270 ::SelectObject(h_main_dc, h_old_main_bitmap);
271 ::SelectObject(h_and_mask_dc, h_old_and_mask_bitmap);
272
273 ::DeleteDC(h_and_mask_dc);
274 ::DeleteDC(h_main_dc);
275
276 ::ReleaseDC(NULL, h_dc);
277 }

Referenced by GetCursorFromBuffer().

## ◆ GetPreferredLanguageInfo()

std::vector< LanguageInfo > flutter::GetPreferredLanguageInfo | ( | const WindowsProcTable & | windows_proc_table | ) |

Definition at line 15 of file system_utils.cc.

16 {
17 std::vector<std::wstring> languages =
18 GetPreferredLanguages(windows_proc_table);
19 std::vector<LanguageInfo> language_info;
20 language_info.reserve(languages.size());
21
22 for (auto language : languages) {
23 language_info.push_back(ParseLanguageName(language));
24 }
25 return language_info;
26 }

References GetPreferredLanguages(), and ParseLanguageName().

Referenced by flutter::testing::TEST().

## ◆ GetPreferredLanguages()

std::vector< std::wstring > flutter::GetPreferredLanguages | ( | const WindowsProcTable & | windows_proc_table | ) |

Definition at line 45 of file system_utils.cc.

46 {
47 std::vector<std::wstring> languages;
48
49 // Initialize the buffer
50 std::wstring buffer = GetPreferredLanguagesFromMUI(windows_proc_table);
51
52 // Extract the individual languages from the buffer.
53 size_t start = 0;
54 while (true) {
55 // The buffer is terminated by an empty string (i.e., a double null).
56 if (buffer[start] == L'\0') {
57 break;
58 }
59 // Read the next null-terminated language.
60 std::wstring language(buffer.c_str() + start);
61 if (language.empty()) {
62 break;
63 }
64 languages.push_back(language);
65 // Skip past that language and its terminating null in the buffer.
66 start += language.size() + 1;
67 }
68 return languages;
69 }

References GetPreferredLanguagesFromMUI().

Referenced by GetPreferredLanguageInfo(), and flutter::testing::TEST().

## ◆ GetPreferredLanguagesFromMUI()

std::wstring flutter::GetPreferredLanguagesFromMUI | ( | const WindowsProcTable & | windows_proc_table | ) |

Definition at line 28 of file system_utils.cc.

29 {
30 ULONG buffer_size = 0;
31 ULONG count = 0;
32 DWORD flags = MUI_LANGUAGE_NAME | MUI_UI_FALLBACK;
33 if (!windows_proc_table.GetThreadPreferredUILanguages(flags, &count, nullptr,
34 &buffer_size)) {
35 return std::wstring();
36 }
37 std::wstring buffer(buffer_size, '\0');
38 if (!windows_proc_table.GetThreadPreferredUILanguages(
39 flags, &count, buffer.data(), &buffer_size)) {
40 return std::wstring();
41 }
42 return buffer;
43 }

References flutter::WindowsProcTable::GetThreadPreferredUILanguages().

Referenced by GetPreferredLanguages().

## ◆ GetSwitchesFromEnvironment()

std::vector< std::string > flutter::GetSwitchesFromEnvironment | ( |  | ) |

Definition at line 14 of file engine_switches.cc.

14 {
15 std::vector<std::string> switches;
16 // Read engine switches from the environment in debug/profile. If release mode
17 // support is needed in the future, it should likely use a whitelist.
18 #ifndef FLUTTER_RELEASE
19 const char* switch_count_key = "FLUTTER_ENGINE_SWITCHES";
20 const int kMaxSwitchCount = 50;
21 const char* switch_count_string = std::getenv(switch_count_key);
22 if (!switch_count_string) {
23 return switches;
24 }
25 int switch_count = std::min(kMaxSwitchCount, atoi(switch_count_string));
26 for (int i = 1; i <= switch_count; ++i) {
27 std::ostringstream switch_key;
28 switch_key << "FLUTTER_ENGINE_SWITCH_" << i;
29 const char* switch_value = std::getenv(switch_key.str().c_str());
30 if (switch_value) {
31 std::ostringstream switch_value_as_flag;
32 switch_value_as_flag << "--" << switch_value;
33 switches.push_back(switch_value_as_flag.str());
34 } else {
35 std::cerr << switch_count << " keys expected from " << switch_count_key
36 << ", but " << switch_key.str() << " is missing." << std::endl;
37 }
38 }
39 #endif // !FLUTTER_RELEASE
40 return switches;
41 }

Referenced by flutter::FlutterProjectBundle::GetSwitches(), and TEST().

## ◆ GetUserTimeFormat()

std::wstring flutter::GetUserTimeFormat | ( |  | ) |

Definition at line 101 of file system_utils.cc.

101 {
102 // Rather than do the call-allocate-call-free dance, just use a sufficiently
103 // large buffer to handle any reasonable time format string.
104 const int kBufferSize = 100;
105 wchar_t buffer[kBufferSize];
106 if (::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_STIMEFORMAT, buffer,
107 kBufferSize) == 0) {
108 return std::wstring();
109 }
110 return std::wstring(buffer, kBufferSize);
111 }

Referenced by flutter::SettingsPlugin::GetAlwaysUse24HourFormat(), and flutter::testing::TEST().

## ◆ isEasciiPrintable()

static bool flutter::isEasciiPrintable | ( | int | codeUnit | ) |
| static

Definition at line 71 of file keyboard_key_embedder_handler.cc.

71 {
72 return (codeUnit <= 0x7f && codeUnit >= 0x20) ||
73 (codeUnit <= 0xff && codeUnit >= 0x80);
74 }

## ◆ normalizeScancode()

static uint16_t flutter::normalizeScancode | ( | int | windowsScanCode,
|  | bool | extended
| ) |  |
| static

Definition at line 104 of file keyboard_key_embedder_handler.cc.

104 {
105 // In Chromium spec the extended bit is shown as 0xe000 bit,
106 // e.g. PageUp is represented as 0xe049.
107 return (windowsScanCode & 0xff) | (extended ? 0xe000 : 0);
108 }

References extended.

## ◆ NumWindowsForThread()

static int64_t flutter::NumWindowsForThread | ( | const THREADENTRY32 & | thread | ) |
| static

Definition at line 149 of file windows_lifecycle_manager.cc.

149 {
150 int64_t num_windows = 0;
151 ::EnumThreadWindows(
152 thread.th32ThreadID,
153 [](HWND hwnd, LPARAM lparam) {
154 int64_t* windows_ptr = reinterpret_cast<int64_t*>(lparam);
155 if (::GetParent(hwnd) == nullptr) {
156 (*windows_ptr)++;
157 }
158 return *windows_ptr <= 1 ? TRUE : FALSE;
159 },
160 reinterpret_cast<LPARAM>(&num_windows));
161 return num_windows;
162 }

Referenced by flutter::WindowsLifecycleManager::IsLastWindowOfProcess().

## ◆ ParseLanguageName()

LanguageInfo flutter::ParseLanguageName | ( | std::wstring | language_name | ) |

Definition at line 71 of file system_utils.cc.

71 {
72 LanguageInfo info;
73
74 // Split by '-', discarding any suplemental language info (-x-foo).
75 std::vector<std::string> components;
76 std::istringstream stream(fml::WideStringToUtf8(language_name));
77 std::string component;
78 while (getline(stream, component, '-')) {
79 if (component == "x") {
80 break;
81 }
82 components.push_back(component);
83 }
84
85 // Determine which components are which.
86 info.language = components[0];
87 if (components.size() == 3) {
88 info.script = components[1];
89 info.region = components[2];
90 } else if (components.size() == 2) {
91 // A script code will always be four characters long.
92 if (components[1].size() == 4) {
93 info.script = components[1];
94 } else {
95 info.region = components[1];
96 }
97 }
98 return info;
99 }

References flutter::LanguageInfo::language, flutter::LanguageInfo::region, and flutter::LanguageInfo::script.

Referenced by GetPreferredLanguageInfo(), and flutter::testing::TEST().

## ◆ Prefer24HourTime()

bool flutter::Prefer24HourTime | ( | std::wstring | time_format | ) |

Definition at line 113 of file system_utils.cc.

113 {
114 return time_format.find(L"H") != std::wstring::npos;
115 }

Referenced by flutter::SettingsPlugin::GetAlwaysUse24HourFormat(), and flutter::testing::TEST().

## ◆ StringToAppExitType()

static AppExitType flutter::StringToAppExitType | ( | const std::string & | string | ) |
| static

Definition at line 212 of file platform_handler.cc.

212 {
213 if (string.compare(PlatformHandler::kExitTypeRequired) == 0) {
214 return AppExitType::required;
215 } else if (string.compare(PlatformHandler::kExitTypeCancelable) == 0) {
216 return AppExitType::cancelable;
217 }
218 FML_LOG(ERROR) << string << " is not recognized as a valid exit type.";
219 return AppExitType::required;
220 }

References cancelable, flutter::PlatformHandler::kExitTypeCancelable, flutter::PlatformHandler::kExitTypeRequired, and required.

## ◆ TEST() [1/312]

flutter::TEST | ( | BasicMessageChannelTest | ,
|  | Registration |
| ) |  |

Definition at line 46 of file basic_message_channel_unittests.cc.

46 {
47 TestBinaryMessenger messenger;
48 const std::string channel_name("some_channel");
49 const StandardMessageCodec& codec = StandardMessageCodec::GetInstance();
50 BasicMessageChannel channel(&messenger, channel_name, &codec);
51
52 bool callback_called = false;
53 const std::string message_value("hello");
54 channel.SetMessageHandler(
55 [&callback_called, message_value](const auto& message, auto reply) {
56 callback_called = true;
57 // Ensure that the wrapper received a correctly decoded message and a
58 // reply.
59 EXPECT_EQ(std::get<std::string>(message), message_value);
60 EXPECT_NE(reply, nullptr);
61 });
62 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
63 EXPECT_NE(messenger.last_message_handler(), nullptr);
64 // Send a test message to trigger the handler test assertions.
65 auto message = codec.EncodeMessage(EncodableValue(message_value));
66
67 messenger.last_message_handler()(
68 message->data(), message->size(),
69 [](const uint8_t* reply, const size_t reply_size) {});
70 EXPECT_EQ(callback_called, true);
71 }

References flutter::MessageCodec< T >::EncodeMessage(), flutter::StandardMessageCodec::GetInstance(), message, and flutter::BasicMessageChannel< T >::SetMessageHandler().

## ◆ TEST() [2/312]

flutter::TEST | ( | BasicMessageChannelTest | ,
|  | Unregistration |
| ) |  |

Definition at line 74 of file basic_message_channel_unittests.cc.

74 {
75 TestBinaryMessenger messenger;
76 const std::string channel_name("some_channel");
77 BasicMessageChannel channel(&messenger, channel_name,
78 &flutter::StandardMessageCodec::GetInstance());
79
80 channel.SetMessageHandler([](const auto& message, auto reply) {});
81 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
82 EXPECT_NE(messenger.last_message_handler(), nullptr);
83
84 channel.SetMessageHandler(nullptr);
85 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
86 EXPECT_EQ(messenger.last_message_handler(), nullptr);
87 }

References flutter::StandardMessageCodec::GetInstance(), message, and flutter::BasicMessageChannel< T >::SetMessageHandler().

## ◆ TEST() [3/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | Bool |
| ) |  |

Definition at line 18 of file encodable_value_unittests.cc.

18 {
19 EncodableValue value(false);
20
21 EXPECT_FALSE(std::get<bool>(value));
22 value = true;
23 EXPECT_TRUE(std::get<bool>(value));
24 }

## ◆ TEST() [4/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | Comparison |
| ) |  |

Definition at line 177 of file encodable_value_unittests.cc.

177 {
178 EncodableList values = {
179 // Null
180 EncodableValue(),
181 // Bool
182 EncodableValue(true),
183 EncodableValue(false),
184 // Int
185 EncodableValue(-7),
186 EncodableValue(0),
187 EncodableValue(100),
188 // Long
189 EncodableValue(INT64_C(-7)),
190 EncodableValue(INT64_C(0)),
191 EncodableValue(INT64_C(100)),
192 // Double
193 EncodableValue(-7.0),
194 EncodableValue(0.0),
195 EncodableValue(100.0),
196 // String
197 EncodableValue("one"),
198 EncodableValue("two"),
199 // ByteList
200 EncodableValue(std::vector<uint8_t>{0, 1}),
201 EncodableValue(std::vector<uint8_t>{0, 10}),
202 // IntList
203 EncodableValue(std::vector<int32_t>{0, 1}),
204 EncodableValue(std::vector<int32_t>{0, 100}),
205 // LongList
206 EncodableValue(std::vector<int64_t>{0, INT64_C(1)}),
207 EncodableValue(std::vector<int64_t>{0, INT64_C(100)}),
208 // DoubleList
209 EncodableValue(std::vector<double>{0, INT64_C(1)}),
210 EncodableValue(std::vector<double>{0, INT64_C(100)}),
211 // List
212 EncodableValue(EncodableList{EncodableValue(), EncodableValue(true)}),
213 EncodableValue(EncodableList{EncodableValue(), EncodableValue(1.0)}),
214 // Map
215 EncodableValue(EncodableMap{{EncodableValue(), EncodableValue(true)},
216 {EncodableValue(7), EncodableValue(7.0)}}),
217 EncodableValue(
218 EncodableMap{{EncodableValue(), EncodableValue(1.0)},
219 {EncodableValue("key"), EncodableValue("value")}}),
220 // FloatList
221 EncodableValue(std::vector<float>{0, 1}),
222 EncodableValue(std::vector<float>{0, 100}),
223 };
224
225 for (size_t i = 0; i < values.size(); ++i) {
226 const auto& a = values[i];
227 for (size_t j = 0; j < values.size(); ++j) {
228 const auto& b = values[j];
229 if (i == j) {
230 // Identical objects should always be equal.
231 EXPECT_FALSE(a < b);
232 EXPECT_FALSE(b < a);
233 } else {
234 // All other comparisons should be consistent, but the direction doesn't
235 // matter.
236 EXPECT_NE(a < b, b < a) << "Indexes: " << i << ", " << j;
237 }
238 }
239
240 // Copies should always be equal.
241 EncodableValue copy(a);
242 EXPECT_FALSE(a < copy || copy < a);
243 }
244 }

## ◆ TEST() [5/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | CString |
| ) |  |

Definition at line 68 of file encodable_value_unittests.cc.

68 {
69 const char* hello = "Hello, world!";
70 EncodableValue value(hello);
71
72 EXPECT_EQ(std::get<std::string>(value), hello);
73 value = "Goodbye";
74 EXPECT_EQ(std::get<std::string>(value), "Goodbye");
75 }

## ◆ TEST() [6/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | DeepCopy |
| ) |  |

Definition at line 247 of file encodable_value_unittests.cc.

247 {
248 EncodableList original = {
249 EncodableValue(EncodableMap{
250 {EncodableValue(), EncodableValue(std::vector<int32_t>{1, 2, 3})},
251 {EncodableValue(1), EncodableValue(INT64_C(0000))},
252 {EncodableValue("two"), EncodableValue(7)},
253 }),
254 EncodableValue(EncodableList{
255 EncodableValue(),
256 EncodableValue(),
257 EncodableValue(
258 EncodableMap{{EncodableValue("a"), EncodableValue("b")}}),
259 }),
260 };
261
262 EncodableValue copy(original);
263 ASSERT_TRUE(std::holds_alternative<EncodableList>(copy));
264
265 // Spot-check innermost collection values.
266 auto& root_list = std::get<EncodableList>(copy);
267 auto& first_child = std::get<EncodableMap>(root_list[0]);
268 EXPECT_EQ(std::get<int32_t>(first_child[EncodableValue("two")]), 7);
269 auto& second_child = std::get<EncodableList>(root_list[1]);
270 auto& innermost_map = std::get<EncodableMap>(second_child[2]);
271 EXPECT_EQ(std::get<std::string>(innermost_map[EncodableValue("a")]), "b");
272
273 // Modify those values in the original structure.
274 first_child[EncodableValue("two")] = EncodableValue();
275 innermost_map[EncodableValue("a")] = 99;
276
277 // Re-check innermost collection values of the original to ensure that they
278 // haven't changed.
279 first_child = std::get<EncodableMap>(original[0]);
280 EXPECT_EQ(std::get<int32_t>(first_child[EncodableValue("two")]), 7);
281 second_child = std::get<EncodableList>(original[1]);
282 innermost_map = std::get<EncodableMap>(second_child[2]);
283 EXPECT_EQ(std::get<std::string>(innermost_map[EncodableValue("a")]), "b");
284 }

## ◆ TEST() [7/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | Double |
| ) |  |

Definition at line 50 of file encodable_value_unittests.cc.

50 {
51 EncodableValue value(3.14);
52
53 EXPECT_EQ(std::get<double>(value), 3.14);
54 value = std::numeric_limits<double>::max();
55 EXPECT_EQ(std::get<double>(value), std::numeric_limits<double>::max());
56 }

## ◆ TEST() [8/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | DoubleList |
| ) |  |

Definition at line 119 of file encodable_value_unittests.cc.

119 {
120 std::vector<double> data = {-10.0, 2.0};
121 EncodableValue value(data);
122
123 auto& list_value = std::get<std::vector<double>>(value);
124 list_value.push_back(std::numeric_limits<double>::max());
125 EXPECT_EQ(list_value[0], -10.0);
126 EXPECT_EQ(list_value[1], 2.0);
127
128 ASSERT_EQ(list_value.size(), 3u);
129 EXPECT_EQ(data.size(), 2u);
130 EXPECT_EQ(list_value[2], std::numeric_limits<double>::max());
131 }

## ◆ TEST() [9/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | Int |
| ) |  |

Definition at line 26 of file encodable_value_unittests.cc.

26 {
27 EncodableValue value(42);
28
29 EXPECT_EQ(std::get<int32_t>(value), 42);
30 value = std::numeric_limits<int32_t>::max();
31 EXPECT_EQ(std::get<int32_t>(value), std::numeric_limits<int32_t>::max());
32 }

## ◆ TEST() [10/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | Int32List |
| ) |  |

Definition at line 91 of file encodable_value_unittests.cc.

91 {
92 std::vector<int32_t> data = {-10, 2};
93 EncodableValue value(data);
94
95 auto& list_value = std::get<std::vector<int32_t>>(value);
96 list_value.push_back(std::numeric_limits<int32_t>::max());
97 EXPECT_EQ(list_value[0], -10);
98 EXPECT_EQ(list_value[1], 2);
99
100 ASSERT_EQ(list_value.size(), 3u);
101 EXPECT_EQ(data.size(), 2u);
102 EXPECT_EQ(list_value[2], std::numeric_limits<int32_t>::max());
103 }

## ◆ TEST() [11/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | Int64List |
| ) |  |

Definition at line 105 of file encodable_value_unittests.cc.

105 {
106 std::vector<int64_t> data = {-10, 2};
107 EncodableValue value(data);
108
109 auto& list_value = std::get<std::vector<int64_t>>(value);
110 list_value.push_back(std::numeric_limits<int64_t>::max());
111 EXPECT_EQ(list_value[0], -10);
112 EXPECT_EQ(list_value[1], 2);
113
114 ASSERT_EQ(list_value.size(), 3u);
115 EXPECT_EQ(data.size(), 2u);
116 EXPECT_EQ(list_value[2], std::numeric_limits<int64_t>::max());
117 }

## ◆ TEST() [12/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | List |
| ) |  |

Definition at line 133 of file encodable_value_unittests.cc.

133 {
134 EncodableList encodables = {
135 EncodableValue(1),
136 EncodableValue(2.0),
137 EncodableValue("Three"),
138 };
139 EncodableValue value(encodables);
140
141 auto& list_value = std::get<EncodableList>(value);
142 EXPECT_EQ(std::get<int32_t>(list_value[0]), 1);
143 EXPECT_EQ(std::get<double>(list_value[1]), 2.0);
144 EXPECT_EQ(std::get<std::string>(list_value[2]), "Three");
145
146 // Ensure that it's a modifiable copy of the original array.
147 list_value.push_back(EncodableValue(true));
148 ASSERT_EQ(list_value.size(), 4u);
149 EXPECT_EQ(encodables.size(), 3u);
150 EXPECT_EQ(std::get<bool>(std::get<EncodableList>(value)[3]), true);
151 }

## ◆ TEST() [13/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | Long |
| ) |  |

Definition at line 42 of file encodable_value_unittests.cc.

42 {
43 EncodableValue value(INT64_C(42));
44
45 EXPECT_EQ(std::get<int64_t>(value), 42);
46 value = std::numeric_limits<int64_t>::max();
47 EXPECT_EQ(std::get<int64_t>(value), std::numeric_limits<int64_t>::max());
48 }

## ◆ TEST() [14/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | LongValue |
| ) |  |

Definition at line 35 of file encodable_value_unittests.cc.

35 {
36 const EncodableValue int_value(std::numeric_limits<int32_t>::max());
37 EXPECT_EQ(int_value.LongValue(), std::numeric_limits<int32_t>::max());
38 const EncodableValue long_value(std::numeric_limits<int64_t>::max());
39 EXPECT_EQ(long_value.LongValue(), std::numeric_limits<int64_t>::max());
40 }

References flutter::EncodableValue::LongValue().

## ◆ TEST() [15/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | Map |
| ) |  |

Definition at line 153 of file encodable_value_unittests.cc.

153 {
154 EncodableMap encodables = {
155 {EncodableValue(), EncodableValue(std::vector<int32_t>{1, 2, 3})},
156 {EncodableValue(1), EncodableValue(INT64_C(10000))},
157 {EncodableValue("two"), EncodableValue(7)},
158 };
159 EncodableValue value(encodables);
160
161 auto& map_value = std::get<EncodableMap>(value);
162 EXPECT_EQ(
163 std::holds_alternative<std::vector<int32_t>>(map_value[EncodableValue()]),
164 true);
165 EXPECT_EQ(std::get<int64_t>(map_value[EncodableValue(1)]), INT64_C(10000));
166 EXPECT_EQ(std::get<int32_t>(map_value[EncodableValue("two")]), 7);
167
168 // Ensure that it's a modifiable copy of the original map.
169 map_value[EncodableValue(true)] = EncodableValue(false);
170 ASSERT_EQ(map_value.size(), 4u);
171 EXPECT_EQ(encodables.size(), 3u);
172 EXPECT_EQ(std::get<bool>(map_value[EncodableValue(true)]), false);
173 }

## ◆ TEST() [16/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | Null |
| ) |  |

Definition at line 13 of file encodable_value_unittests.cc.

13 {
14 EncodableValue value;
15 value.IsNull();
16 }

References flutter::EncodableValue::IsNull().

## ◆ TEST() [17/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | String |
| ) |  |

Definition at line 58 of file encodable_value_unittests.cc.

58 {
59 std::string hello("Hello, world!");
60 EncodableValue value(hello);
61
62 EXPECT_EQ(std::get<std::string>(value), hello);
63 value = std::string("Goodbye");
64 EXPECT_EQ(std::get<std::string>(value), "Goodbye");
65 }

## ◆ TEST() [18/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | TypeIndexesCorrect |
| ) |  |

Definition at line 301 of file encodable_value_unittests.cc.

301 {
302 // Null
303 EXPECT_EQ(EncodableValue().index(), 0u);
304 // Bool
305 EXPECT_EQ(EncodableValue(true).index(), 1u);
306 // Int32
307 EXPECT_EQ(EncodableValue(100).index(), 2u);
308 // Int64
309 EXPECT_EQ(EncodableValue(INT64_C(100)).index(), 3u);
310 // Double
311 EXPECT_EQ(EncodableValue(7.0).index(), 4u);
312 // String
313 EXPECT_EQ(EncodableValue("one").index(), 5u);
314 // ByteList
315 EXPECT_EQ(EncodableValue(std::vector<uint8_t>()).index(), 6u);
316 // IntList
317 EXPECT_EQ(EncodableValue(std::vector<int32_t>()).index(), 7u);
318 // LongList
319 EXPECT_EQ(EncodableValue(std::vector<int64_t>()).index(), 8u);
320 // DoubleList
321 EXPECT_EQ(EncodableValue(std::vector<double>()).index(), 9u);
322 // List
323 EXPECT_EQ(EncodableValue(EncodableList()).index(), 10u);
324 // Map
325 EXPECT_EQ(EncodableValue(EncodableMap()).index(), 11u);
326 // Custom type
327 TestCustomValue customValue;
328 EXPECT_EQ(((EncodableValue)CustomEncodableValue(customValue)).index(), 12u);
329 // FloatList
330 EXPECT_EQ(EncodableValue(std::vector<float>()).index(), 13u);
331 } // namespace flutter

## ◆ TEST() [19/312]

flutter::TEST | ( | EncodableValueTest | ,
|  | UInt8List |
| ) |  |

Definition at line 77 of file encodable_value_unittests.cc.

77 {
78 std::vector<uint8_t> data = {0, 2};
79 EncodableValue value(data);
80
81 auto& list_value = std::get<std::vector<uint8_t>>(value);
82 list_value.push_back(std::numeric_limits<uint8_t>::max());
83 EXPECT_EQ(list_value[0], 0);
84 EXPECT_EQ(list_value[1], 2);
85
86 ASSERT_EQ(list_value.size(), 3u);
87 EXPECT_EQ(data.size(), 2u);
88 EXPECT_EQ(list_value[2], std::numeric_limits<uint8_t>::max());
89 }

## ◆ TEST() [20/312]

flutter::TEST | ( | EventChannelTest | ,
|  | Cancel |
| ) |  |

Definition at line 102 of file event_channel_unittests.cc.

102 {
103 TestBinaryMessenger messenger;
104 const std::string channel_name("some_channel");
105 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
106 EventChannel channel(&messenger, channel_name, &codec);
107
108 bool on_listen_called = false;
109 bool on_cancel_called = false;
110 auto handler = std::make_unique<StreamHandlerFunctions<>>(
111 [&on_listen_called](const EncodableValue* arguments,
112 std::unique_ptr<EventSink<>>&& events)
113 -> std::unique_ptr<StreamHandlerError<>> {
114 on_listen_called = true;
115 return nullptr;
116 },
117 [&on_cancel_called](const EncodableValue* arguments)
118 -> std::unique_ptr<StreamHandlerError<>> {
119 on_cancel_called = true;
120 return nullptr;
121 });
122 channel.SetStreamHandler(std::move(handler));
123 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
124 EXPECT_NE(messenger.last_message_handler(), nullptr);
125
126 // Send test listen message.
127 MethodCall<> call_listen("listen", nullptr);
128 auto message = codec.EncodeMethodCall(call_listen);
129 messenger.last_message_handler()(
130 message->data(), message->size(),
131 [](const uint8_t* reply, const size_t reply_size) {});
132 EXPECT_EQ(on_listen_called, true);
133
134 // Send test cancel message.
135 MethodCall<> call_cancel("cancel", nullptr);
136 message = codec.EncodeMethodCall(call_cancel);
137 messenger.last_message_handler()(
138 message->data(), message->size(),
139 [](const uint8_t* reply, const size_t reply_size) {});
140
141 // Check results.
142 EXPECT_EQ(on_cancel_called, true);
143 }

References flutter::MethodCodec< T >::EncodeMethodCall(), flutter::StandardMethodCodec::GetInstance(), message, and flutter::EventChannel< T >::SetStreamHandler().

## ◆ TEST() [21/312]

flutter::TEST | ( | EventChannelTest | ,
|  | HandlerOutlivesEventChannel |
| ) |  |

Definition at line 232 of file event_channel_unittests.cc.

232 {
233 TestBinaryMessenger messenger;
234 const std::string channel_name("some_channel");
235 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
236
237 bool on_listen_called = false;
238 bool on_cancel_called = false;
239 {
240 EventChannel channel(&messenger, channel_name, &codec);
241 auto handler = std::make_unique<StreamHandlerFunctions<>>(
242 [&on_listen_called](const EncodableValue* arguments,
243 std::unique_ptr<EventSink<>>&& events)
244 -> std::unique_ptr<StreamHandlerError<>> {
245 on_listen_called = true;
246 return nullptr;
247 },
248 [&on_cancel_called](const EncodableValue* arguments)
249 -> std::unique_ptr<StreamHandlerError<>> {
250 on_cancel_called = true;
251 return nullptr;
252 });
253 channel.SetStreamHandler(std::move(handler));
254 }
255
256 // The event channel was destroyed but the handler should still be alive.
257 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
258 EXPECT_NE(messenger.last_message_handler(), nullptr);
259
260 // Send test listen message.
261 MethodCall<> call_listen("listen", nullptr);
262 auto message = codec.EncodeMethodCall(call_listen);
263 messenger.last_message_handler()(
264 message->data(), message->size(),
265 [](const uint8_t* reply, const size_t reply_size) {});
266 EXPECT_EQ(on_listen_called, true);
267
268 // Send test cancel message.
269 MethodCall<> call_cancel("cancel", nullptr);
270 message = codec.EncodeMethodCall(call_cancel);
271 messenger.last_message_handler()(
272 message->data(), message->size(),
273 [](const uint8_t* reply, const size_t reply_size) {});
274 EXPECT_EQ(on_cancel_called, true);
275 }

References flutter::MethodCodec< T >::EncodeMethodCall(), flutter::StandardMethodCodec::GetInstance(), message, and flutter::EventChannel< T >::SetStreamHandler().

## ◆ TEST() [22/312]

flutter::TEST | ( | EventChannelTest | ,
|  | ListenNotCancel |
| ) |  |

Definition at line 146 of file event_channel_unittests.cc.

146 {
147 TestBinaryMessenger messenger;
148 const std::string channel_name("some_channel");
149 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
150 EventChannel channel(&messenger, channel_name, &codec);
151
152 bool on_listen_called = false;
153 bool on_cancel_called = false;
154 auto handler = std::make_unique<StreamHandlerFunctions<>>(
155 [&on_listen_called](const EncodableValue* arguments,
156 std::unique_ptr<EventSink<>>&& events)
157 -> std::unique_ptr<StreamHandlerError<>> {
158 on_listen_called = true;
159 return nullptr;
160 },
161 [&on_cancel_called](const EncodableValue* arguments)
162 -> std::unique_ptr<StreamHandlerError<>> {
163 on_cancel_called = true;
164 return nullptr;
165 });
166 channel.SetStreamHandler(std::move(handler));
167 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
168 EXPECT_NE(messenger.last_message_handler(), nullptr);
169
170 // Send test listen message.
171 MethodCall<> call_listen("listen", nullptr);
172 auto message = codec.EncodeMethodCall(call_listen);
173 messenger.last_message_handler()(
174 message->data(), message->size(),
175 [](const uint8_t* reply, const size_t reply_size) {});
176
177 // Check results.
178 EXPECT_EQ(on_listen_called, true);
179 EXPECT_EQ(on_cancel_called, false);
180 }

References flutter::MethodCodec< T >::EncodeMethodCall(), flutter::StandardMethodCodec::GetInstance(), message, and flutter::EventChannel< T >::SetStreamHandler().

## ◆ TEST() [23/312]

flutter::TEST | ( | EventChannelTest | ,
|  | Registration |
| ) |  |

Definition at line 49 of file event_channel_unittests.cc.

49 {
50 TestBinaryMessenger messenger;
51 const std::string channel_name("some_channel");
52 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
53 EventChannel channel(&messenger, channel_name, &codec);
54
55 bool on_listen_called = false;
56 auto handler = std::make_unique<StreamHandlerFunctions<>>(
57 [&on_listen_called](const EncodableValue* arguments,
58 std::unique_ptr<EventSink<>>&& events)
59 -> std::unique_ptr<StreamHandlerError<>> {
60 on_listen_called = true;
61 return nullptr;
62 },
63 [](const EncodableValue* arguments)
64 -> std::unique_ptr<StreamHandlerError<>> { return nullptr; });
65 channel.SetStreamHandler(std::move(handler));
66 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
67 EXPECT_NE(messenger.last_message_handler(), nullptr);
68
69 // Send test listen message.
70 MethodCall<> call("listen", nullptr);
71 auto message = codec.EncodeMethodCall(call);
72 messenger.last_message_handler()(
73 message->data(), message->size(),
74 [](const uint8_t* reply, const size_t reply_size) {});
75
76 // Check results.
77 EXPECT_EQ(on_listen_called, true);
78 }

References flutter::MethodCodec< T >::EncodeMethodCall(), flutter::StandardMethodCodec::GetInstance(), message, and flutter::EventChannel< T >::SetStreamHandler().

## ◆ TEST() [24/312]

flutter::TEST | ( | EventChannelTest | ,
|  | ReRegistration |
| ) |  |

Definition at line 186 of file event_channel_unittests.cc.

186 {
187 TestBinaryMessenger messenger;
188 const std::string channel_name("some_channel");
189 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
190 EventChannel channel(&messenger, channel_name, &codec);
191
192 bool on_listen_called = false;
193 bool on_cancel_called = false;
194 auto handler = std::make_unique<StreamHandlerFunctions<>>(
195 [&on_listen_called](const EncodableValue* arguments,
196 std::unique_ptr<EventSink<>>&& events)
197 -> std::unique_ptr<StreamHandlerError<>> {
198 on_listen_called = true;
199 return nullptr;
200 },
201 [&on_cancel_called](const EncodableValue* arguments)
202 -> std::unique_ptr<StreamHandlerError<>> {
203 on_cancel_called = true;
204 return nullptr;
205 });
206 channel.SetStreamHandler(std::move(handler));
207 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
208 EXPECT_NE(messenger.last_message_handler(), nullptr);
209
210 // Send test listen message.
211 MethodCall<> call("listen", nullptr);
212 auto message = codec.EncodeMethodCall(call);
213 messenger.last_message_handler()(
214 message->data(), message->size(),
215 [](const uint8_t* reply, const size_t reply_size) {});
216 EXPECT_EQ(on_listen_called, true);
217
218 // Send second test message to test StreamHandler's OnCancel
219 // method is called before OnListen method is called.
220 on_listen_called = false;
221 message = codec.EncodeMethodCall(call);
222 messenger.last_message_handler()(
223 message->data(), message->size(),
224 [](const uint8_t* reply, const size_t reply_size) {});
225
226 // Check results.
227 EXPECT_EQ(on_cancel_called, true);
228 EXPECT_EQ(on_listen_called, true);
229 }

References flutter::MethodCodec< T >::EncodeMethodCall(), flutter::StandardMethodCodec::GetInstance(), message, and flutter::EventChannel< T >::SetStreamHandler().

## ◆ TEST() [25/312]

flutter::TEST | ( | EventChannelTest | ,
|  | StreamHandlerErrorNullptr |
| ) |  |

Definition at line 295 of file event_channel_unittests.cc.

295 {
296 std::unique_ptr<StreamHandlerError<>> error =
297 std::make_unique<StreamHandlerError<>>("Code", "Message", nullptr);
298
299 ASSERT_NE(error.get(), nullptr);
300 EXPECT_FALSE(error->error_details);
301 }

## ◆ TEST() [26/312]

flutter::TEST | ( | EventChannelTest | ,
|  | StreamHandlerErrorPassByValue |
| ) |  |

Definition at line 277 of file event_channel_unittests.cc.

277 {
278 std::unique_ptr<StreamHandlerError<>> error = nullptr;
279
280 {
281 std::string code = "Code";
282 std::string msg = "Message";
283 std::unique_ptr<EncodableValue> details =
284 std::make_unique<EncodableValue>("Details");
285 error =
286 std::make_unique<StreamHandlerError<>>(code, msg, std::move(details));
287 }
288
289 ASSERT_NE(error.get(), nullptr);
290 EXPECT_EQ(error->error_code, "Code");
291 EXPECT_EQ(error->error_message, "Message");
292 EXPECT_EQ(std::get<std::string>(*error->error_details), "Details");
293 }

## ◆ TEST() [27/312]

flutter::TEST | ( | EventChannelTest | ,
|  | Unregistration |
| ) |  |

Definition at line 81 of file event_channel_unittests.cc.

81 {
82 TestBinaryMessenger messenger;
83 const std::string channel_name("some_channel");
84 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
85 EventChannel channel(&messenger, channel_name, &codec);
86
87 auto handler = std::make_unique<StreamHandlerFunctions<>>(
88 [](const EncodableValue* arguments, std::unique_ptr<EventSink<>>&& events)
89 -> std::unique_ptr<StreamHandlerError<>> { return nullptr; },
90 [](const EncodableValue* arguments)
91 -> std::unique_ptr<StreamHandlerError<>> { return nullptr; });
92 channel.SetStreamHandler(std::move(handler));
93 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
94 EXPECT_NE(messenger.last_message_handler(), nullptr);
95
96 channel.SetStreamHandler(nullptr);
97 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
98 EXPECT_EQ(messenger.last_message_handler(), nullptr);
99 }

References flutter::StandardMethodCodec::GetInstance(), and flutter::EventChannel< T >::SetStreamHandler().

## ◆ TEST() [28/312]

flutter::TEST | ( | FlutterEngineTest | ,
|  | CreateDestroy |
| ) |  |

Definition at line 103 of file flutter_engine_unittests.cc.

103 {
104 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
105 std::make_unique<TestFlutterWindowsApi>());
106 auto test_api = static_cast<TestFlutterWindowsApi*>(scoped_api_stub.stub());
107 {
108 FlutterEngine engine(DartProject(L"fake/project/path"));
109 engine.Run();
110 EXPECT_EQ(test_api->create_called(), true);
111 EXPECT_EQ(test_api->run_called(), true);
112 EXPECT_EQ(test_api->destroy_called(), false);
113 }
114 // Destroying should implicitly shut down if it hasn't been done manually.
115 EXPECT_EQ(test_api->destroy_called(), true);
116 }

References flutter::FlutterEngine::Run().

## ◆ TEST() [29/312]

flutter::TEST | ( | FlutterEngineTest | ,
|  | CreateDestroyWithCustomEntrypoint |
| ) |  |

Definition at line 118 of file flutter_engine_unittests.cc.

118 {
119 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
120 std::make_unique<TestFlutterWindowsApi>());
121 auto test_api = static_cast<TestFlutterWindowsApi*>(scoped_api_stub.stub());
122 {
123 DartProject project(L"fake/project/path");
124 project.set_dart_entrypoint("customEntrypoint");
125 FlutterEngine engine(project);
126 engine.Run();
127 EXPECT_EQ(test_api->create_called(), true);
128 EXPECT_EQ(test_api->run_called(), true);
129 EXPECT_EQ(test_api->destroy_called(), false);
130 }
131 // Destroying should implicitly shut down if it hasn't been done manually.
132 EXPECT_EQ(test_api->destroy_called(), true);
133 }

References flutter::FlutterEngine::Run(), and flutter::DartProject::set_dart_entrypoint().

## ◆ TEST() [30/312]

flutter::TEST | ( | FlutterEngineTest | ,
|  | DartEntrypointArgs |
| ) |  |

Definition at line 183 of file flutter_engine_unittests.cc.

183 {
184 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
185 std::make_unique<TestFlutterWindowsApi>());
186 auto test_api = static_cast<TestFlutterWindowsApi*>(scoped_api_stub.stub());
187
188 DartProject project(L"data");
189 std::vector<std::string> arguments = {"one", "two"};
190 project.set_dart_entrypoint_arguments(arguments);
191
192 FlutterEngine engine(project);
193 const std::vector<std::string>& arguments_ref =
194 test_api->dart_entrypoint_arguments();
195 ASSERT_EQ(2, arguments_ref.size());
196 EXPECT_TRUE(arguments[0] == arguments_ref[0]);
197 EXPECT_TRUE(arguments[1] == arguments_ref[1]);
198 }

References flutter::DartProject::set_dart_entrypoint_arguments().

## ◆ TEST() [31/312]

flutter::TEST | ( | FlutterEngineTest | ,
|  | ExplicitShutDown |
| ) |  |

Definition at line 135 of file flutter_engine_unittests.cc.

135 {
136 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
137 std::make_unique<TestFlutterWindowsApi>());
138 auto test_api = static_cast<TestFlutterWindowsApi*>(scoped_api_stub.stub());
139
140 FlutterEngine engine(DartProject(L"fake/project/path"));
141 engine.Run();
142 EXPECT_EQ(test_api->create_called(), true);
143 EXPECT_EQ(test_api->run_called(), true);
144 EXPECT_EQ(test_api->destroy_called(), false);
145 engine.ShutDown();
146 EXPECT_EQ(test_api->destroy_called(), true);
147 }

References flutter::FlutterEngine::Run(), and flutter::FlutterEngine::ShutDown().

## ◆ TEST() [32/312]

flutter::TEST | ( | FlutterEngineTest | ,
|  | GetMessenger |
| ) |  |

Definition at line 173 of file flutter_engine_unittests.cc.

173 {
174 DartProject project(L"data");
175 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
176 std::make_unique<TestFlutterWindowsApi>());
177 auto test_api = static_cast<TestFlutterWindowsApi*>(scoped_api_stub.stub());
178
179 FlutterEngine engine(DartProject(L"fake/project/path"));
180 EXPECT_NE(engine.messenger(), nullptr);
181 }

References flutter::FlutterEngine::messenger().

## ◆ TEST() [33/312]

flutter::TEST | ( | FlutterEngineTest | ,
|  | ProcessExternalWindowMessage |
| ) |  |

Definition at line 218 of file flutter_engine_unittests.cc.

218 {
219 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
220 std::make_unique<TestFlutterWindowsApi>());
221 auto test_api = static_cast<TestFlutterWindowsApi*>(scoped_api_stub.stub());
222
223 FlutterEngine engine(DartProject(L"fake/project/path"));
224
225 engine.ProcessExternalWindowMessage(reinterpret_cast<HWND>(1), 1234, 0, 0);
226
227 EXPECT_EQ(test_api->last_external_message(), 1234);
228 }

References flutter::FlutterEngine::ProcessExternalWindowMessage().

## ◆ TEST() [34/312]

flutter::TEST | ( | FlutterEngineTest | ,
|  | ProcessMessages |
| ) |  |

Definition at line 149 of file flutter_engine_unittests.cc.

149 {
150 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
151 std::make_unique<TestFlutterWindowsApi>());
152 auto test_api = static_cast<TestFlutterWindowsApi*>(scoped_api_stub.stub());
153
154 FlutterEngine engine(DartProject(L"fake/project/path"));
155 engine.Run();
156
157 std::chrono::nanoseconds next_event_time = engine.ProcessMessages();
158 EXPECT_EQ(next_event_time.count(), 99);
159 }

References flutter::FlutterEngine::ProcessMessages(), and flutter::FlutterEngine::Run().

## ◆ TEST() [35/312]

flutter::TEST | ( | FlutterEngineTest | ,
|  | ReloadFonts |
| ) |  |

Definition at line 161 of file flutter_engine_unittests.cc.

161 {
162 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
163 std::make_unique<TestFlutterWindowsApi>());
164 auto test_api = static_cast<TestFlutterWindowsApi*>(scoped_api_stub.stub());
165
166 FlutterEngine engine(DartProject(L"fake/project/path"));
167 engine.Run();
168
169 engine.ReloadSystemFonts();
170 EXPECT_TRUE(test_api->reload_fonts_called());
171 }

References flutter::FlutterEngine::ReloadSystemFonts(), and flutter::FlutterEngine::Run().

## ◆ TEST() [36/312]

flutter::TEST | ( | FlutterEngineTest | ,
|  | SetNextFrameCallback |
| ) |  |

Definition at line 200 of file flutter_engine_unittests.cc.

200 {
201 DartProject project(L"data");
202 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
203 std::make_unique<TestFlutterWindowsApi>());
204 auto test_api = static_cast<TestFlutterWindowsApi*>(scoped_api_stub.stub());
205
206 FlutterEngine engine(DartProject(L"fake/project/path"));
207
208 bool success = false;
209 engine.SetNextFrameCallback([&success]() { success = true; });
210
211 EXPECT_TRUE(test_api->has_next_frame_callback());
212
213 test_api->run_next_frame_callback();
214
215 EXPECT_TRUE(success);
216 }

References flutter::FlutterEngine::SetNextFrameCallback().

## ◆ TEST() [37/312]

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

Definition at line 50 of file engine_switches_unittests.cc.

50 {
51 SetEnvironmentVariable("FLUTTER_ENGINE_SWITCHES", "2");
52 SetEnvironmentVariable("FLUTTER_ENGINE_SWITCH_1", "abc");
53 SetEnvironmentVariable("FLUTTER_ENGINE_SWITCH_2", "foo=\"bar, baz\"");
54
55 std::vector<std::string> switches = GetSwitchesFromEnvironment();
56 EXPECT_EQ(switches.size(), 2U);
57 EXPECT_EQ(switches[0], "--abc");
58 EXPECT_EQ(switches[1], "--foo=\"bar, baz\"");
59 }

References GetSwitchesFromEnvironment().

## ◆ TEST() [38/312]

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

Definition at line 31 of file engine_switches_unittests.cc.

31 {
32 // Clear the main environment variable, since test order is not guaranteed.
33 ClearEnvironmentVariable("FLUTTER_ENGINE_SWITCHES");
34
35 EXPECT_EQ(GetSwitchesFromEnvironment().size(), 0U);
36 }

References GetSwitchesFromEnvironment().

## ◆ TEST() [39/312]

flutter::TEST | ( | FlutterProjectBundle | ,
|  | SwitchesExtraValues |
| ) |  |

Definition at line 61 of file engine_switches_unittests.cc.

61 {
62 SetEnvironmentVariable("FLUTTER_ENGINE_SWITCHES", "1");
63 SetEnvironmentVariable("FLUTTER_ENGINE_SWITCH_1", "abc");
64 SetEnvironmentVariable("FLUTTER_ENGINE_SWITCH_2", "foo=\"bar, baz\"");
65
66 std::vector<std::string> switches = GetSwitchesFromEnvironment();
67 EXPECT_EQ(switches.size(), 1U);
68 EXPECT_EQ(switches[0], "--abc");
69 }

References GetSwitchesFromEnvironment().

## ◆ TEST() [40/312]

flutter::TEST | ( | FlutterProjectBundle | ,
|  | SwitchesMissingValues |
| ) |  |

Definition at line 71 of file engine_switches_unittests.cc.

71 {
72 SetEnvironmentVariable("FLUTTER_ENGINE_SWITCHES", "4");
73 SetEnvironmentVariable("FLUTTER_ENGINE_SWITCH_1", "abc");
74 SetEnvironmentVariable("FLUTTER_ENGINE_SWITCH_2", "foo=\"bar, baz\"");
75 ClearEnvironmentVariable("FLUTTER_ENGINE_SWITCH_3");
76 SetEnvironmentVariable("FLUTTER_ENGINE_SWITCH_4", "oops");
77
78 std::vector<std::string> switches = GetSwitchesFromEnvironment();
79 EXPECT_EQ(switches.size(), 3U);
80 EXPECT_EQ(switches[0], "--abc");
81 EXPECT_EQ(switches[1], "--foo=\"bar, baz\"");
82 // The missing switch should be skipped, leaving SWITCH_4 as the third
83 // switch in the array.
84 EXPECT_EQ(switches[2], "--oops");
85 }

References GetSwitchesFromEnvironment().

## ◆ TEST() [41/312]

flutter::TEST | ( | FlutterViewControllerTest | ,
|  | CreateDestroy |
| ) |  |

Definition at line 61 of file flutter_view_controller_unittests.cc.

61 {
62 DartProject project(L"data");
63 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
64 std::make_unique<TestWindowsApi>());
65 auto test_api = static_cast<TestWindowsApi*>(scoped_api_stub.stub());
66 { FlutterViewController controller(100, 100, project); }
67 EXPECT_TRUE(test_api->view_controller_destroyed());
68 // Per the C API, once a view controller has taken ownership of an engine
69 // the engine destruction method should not be called.
70 EXPECT_FALSE(test_api->engine_destroyed());
71 }

## ◆ TEST() [42/312]

flutter::TEST | ( | FlutterViewControllerTest | ,
|  | ForceRedraw |
| ) |  |

Definition at line 91 of file flutter_view_controller_unittests.cc.

91 {
92 DartProject project(L"data");
93 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
94 std::make_unique<TestWindowsApi>());
95 auto test_api = static_cast<TestWindowsApi*>(scoped_api_stub.stub());
96 FlutterViewController controller(100, 100, project);
97
98 controller.ForceRedraw();
99 EXPECT_TRUE(test_api->view_controller_force_redrawed());
100 }

References flutter::FlutterViewController::ForceRedraw().

## ◆ TEST() [43/312]

flutter::TEST | ( | FlutterViewControllerTest | ,
|  | GetEngine |
| ) |  |

Definition at line 73 of file flutter_view_controller_unittests.cc.

73 {
74 DartProject project(L"data");
75 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
76 std::make_unique<TestWindowsApi>());
77 auto test_api = static_cast<TestWindowsApi*>(scoped_api_stub.stub());
78 FlutterViewController controller(100, 100, project);
79 EXPECT_NE(controller.engine(), nullptr);
80 }

References flutter::FlutterViewController::engine().

## ◆ TEST() [44/312]

flutter::TEST | ( | FlutterViewControllerTest | ,
|  | GetView |
| ) |  |

Definition at line 82 of file flutter_view_controller_unittests.cc.

82 {
83 DartProject project(L"data");
84 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
85 std::make_unique<TestWindowsApi>());
86 auto test_api = static_cast<TestWindowsApi*>(scoped_api_stub.stub());
87 FlutterViewController controller(100, 100, project);
88 EXPECT_NE(controller.view(), nullptr);
89 }

References flutter::FlutterViewController::view().

## ◆ TEST() [45/312]

flutter::TEST | ( | FlutterViewTest | ,
|  | GraphicsAdapterAccessPassesThrough |
| ) |  |

Definition at line 35 of file flutter_view_unittests.cc.

35 {
36 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
37 std::make_unique<TestWindowsApi>());
38 auto test_api = static_cast<TestWindowsApi*>(scoped_api_stub.stub());
39 FlutterView view(reinterpret_cast<FlutterDesktopViewRef>(2));
40
41 IDXGIAdapter* adapter = view.GetGraphicsAdapter();
42 EXPECT_EQ(adapter, reinterpret_cast<IDXGIAdapter*>(8));
43 }

References flutter::FlutterView::GetGraphicsAdapter().

## ◆ TEST() [46/312]

flutter::TEST | ( | FlutterViewTest | ,
|  | HwndAccessPassesThrough |
| ) |  |

Definition at line 27 of file flutter_view_unittests.cc.

27 {
28 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
29 std::make_unique<TestWindowsApi>());
30 auto test_api = static_cast<TestWindowsApi*>(scoped_api_stub.stub());
31 FlutterView view(reinterpret_cast<FlutterDesktopViewRef>(2));
32 EXPECT_EQ(view.GetNativeWindow(), reinterpret_cast<HWND>(7));
33 }

References flutter::FlutterView::GetNativeWindow().

## ◆ TEST() [47/312]

flutter::TEST | ( | IncomingMessageDispatcher | ,
|  | BlockInputFalse |
| ) |  |

Definition at line 39 of file incoming_message_dispatcher_unittests.cc.

39 {
40 FlutterDesktopMessengerRef messenger = nullptr;
41 auto dispatcher = std::make_unique<IncomingMessageDispatcher>(messenger);
42 bool did_call[3] = {false, false, false};
43 dispatcher->SetMessageCallback(
44 "hello",
45 [](FlutterDesktopMessengerRef messenger,
46 const FlutterDesktopMessage* message,
47 void* user_data) { reinterpret_cast<bool*>(user_data)[0] = true; },
48 &did_call);
49 FlutterDesktopMessage message = {
50 .struct_size = sizeof(FlutterDesktopMessage),
51 .channel = "hello",
52 .message = nullptr,
53 .message_size = 0,
54 .response_handle = nullptr,
55 };
56 dispatcher->HandleMessage(
57 message, [&did_call] { did_call[1] = true; },
58 [&did_call] { did_call[2] = true; });
59 EXPECT_TRUE(did_call[0]);
60 EXPECT_FALSE(did_call[1]);
61 EXPECT_FALSE(did_call[2]);
62 }

References message, and user_data.

## ◆ TEST() [48/312]

flutter::TEST | ( | IncomingMessageDispatcher | ,
|  | BlockInputTrue |
| ) |  |

Definition at line 64 of file incoming_message_dispatcher_unittests.cc.

64 {
65 FlutterDesktopMessengerRef messenger = nullptr;
66 auto dispatcher = std::make_unique<IncomingMessageDispatcher>(messenger);
67 static int counter = 0;
68 int did_call[3] = {-1, -1, -1};
69 dispatcher->EnableInputBlockingForChannel("hello");
70 dispatcher->SetMessageCallback(
71 "hello",
72 [](FlutterDesktopMessengerRef messenger,
73 const FlutterDesktopMessage* message,
74 void* user_data) { reinterpret_cast<int*>(user_data)[counter++] = 1; },
75 &did_call);
76 FlutterDesktopMessage message = {
77 .struct_size = sizeof(FlutterDesktopMessage),
78 .channel = "hello",
79 .message = nullptr,
80 .message_size = 0,
81 .response_handle = nullptr,
82 };
83 dispatcher->HandleMessage(
84 message, [&did_call] { did_call[counter++] = 0; },
85 [&did_call] { did_call[counter++] = 2; });
86 EXPECT_EQ(did_call[0], 0);
87 EXPECT_EQ(did_call[1], 1);
88 EXPECT_EQ(did_call[2], 2);
89 }

References message, and user_data.

## ◆ TEST() [49/312]

flutter::TEST | ( | IncomingMessageDispatcher | ,
|  | SetHandle |
| ) |  |

Definition at line 10 of file incoming_message_dispatcher_unittests.cc.

10 {
11 FlutterDesktopMessengerRef messenger =
12 reinterpret_cast<FlutterDesktopMessengerRef>(0xfeedface);
13 const uint8_t* message_data = reinterpret_cast<const uint8_t*>(0xcafebabe);
14 auto dispatcher = std::make_unique<IncomingMessageDispatcher>(messenger);
15 bool did_call = false;
16 dispatcher->SetMessageCallback(
17 "hello",
18 [](FlutterDesktopMessengerRef messenger,
19 const FlutterDesktopMessage* message, void* user_data) {
20 EXPECT_EQ(messenger,
21 reinterpret_cast<FlutterDesktopMessengerRef>(0xfeedface));
22 EXPECT_EQ(message->message,
23 reinterpret_cast<const uint8_t*>(0xcafebabe));
24 EXPECT_EQ(message->message_size, 123u);
25 *reinterpret_cast<bool*>(user_data) = true;
26 },
27 &did_call);
28 FlutterDesktopMessage message = {
29 .struct_size = sizeof(FlutterDesktopMessage),
30 .channel = "hello",
31 .message = message_data,
32 .message_size = 123,
33 .response_handle = nullptr,
34 };
35 dispatcher->HandleMessage(message);
36 EXPECT_TRUE(did_call);
37 }

References message, and user_data.

## ◆ TEST() [50/312]

flutter::TEST | ( | JsonMessageCodec | ,
|  | EncodeDecode |
| ) |  |

Definition at line 29 of file json_message_codec_unittests.cc.

29 {
30 // NOLINTNEXTLINE(clang-analyzer-core.NullDereference)
31 rapidjson::Document array(rapidjson::kArrayType);
32 auto& allocator = array.GetAllocator();
33
34 array.PushBack("string", allocator);
35
36 rapidjson::Value map(rapidjson::kObjectType);
37 map.AddMember("a", -7, allocator);
38 map.AddMember("b", std::numeric_limits<int>::max(), allocator);
39 map.AddMember("c", 3.14159, allocator);
40 map.AddMember("d", true, allocator);
41 map.AddMember("e", rapidjson::Value(), allocator);
42 array.PushBack(map, allocator);
43
44 CheckEncodeDecode(array);
45 }

References CheckEncodeDecode().

## ◆ TEST() [51/312]

flutter::TEST | ( | JsonMethodCodec | ,
|  | HandlesErrorEnvelopesWithDetails |
| ) |  |

Definition at line 125 of file json_method_codec_unittests.cc.

125 {
126 const JsonMethodCodec& codec = JsonMethodCodec::GetInstance();
127 // NOLINTNEXTLINE(clang-analyzer-core.NullDereference)
128 rapidjson::Document details(rapidjson::kArrayType);
129 auto& allocator = details.GetAllocator();
130 details.PushBack("a", allocator);
131 details.PushBack(42, allocator);
132 auto encoded =
133 codec.EncodeErrorEnvelope("errorCode", "something failed", &details);
134 ASSERT_NE(encoded.get(), nullptr);
135 std::vector<uint8_t> bytes = {
136 '[', '"', 'e', 'r', 'r', 'o', 'r', 'C', 'o', 'd', 'e', '"', ',', '"',
137 's', 'o', 'm', 'e', 't', 'h', 'i', 'n', 'g', ' ', 'f', 'a', 'i', 'l',
138 'e', 'd', '"', ',', '[', '"', 'a', '"', ',', '4', '2', ']', ']',
139 };
140 EXPECT_EQ(*encoded, bytes);
141
142 bool decoded_successfully = false;
143 MethodResultFunctions<rapidjson::Document> result_handler(
144 nullptr,
145 [&decoded_successfully](const std::string& code,
146 const std::string& message,
147 const rapidjson::Document* details) {
148 decoded_successfully = true;
149 EXPECT_EQ(code, "errorCode");
150 EXPECT_EQ(message, "something failed");
151 EXPECT_TRUE(details->IsArray());
152 EXPECT_EQ(std::string((*details)[0].GetString()), "a");
153 EXPECT_EQ((*details)[1].GetInt(), 42);
154 },
155 nullptr);
156 codec.DecodeAndProcessResponseEnvelope(encoded->data(), encoded->size(),
157 &result_handler);
158 EXPECT_TRUE(decoded_successfully);
159 }

References flutter::MethodCodec< T >::DecodeAndProcessResponseEnvelope(), flutter::MethodCodec< T >::EncodeErrorEnvelope(), flutter::JsonMethodCodec::GetInstance(), and message.

## ◆ TEST() [52/312]

flutter::TEST | ( | JsonMethodCodec | ,
|  | HandlesErrorEnvelopesWithNulls |
| ) |  |

Definition at line 98 of file json_method_codec_unittests.cc.

98 {
99 const JsonMethodCodec& codec = JsonMethodCodec::GetInstance();
100 auto encoded = codec.EncodeErrorEnvelope("errorCode");
101 ASSERT_TRUE(encoded);
102 std::vector<uint8_t> bytes = {
103 '[', '"', 'e', 'r', 'r', 'o', 'r', 'C', 'o', 'd', 'e',
104 '"', ',', '"', '"', ',', 'n', 'u', 'l', 'l', ']',
105 };
106 EXPECT_EQ(*encoded, bytes);
107
108 bool decoded_successfully = false;
109 MethodResultFunctions<rapidjson::Document> result_handler(
110 nullptr,
111 [&decoded_successfully](const std::string& code,
112 const std::string& message,
113 const rapidjson::Document* details) {
114 decoded_successfully = true;
115 EXPECT_EQ(code, "errorCode");
116 EXPECT_EQ(message, "");
117 EXPECT_EQ(details, nullptr);
118 },
119 nullptr);
120 codec.DecodeAndProcessResponseEnvelope(encoded->data(), encoded->size(),
121 &result_handler);
122 EXPECT_TRUE(decoded_successfully);
123 }

References flutter::MethodCodec< T >::DecodeAndProcessResponseEnvelope(), flutter::MethodCodec< T >::EncodeErrorEnvelope(), flutter::JsonMethodCodec::GetInstance(), and message.

## ◆ TEST() [53/312]

flutter::TEST | ( | JsonMethodCodec | ,
|  | HandlesMethodCallsWithArgument |
| ) |  |

Definition at line 42 of file json_method_codec_unittests.cc.

42 {
43 const JsonMethodCodec& codec = JsonMethodCodec::GetInstance();
44
45 auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
46 auto& allocator = arguments->GetAllocator();
47 arguments->PushBack(42, allocator);
48 arguments->PushBack("world", allocator);
49 MethodCall<rapidjson::Document> call("hello", std::move(arguments));
50 auto encoded = codec.EncodeMethodCall(call);
51 ASSERT_TRUE(encoded);
52 std::unique_ptr<MethodCall<rapidjson::Document>> decoded =
53 codec.DecodeMethodCall(*encoded);
54 ASSERT_TRUE(decoded);
55 EXPECT_TRUE(MethodCallsAreEqual(call, *decoded));
56 }

References flutter::MethodCodec< T >::DecodeMethodCall(), flutter::MethodCodec< T >::EncodeMethodCall(), and flutter::JsonMethodCodec::GetInstance().

## ◆ TEST() [54/312]

flutter::TEST | ( | JsonMethodCodec | ,
|  | HandlesMethodCallsWithNullArguments |
| ) |  |

Definition at line 31 of file json_method_codec_unittests.cc.

31 {
32 const JsonMethodCodec& codec = JsonMethodCodec::GetInstance();
33 MethodCall<rapidjson::Document> call("hello", nullptr);
34 auto encoded = codec.EncodeMethodCall(call);
35 ASSERT_TRUE(encoded);
36 std::unique_ptr<MethodCall<rapidjson::Document>> decoded =
37 codec.DecodeMethodCall(*encoded);
38 ASSERT_TRUE(decoded);
39 EXPECT_TRUE(MethodCallsAreEqual(call, *decoded));
40 }

References flutter::MethodCodec< T >::DecodeMethodCall(), flutter::MethodCodec< T >::EncodeMethodCall(), and flutter::JsonMethodCodec::GetInstance().

## ◆ TEST() [55/312]

flutter::TEST | ( | JsonMethodCodec | ,
|  | HandlesSuccessEnvelopesWithNullResult |
| ) |  |

Definition at line 58 of file json_method_codec_unittests.cc.

58 {
59 const JsonMethodCodec& codec = JsonMethodCodec::GetInstance();
60 auto encoded = codec.EncodeSuccessEnvelope();
61 ASSERT_TRUE(encoded);
62 std::vector<uint8_t> bytes = {'[', 'n', 'u', 'l', 'l', ']'};
63 EXPECT_EQ(*encoded, bytes);
64
65 bool decoded_successfully = false;
66 MethodResultFunctions<rapidjson::Document> result_handler(
67 [&decoded_successfully](const rapidjson::Document* result) {
68 decoded_successfully = true;
69 EXPECT_EQ(result, nullptr);
70 },
71 nullptr, nullptr);
72 codec.DecodeAndProcessResponseEnvelope(encoded->data(), encoded->size(),
73 &result_handler);
74 EXPECT_TRUE(decoded_successfully);
75 }

References flutter::MethodCodec< T >::DecodeAndProcessResponseEnvelope(), flutter::MethodCodec< T >::EncodeSuccessEnvelope(), and flutter::JsonMethodCodec::GetInstance().

## ◆ TEST() [56/312]

flutter::TEST | ( | JsonMethodCodec | ,
|  | HandlesSuccessEnvelopesWithResult |
| ) |  |

Definition at line 77 of file json_method_codec_unittests.cc.

77 {
78 const JsonMethodCodec& codec = JsonMethodCodec::GetInstance();
79 rapidjson::Document result;
80 result.SetInt(42);
81 auto encoded = codec.EncodeSuccessEnvelope(&result);
82 ASSERT_TRUE(encoded);
83 std::vector<uint8_t> bytes = {'[', '4', '2', ']'};
84 EXPECT_EQ(*encoded, bytes);
85
86 bool decoded_successfully = false;
87 MethodResultFunctions<rapidjson::Document> result_handler(
88 [&decoded_successfully](const rapidjson::Document* result) {
89 decoded_successfully = true;
90 EXPECT_EQ(result->GetInt(), 42);
91 },
92 nullptr, nullptr);
93 codec.DecodeAndProcessResponseEnvelope(encoded->data(), encoded->size(),
94 &result_handler);
95 EXPECT_TRUE(decoded_successfully);
96 }

References flutter::MethodCodec< T >::DecodeAndProcessResponseEnvelope(), flutter::MethodCodec< T >::EncodeSuccessEnvelope(), and flutter::JsonMethodCodec::GetInstance().

## ◆ TEST() [57/312]

flutter::TEST | ( | MethodCallTest | ,
|  | Basic |
| ) |  |

Definition at line 14 of file method_call_unittests.cc.

14 {
15 const std::string method_name("method_name");
16 const int argument = 42;
17 MethodCall<int> method_call(method_name, std::make_unique<int>(argument));
18 EXPECT_EQ(method_call.method_name(), method_name);
19 ASSERT_NE(method_call.arguments(), nullptr);
20 EXPECT_EQ(*method_call.arguments(), 42);
21 }

References flutter::MethodCall< T >::arguments(), and flutter::MethodCall< T >::method_name().

## ◆ TEST() [58/312]

flutter::TEST | ( | MethodChannelTest | ,
|  | Error |
| ) |  |

Definition at line 37 of file method_result_functions_unittests.cc.

37 {
38 bool called = false;
39 std::string error_code = "a";
40 std::string error_message = "b";
41 int error_details = 1;
42 MethodResultFunctions<int> result(
43 nullptr,
44 [&called, error_code, error_message, error_details](
45 const std::string& code, const std::string& message,
46 const int* details) {
47 called = true;
48 EXPECT_EQ(code, error_code);
49 EXPECT_EQ(message, error_message);
50 EXPECT_EQ(*details, error_details);
51 },
52 nullptr);
53 result.Error(error_code, error_message, error_details);
54 EXPECT_TRUE(called);
55 }

References flutter::MethodResult< T >::Error(), and message.

## ◆ TEST() [59/312]

flutter::TEST | ( | MethodChannelTest | ,
|  | InvokeNotImplemented |
| ) |  |

Definition at line 139 of file method_channel_unittests.cc.

139 {
140 TestBinaryMessenger messenger;
141 const std::string channel_name("some_channel");
142 MethodChannel channel(&messenger, channel_name,
143 &StandardMethodCodec::GetInstance());
144
145 bool received_not_implemented = false;
146 auto result_handler = std::make_unique<MethodResultFunctions<>>(
147 nullptr, nullptr,
148 [&received_not_implemented]() { received_not_implemented = true; });
149
150 channel.InvokeMethod("foo", nullptr, std::move(result_handler));
151 EXPECT_EQ(messenger.send_called(), true);
152 ASSERT_NE(messenger.last_reply_handler(), nullptr);
153
154 // Call the underlying reply handler to ensure it's reported as unimplemented.
155 messenger.last_reply_handler()(nullptr, 0);
156 EXPECT_TRUE(received_not_implemented);
157 }

References flutter::StandardMethodCodec::GetInstance(), and flutter::MethodChannel< T >::InvokeMethod().

## ◆ TEST() [60/312]

flutter::TEST | ( | MethodChannelTest | ,
|  | InvokeWithoutResponse |
| ) |  |

Definition at line 101 of file method_channel_unittests.cc.

101 {
102 TestBinaryMessenger messenger;
103 const std::string channel_name("some_channel");
104 MethodChannel channel(&messenger, channel_name,
105 &StandardMethodCodec::GetInstance());
106
107 channel.InvokeMethod("foo", nullptr);
108 EXPECT_TRUE(messenger.send_called());
109 EXPECT_EQ(messenger.last_reply_handler(), nullptr);
110 }

References flutter::StandardMethodCodec::GetInstance(), and flutter::MethodChannel< T >::InvokeMethod().

## ◆ TEST() [61/312]

flutter::TEST | ( | MethodChannelTest | ,
|  | InvokeWithResponse |
| ) |  |

Definition at line 112 of file method_channel_unittests.cc.

112 {
113 TestBinaryMessenger messenger;
114 const std::string channel_name("some_channel");
115 MethodChannel channel(&messenger, channel_name,
116 &StandardMethodCodec::GetInstance());
117
118 bool received_reply = false;
119 const std::string reply = "bar";
120 auto result_handler = std::make_unique<MethodResultFunctions<>>(
121 [&received_reply, reply](const EncodableValue* success_value) {
122 received_reply = true;
123 EXPECT_EQ(std::get<std::string>(*success_value), reply);
124 },
125 nullptr, nullptr);
126
127 channel.InvokeMethod("foo", nullptr, std::move(result_handler));
128 EXPECT_TRUE(messenger.send_called());
129 ASSERT_NE(messenger.last_reply_handler(), nullptr);
130
131 // Call the underlying reply handler to ensure it's processed correctly.
132 EncodableValue reply_value(reply);
133 std::unique_ptr<std::vector<uint8_t>> encoded_reply =
134 StandardMethodCodec::GetInstance().EncodeSuccessEnvelope(&reply_value);
135 messenger.last_reply_handler()(encoded_reply->data(), encoded_reply->size());
136 EXPECT_TRUE(received_reply);
137 }

References flutter::MethodCodec< T >::EncodeSuccessEnvelope(), flutter::StandardMethodCodec::GetInstance(), and flutter::MethodChannel< T >::InvokeMethod().

## ◆ TEST() [62/312]

flutter::TEST | ( | MethodChannelTest | ,
|  | NoHandlers |
| ) |  |

Definition at line 15 of file method_result_functions_unittests.cc.

15 {
16 MethodResultFunctions<int> result(nullptr, nullptr, nullptr);
17 result.Success();
18 result.Error("error");
19 result.NotImplemented();
20 }

References flutter::MethodResult< EncodableValue >::Error(), flutter::MethodResult< EncodableValue >::NotImplemented(), and flutter::MethodResult< EncodableValue >::Success().

## ◆ TEST() [63/312]

flutter::TEST | ( | MethodChannelTest | ,
|  | NotImplemented |
| ) |  |

Definition at line 58 of file method_result_functions_unittests.cc.

58 {
59 bool called = false;
60 MethodResultFunctions<int> result(nullptr, nullptr,
61 [&called]() { called = true; });
62 result.NotImplemented();
63 EXPECT_TRUE(called);
64 }

References flutter::MethodResult< T >::NotImplemented().

## ◆ TEST() [64/312]

flutter::TEST | ( | MethodChannelTest | ,
|  | Registration |
| ) |  |

Definition at line 56 of file method_channel_unittests.cc.

56 {
57 TestBinaryMessenger messenger;
58 const std::string channel_name("some_channel");
59 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
60 MethodChannel channel(&messenger, channel_name, &codec);
61
62 bool callback_called = false;
63 const std::string method_name("hello");
64 channel.SetMethodCallHandler(
65 [&callback_called, method_name](const auto& call, auto result) {
66 callback_called = true;
67 // Ensure that the wrapper received a correctly decoded call and a
68 // result.
69 EXPECT_EQ(call.method_name(), method_name);
70 EXPECT_NE(result, nullptr);
71 result->Success();
72 });
73 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
74 EXPECT_NE(messenger.last_message_handler(), nullptr);
75 // Send a test message to trigger the handler test assertions.
76 MethodCall<> call(method_name, nullptr);
77 auto message = codec.EncodeMethodCall(call);
78
79 messenger.last_message_handler()(
80 message->data(), message->size(),
81 [](const uint8_t* reply, size_t reply_size) {});
82 EXPECT_TRUE(callback_called);
83 }

References flutter::MethodCodec< T >::EncodeMethodCall(), flutter::StandardMethodCodec::GetInstance(), message, and flutter::MethodChannel< T >::SetMethodCallHandler().

## ◆ TEST() [65/312]

flutter::TEST | ( | MethodChannelTest | ,
|  | Success |
| ) |  |

Definition at line 23 of file method_result_functions_unittests.cc.

23 {
24 bool called = false;
25 int value = 1;
26 MethodResultFunctions<int> result(
27 [&called, value](const int* i) {
28 called = true;
29 EXPECT_EQ(*i, value);
30 },
31 nullptr, nullptr);
32 result.Success(value);
33 EXPECT_TRUE(called);
34 }

References flutter::MethodResult< T >::Success().

## ◆ TEST() [66/312]

flutter::TEST | ( | MethodChannelTest | ,
|  | Unregistration |
| ) |  |

Definition at line 86 of file method_channel_unittests.cc.

86 {
87 TestBinaryMessenger messenger;
88 const std::string channel_name("some_channel");
89 MethodChannel channel(&messenger, channel_name,
90 &StandardMethodCodec::GetInstance());
91
92 channel.SetMethodCallHandler([](const auto& call, auto result) {});
93 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
94 EXPECT_NE(messenger.last_message_handler(), nullptr);
95
96 channel.SetMethodCallHandler(nullptr);
97 EXPECT_EQ(messenger.last_message_handler_channel(), channel_name);
98 EXPECT_EQ(messenger.last_message_handler(), nullptr);
99 }

References flutter::StandardMethodCodec::GetInstance(), and flutter::MethodChannel< T >::SetMethodCallHandler().

## ◆ TEST() [67/312]

flutter::TEST | ( | PathUtilsTest | ,
|  | ExecutableDirector |
| ) |  |

Definition at line 12 of file path_utils_unittests.cc.

12 {
13 std::filesystem::path exe_directory = GetExecutableDirectory();
14 #if defined(__linux__) || defined(_WIN32)
15 EXPECT_EQ(exe_directory.empty(), false);
16 EXPECT_EQ(exe_directory.is_absolute(), true);
17 #else
18 // On platforms where it's not implemented, it should indicate that
19 // by returning an empty path.
20 EXPECT_EQ(exe_directory.empty(), true);
21 #endif
22 }

References GetExecutableDirectory().

## ◆ TEST() [68/312]

flutter::TEST | ( | PluginRegistrarTest | ,
|  | ManagerDifferentInstances |
| ) |  |

Definition at line 175 of file plugin_registrar_unittests.cc.

175 {
176 PluginRegistrarManager* manager = PluginRegistrarManager::GetInstance();
177 manager->Reset();
178
179 testing::ScopedStubFlutterApi scoped_api_stub(std::make_unique<TestApi>());
180
181 auto dummy_registrar_handle_a =
182 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
183 auto dummy_registrar_handle_b =
184 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(2);
185
186 EXPECT_NE(manager->GetRegistrar<PluginRegistrar>(dummy_registrar_handle_a),
187 manager->GetRegistrar<PluginRegistrar>(dummy_registrar_handle_b));
188 }

References flutter::PluginRegistrarManager::GetInstance(), flutter::PluginRegistrarManager::GetRegistrar(), and flutter::PluginRegistrarManager::Reset().

## ◆ TEST() [69/312]

flutter::TEST | ( | PluginRegistrarTest | ,
|  | ManagerRemovesOnDestruction |
| ) |  |

Definition at line 192 of file plugin_registrar_unittests.cc.

192 {
193 PluginRegistrarManager* manager = PluginRegistrarManager::GetInstance();
194 manager->Reset();
195
196 testing::ScopedStubFlutterApi scoped_api_stub(std::make_unique<TestApi>());
197 auto test_api = static_cast<TestApi*>(scoped_api_stub.stub());
198
199 auto dummy_registrar_handle =
200 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
201 auto* wrapper =
202 manager->GetRegistrar<TestPluginRegistrar>(dummy_registrar_handle);
203
204 // Simulate destruction of the reference, and ensure that the wrapper
205 // is destroyed.
206 EXPECT_NE(test_api->last_destruction_callback_set(), nullptr);
207 bool destroyed = false;
208 wrapper->SetDestructionCallback([&destroyed]() { destroyed = true; });
209 test_api->last_destruction_callback_set()(dummy_registrar_handle);
210 EXPECT_EQ(destroyed, true);
211
212 // Requesting the wrapper should now create a new object.
213 EXPECT_NE(manager->GetRegistrar<TestPluginRegistrar>(dummy_registrar_handle),
214 nullptr);
215 }

References flutter::PluginRegistrarManager::GetInstance(), flutter::PluginRegistrarManager::GetRegistrar(), and flutter::PluginRegistrarManager::Reset().

## ◆ TEST() [70/312]

flutter::TEST | ( | PluginRegistrarTest | ,
|  | ManagerSameInstance |
| ) |  |

Definition at line 160 of file plugin_registrar_unittests.cc.

160 {
161 PluginRegistrarManager* manager = PluginRegistrarManager::GetInstance();
162 manager->Reset();
163
164 testing::ScopedStubFlutterApi scoped_api_stub(std::make_unique<TestApi>());
165
166 auto dummy_registrar_handle =
167 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
168
169 EXPECT_EQ(manager->GetRegistrar<PluginRegistrar>(dummy_registrar_handle),
170 manager->GetRegistrar<PluginRegistrar>(dummy_registrar_handle));
171 }

References flutter::PluginRegistrarManager::GetInstance(), flutter::PluginRegistrarManager::GetRegistrar(), and flutter::PluginRegistrarManager::Reset().

## ◆ TEST() [71/312]

flutter::TEST | ( | PluginRegistrarTest | ,
|  | MessengerSend |
| ) |  |

Definition at line 120 of file plugin_registrar_unittests.cc.

120 {
121 testing::ScopedStubFlutterApi scoped_api_stub(std::make_unique<TestApi>());
122 auto test_api = static_cast<TestApi*>(scoped_api_stub.stub());
123
124 auto dummy_registrar_handle =
125 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
126 PluginRegistrar registrar(dummy_registrar_handle);
127 BinaryMessenger* messenger = registrar.messenger();
128
129 std::vector<uint8_t> message = {1, 2, 3, 4};
130 messenger->Send("some_channel", &message[0], message.size());
131 EXPECT_EQ(test_api->last_data_sent(), &message[0]);
132 }

References message, flutter::PluginRegistrar::messenger(), and flutter::BinaryMessenger::Send().

## ◆ TEST() [72/312]

flutter::TEST | ( | PluginRegistrarTest | ,
|  | MessengerSetMessageHandler |
| ) |  |

Definition at line 136 of file plugin_registrar_unittests.cc.

136 {
137 testing::ScopedStubFlutterApi scoped_api_stub(std::make_unique<TestApi>());
138 auto test_api = static_cast<TestApi*>(scoped_api_stub.stub());
139
140 auto dummy_registrar_handle =
141 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
142 PluginRegistrar registrar(dummy_registrar_handle);
143 BinaryMessenger* messenger = registrar.messenger();
144 const std::string channel_name("foo");
145
146 // Register.
147 BinaryMessageHandler binary_handler = [](const uint8_t* message,
148 const size_t message_size,
149 const BinaryReply& reply) {};
150 messenger->SetMessageHandler(channel_name, std::move(binary_handler));
151 EXPECT_NE(test_api->last_message_callback_set(), nullptr);
152
153 // Unregister.
154 messenger->SetMessageHandler(channel_name, nullptr);
155 EXPECT_EQ(test_api->last_message_callback_set(), nullptr);
156 }

References message, flutter::PluginRegistrar::messenger(), and flutter::BinaryMessenger::SetMessageHandler().

## ◆ TEST() [73/312]

flutter::TEST | ( | PluginRegistrarTest | ,
|  | PluginDestroyedBeforeRegistrar |
| ) |  |

Definition at line 104 of file plugin_registrar_unittests.cc.

104 {
105 auto dummy_registrar_handle =
106 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
107 bool registrar_valid_at_destruction = false;
108 {
109 PluginRegistrar registrar(dummy_registrar_handle);
110
111 auto plugin = std::make_unique<TestPlugin>(&registrar,
112 &registrar_valid_at_destruction);
113 registrar.AddPlugin(std::move(plugin));
114 }
115 EXPECT_TRUE(registrar_valid_at_destruction);
116 }

References flutter::PluginRegistrar::AddPlugin().

## ◆ TEST() [74/312]

flutter::TEST | ( | PluginRegistrarTest | ,
|  | TextureRegistrarNotNull |
| ) |  |

Definition at line 218 of file plugin_registrar_unittests.cc.

218 {
219 auto dummy_registrar_handle =
220 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
221 PluginRegistrar registrar(dummy_registrar_handle);
222
223 TextureRegistrar* texture_registrar = registrar.texture_registrar();
224
225 ASSERT_NE(texture_registrar, nullptr);
226 }

References flutter::PluginRegistrar::texture_registrar().

## ◆ TEST() [75/312]

flutter::TEST | ( | PluginRegistrarWindowsTest | ,
|  | CallsRegisteredDelegates |
| ) |  |

Definition at line 120 of file plugin_registrar_windows_unittests.cc.

120 {
121 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
122 std::make_unique<TestWindowsApi>());
123 auto test_api = static_cast<TestWindowsApi*>(scoped_api_stub.stub());
124 PluginRegistrarWindows registrar(
125 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1));
126
127 HWND dummy_hwnd;
128 bool called_a = false;
129 WindowProcDelegate delegate_a = [&called_a, &dummy_hwnd](
130 HWND hwnd, UINT message, WPARAM wparam,
131 LPARAM lparam) {
132 called_a = true;
133 EXPECT_EQ(hwnd, dummy_hwnd);
134 EXPECT_EQ(message, 2);
135 EXPECT_EQ(wparam, 3);
136 EXPECT_EQ(lparam, 4);
137 return std::optional<LRESULT>();
138 };
139 bool called_b = false;
140 WindowProcDelegate delegate_b = [&called_b](HWND hwnd, UINT message,
141 WPARAM wparam, LPARAM lparam) {
142 called_b = true;
143 return std::optional<LRESULT>();
144 };
145 int id_a = registrar.RegisterTopLevelWindowProcDelegate(delegate_a);
146 int id_b = registrar.RegisterTopLevelWindowProcDelegate(delegate_b);
147
148 LRESULT result = 0;
149 bool handled = test_api->last_registered_delegate()(
150 dummy_hwnd, 2, 3, 4, test_api->last_registered_user_data(), &result);
151 EXPECT_TRUE(called_a);
152 EXPECT_TRUE(called_b);
153 EXPECT_FALSE(handled);
154 }

References message, and flutter::PluginRegistrarWindows::RegisterTopLevelWindowProcDelegate().

## ◆ TEST() [76/312]

flutter::TEST | ( | PluginRegistrarWindowsTest | ,
|  | GetView |
| ) |  |

Definition at line 67 of file plugin_registrar_windows_unittests.cc.

67 {
68 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
69 std::make_unique<TestWindowsApi>());
70 auto test_api = static_cast<TestWindowsApi*>(scoped_api_stub.stub());
71 PluginRegistrarWindows registrar(
72 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1));
73 EXPECT_NE(registrar.GetView(), nullptr);
74 }

References flutter::PluginRegistrarWindows::GetView().

## ◆ TEST() [77/312]

flutter::TEST | ( | PluginRegistrarWindowsTest | ,
|  | PluginDestroyedBeforeRegistrar |
| ) |  |

Definition at line 77 of file plugin_registrar_windows_unittests.cc.

77 {
78 auto dummy_registrar_handle =
79 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
80 bool registrar_valid_at_destruction = false;
81 {
82 PluginRegistrarWindows registrar(dummy_registrar_handle);
83
84 auto plugin = std::make_unique<TestPlugin>(&registrar,
85 &registrar_valid_at_destruction);
86 registrar.AddPlugin(std::move(plugin));
87 }
88 EXPECT_TRUE(registrar_valid_at_destruction);
89 }

References flutter::PluginRegistrar::AddPlugin().

## ◆ TEST() [78/312]

flutter::TEST | ( | PluginRegistrarWindowsTest | ,
|  | RegisterUnregister |
| ) |  |

Definition at line 91 of file plugin_registrar_windows_unittests.cc.

91 {
92 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
93 std::make_unique<TestWindowsApi>());
94 auto test_api = static_cast<TestWindowsApi*>(scoped_api_stub.stub());
95 PluginRegistrarWindows registrar(
96 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1));
97
98 WindowProcDelegate delegate = [](HWND hwnd, UINT message, WPARAM wparam,
99 LPARAM lparam) {
100 return std::optional<LRESULT>();
101 };
102 int id_a = registrar.RegisterTopLevelWindowProcDelegate(delegate);
103 EXPECT_EQ(test_api->registered_delegate_count(), 1);
104 int id_b = registrar.RegisterTopLevelWindowProcDelegate(delegate);
105 // All the C++-level delegates are driven by a since C callback, so the
106 // registration count should stay the same.
107 EXPECT_EQ(test_api->registered_delegate_count(), 1);
108
109 // Unregistering one of the two delegates shouldn't cause the underlying C
110 // callback to be unregistered.
111 registrar.UnregisterTopLevelWindowProcDelegate(id_a);
112 EXPECT_EQ(test_api->registered_delegate_count(), 1);
113 // Unregistering both should unregister it.
114 registrar.UnregisterTopLevelWindowProcDelegate(id_b);
115 EXPECT_EQ(test_api->registered_delegate_count(), 0);
116
117 EXPECT_NE(id_a, id_b);
118 }

References message, flutter::PluginRegistrarWindows::RegisterTopLevelWindowProcDelegate(), and flutter::PluginRegistrarWindows::UnregisterTopLevelWindowProcDelegate().

## ◆ TEST() [79/312]

flutter::TEST | ( | PluginRegistrarWindowsTest | ,
|  | StopsOnceHandled |
| ) |  |

Definition at line 156 of file plugin_registrar_windows_unittests.cc.

156 {
157 testing::ScopedStubFlutterWindowsApi scoped_api_stub(
158 std::make_unique<TestWindowsApi>());
159 auto test_api = static_cast<TestWindowsApi*>(scoped_api_stub.stub());
160 PluginRegistrarWindows registrar(
161 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1));
162
163 bool called_a = false;
164 WindowProcDelegate delegate_a = [&called_a](HWND hwnd, UINT message,
165 WPARAM wparam, LPARAM lparam) {
166 called_a = true;
167 return std::optional<LRESULT>(7);
168 };
169 bool called_b = false;
170 WindowProcDelegate delegate_b = [&called_b](HWND hwnd, UINT message,
171 WPARAM wparam, LPARAM lparam) {
172 called_b = true;
173 return std::optional<LRESULT>(7);
174 };
175 int id_a = registrar.RegisterTopLevelWindowProcDelegate(delegate_a);
176 int id_b = registrar.RegisterTopLevelWindowProcDelegate(delegate_b);
177
178 HWND dummy_hwnd;
179 LRESULT result = 0;
180 bool handled = test_api->last_registered_delegate()(
181 dummy_hwnd, 2, 3, 4, test_api->last_registered_user_data(), &result);
182 // Only one of the delegates should have been called, since each claims to
183 // have fully handled the message.
184 EXPECT_TRUE(called_a || called_b);
185 EXPECT_NE(called_a, called_b);
186 // The return value should propagate through.
187 EXPECT_TRUE(handled);
188 EXPECT_EQ(result, 7);
189 }

References message, and flutter::PluginRegistrarWindows::RegisterTopLevelWindowProcDelegate().

## ◆ TEST() [80/312]

flutter::TEST | ( | Point | ,
|  | SetsCoordinates |
| ) |  |

Definition at line 11 of file geometry_unittests.cc.

11 {
12 Point point(-30.0, 42.0);
13 EXPECT_DOUBLE_EQ(-30.0, point.x());
14 EXPECT_DOUBLE_EQ(42.0, point.y());
15 }

References flutter::Point::x(), and flutter::Point::y().

## ◆ TEST() [81/312]

flutter::TEST | ( | Rect | ,
|  | ReturnsLTRB |
| ) |  |

Definition at line 37 of file geometry_unittests.cc.

37 {
38 Point origin(-30.0, 42.0);
39 Size size(20.0, 22.0);
40 Rect rect(origin, size);
41 EXPECT_DOUBLE_EQ(-30.0, rect.left());
42 EXPECT_DOUBLE_EQ(42.0, rect.top());
43 EXPECT_DOUBLE_EQ(-10.0, rect.right());
44 EXPECT_DOUBLE_EQ(64.0, rect.bottom());
45 }

References flutter::Rect::bottom(), flutter::Rect::left(), flutter::Rect::right(), and flutter::Rect::top().

## ◆ TEST() [82/312]

flutter::TEST | ( | Rect | ,
|  | ReturnsWidthHeight |
| ) |  |

Definition at line 47 of file geometry_unittests.cc.

47 {
48 Point origin(-30.0, 42.0);
49 Size size(20.0, 22.0);
50 Rect rect(origin, size);
51 EXPECT_DOUBLE_EQ(20.0, rect.width());
52 EXPECT_DOUBLE_EQ(22.0, rect.height());
53 }

References flutter::Rect::height(), and flutter::Rect::width().

## ◆ TEST() [83/312]

flutter::TEST | ( | Rect | ,
|  | SetsOriginAndSize |
| ) |  |

Definition at line 29 of file geometry_unittests.cc.

29 {
30 Point origin(-30.0, 42.0);
31 Size size(20.0, 22.0);
32 Rect rect(origin, size);
33 EXPECT_EQ(origin, rect.origin());
34 EXPECT_EQ(size, rect.size());
35 }

References flutter::Rect::origin(), and flutter::Rect::size().

## ◆ TEST() [84/312]

flutter::TEST | ( | Size | ,
|  | ClampsDimensionsPositive |
| ) |  |

Definition at line 23 of file geometry_unittests.cc.

23 {
24 Size size(-20.0, -42.0);
25 EXPECT_DOUBLE_EQ(0.0, size.width());
26 EXPECT_DOUBLE_EQ(0.0, size.height());
27 }

References flutter::Size::height(), and flutter::Size::width().

## ◆ TEST() [85/312]

flutter::TEST | ( | Size | ,
|  | SetsDimensions |
| ) |  |

Definition at line 17 of file geometry_unittests.cc.

17 {
18 Size size(20.0, 42.0);
19 EXPECT_DOUBLE_EQ(20.0, size.width());
20 EXPECT_DOUBLE_EQ(42.0, size.height());
21 }

References flutter::Size::height(), and flutter::Size::width().

## ◆ TEST() [86/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanDecodeEmptyBytesAsNullWithoutCallingSerializer |
| ) |  |

Definition at line 95 of file standard_message_codec_unittests.cc.

95 {
96 std::vector<uint8_t> bytes = {};
97 const MockStandardCodecSerializer serializer;
98 const StandardMessageCodec& codec =
99 StandardMessageCodec::GetInstance(&serializer);
100
101 auto decoded = codec.DecodeMessage(bytes);
102
103 EXPECT_EQ(EncodableValue(), *decoded);
104 EXPECT_CALL(serializer, ReadValueOfType(::testing::_, ::testing::_)).Times(0);
105 }

References flutter::MessageCodec< T >::DecodeMessage(), and flutter::StandardMessageCodec::GetInstance().

## ◆ TEST() [87/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeByteArray |
| ) |  |

Definition at line 193 of file standard_message_codec_unittests.cc.

193 {
194 std::vector<uint8_t> bytes = {0x08, 0x04, 0xba, 0x5e, 0xba, 0x11};
195 EncodableValue value(std::vector<uint8_t>{0xba, 0x5e, 0xba, 0x11});
196 CheckEncodeDecode(value, bytes);
197 }

References CheckEncodeDecode().

## ◆ TEST() [88/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeDouble |
| ) |  |

Definition at line 128 of file standard_message_codec_unittests.cc.

128 {
129 std::vector<uint8_t> bytes = {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
130 0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40};
131 CheckEncodeDecode(EncodableValue(3.14159265358979311599796346854), bytes);
132 }

References CheckEncodeDecode().

## ◆ TEST() [89/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeEmptyList |
| ) |  |

Definition at line 175 of file standard_message_codec_unittests.cc.

175 {
176 std::vector<uint8_t> bytes = {0x0c, 0x00};
177 CheckEncodeDecode(EncodableValue(EncodableList{}), bytes);
178 }

References CheckEncodeDecode().

## ◆ TEST() [90/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeEmptyString |
| ) |  |

Definition at line 150 of file standard_message_codec_unittests.cc.

150 {
151 std::vector<uint8_t> bytes = {0x07, 0x00};
152 CheckEncodeDecode(EncodableValue(u8""), bytes);
153 }

References CheckEncodeDecode().

## ◆ TEST() [91/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeFalse |
| ) |  |

Definition at line 112 of file standard_message_codec_unittests.cc.

112 {
113 std::vector<uint8_t> bytes = {0x02};
114 CheckEncodeDecode(EncodableValue(false), bytes);
115 }

References CheckEncodeDecode().

## ◆ TEST() [92/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeFloat32Array |
| ) |  |

Definition at line 214 of file standard_message_codec_unittests.cc.

214 {
215 std::vector<uint8_t> bytes = {0x0e, 0x02, 0x00, 0x00, 0xd8, 0x0f,
216 0x49, 0x40, 0x00, 0x00, 0x7a, 0x44};
217 EncodableValue value(std::vector<float>{3.1415920257568359375f, 1000.0f});
218 CheckEncodeDecode(value, bytes);
219 }

References CheckEncodeDecode().

## ◆ TEST() [93/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeFloat64Array |
| ) |  |

Definition at line 221 of file standard_message_codec_unittests.cc.

221 {
222 std::vector<uint8_t> bytes = {0x0b, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
223 0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40,
224 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x8f, 0x40};
225 EncodableValue value(
226 std::vector<double>{3.14159265358979311599796346854, 1000.0});
227 CheckEncodeDecode(value, bytes);
228 }

References CheckEncodeDecode().

## ◆ TEST() [94/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeInt32 |
| ) |  |

Definition at line 117 of file standard_message_codec_unittests.cc.

117 {
118 std::vector<uint8_t> bytes = {0x03, 0x78, 0x56, 0x34, 0x12};
119 CheckEncodeDecode(EncodableValue(0x12345678), bytes);
120 }

References CheckEncodeDecode().

## ◆ TEST() [95/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeInt32Array |
| ) |  |

Definition at line 199 of file standard_message_codec_unittests.cc.

199 {
200 std::vector<uint8_t> bytes = {0x09, 0x03, 0x00, 0x00, 0x78, 0x56, 0x34, 0x12,
201 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00};
202 EncodableValue value(std::vector<int32_t>{0x12345678, -1, 0});
203 CheckEncodeDecode(value, bytes);
204 }

References CheckEncodeDecode().

## ◆ TEST() [96/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeInt64 |
| ) |  |

Definition at line 122 of file standard_message_codec_unittests.cc.

122 {
123 std::vector<uint8_t> bytes = {0x04, 0xef, 0xcd, 0xab, 0x90,
124 0x78, 0x56, 0x34, 0x12};
125 CheckEncodeDecode(EncodableValue(INT64_C(0x1234567890abcdef)), bytes);
126 }

References CheckEncodeDecode().

## ◆ TEST() [97/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeInt64Array |
| ) |  |

Definition at line 206 of file standard_message_codec_unittests.cc.

206 {
207 std::vector<uint8_t> bytes = {0x0a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0xef, 0xcd, 0xab, 0x90, 0x78, 0x56, 0x34, 0x12,
209 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
210 EncodableValue value(std::vector<int64_t>{0x1234567890abcdef, -1});
211 CheckEncodeDecode(value, bytes);
212 }

References CheckEncodeDecode().

## ◆ TEST() [98/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeList |
| ) |  |

Definition at line 155 of file standard_message_codec_unittests.cc.

155 {
156 std::vector<uint8_t> bytes = {
157 0x0c, 0x05, 0x00, 0x07, 0x05, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x06,
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x85, 0xeb, 0x51, 0xb8, 0x1e,
159 0x09, 0x40, 0x03, 0x2f, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x03, 0x2a,
160 0x00, 0x00, 0x00, 0x07, 0x06, 0x6e, 0x65, 0x73, 0x74, 0x65, 0x64,
161 };
162 EncodableValue value(EncodableList{
163 EncodableValue(),
164 EncodableValue("hello"),
165 EncodableValue(3.14),
166 EncodableValue(47),
167 EncodableValue(EncodableList{
168 EncodableValue(42),
169 EncodableValue("nested"),
170 }),
171 });
172 CheckEncodeDecode(value, bytes);
173 }

References CheckEncodeDecode().

## ◆ TEST() [99/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeMap |
| ) |  |

Definition at line 180 of file standard_message_codec_unittests.cc.

180 {
181 std::vector<uint8_t> bytes_prefix = {0x0d, 0x04};
182 EncodableValue value(EncodableMap{
183 {EncodableValue("a"), EncodableValue(3.14)},
184 {EncodableValue("b"), EncodableValue(47)},
185 {EncodableValue(), EncodableValue()},
186 {EncodableValue(3.14), EncodableValue(EncodableList{
187 EncodableValue("nested"),
188 })},
189 });
190 CheckEncodeDecodeWithEncodePrefix(value, bytes_prefix, 48);
191 }

References CheckEncodeDecodeWithEncodePrefix().

## ◆ TEST() [100/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeNull |
| ) |  |

Definition at line 90 of file standard_message_codec_unittests.cc.

90 {
91 std::vector<uint8_t> bytes = {0x00};
92 CheckEncodeDecode(EncodableValue(), bytes);
93 }

References CheckEncodeDecode().

## ◆ TEST() [101/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeSimpleCustomType |
| ) |  |

Definition at line 230 of file standard_message_codec_unittests.cc.

230 {
231 std::vector<uint8_t> bytes = {0x80, 0x09, 0x00, 0x00, 0x00,
232 0x10, 0x00, 0x00, 0x00};
233 auto point_comparator = [](const EncodableValue& a, const EncodableValue& b) {
234 const Point& a_point =
235 std::any_cast<Point>(std::get<CustomEncodableValue>(a));
236 const Point& b_point =
237 std::any_cast<Point>(std::get<CustomEncodableValue>(b));
238 return a_point == b_point;
239 };
240 CheckEncodeDecode(CustomEncodableValue(Point(9, 16)), bytes,
241 &PointExtensionSerializer::GetInstance(), point_comparator);
242 }

References CheckEncodeDecode().

## ◆ TEST() [102/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeString |
| ) |  |

Definition at line 134 of file standard_message_codec_unittests.cc.

134 {
135 std::vector<uint8_t> bytes = {0x07, 0x0b, 0x68, 0x65, 0x6c, 0x6c, 0x6f,
136 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64};
137 CheckEncodeDecode(EncodableValue(u8"hello world"), bytes);
138 }

References CheckEncodeDecode().

## ◆ TEST() [103/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeStringWithNonAsciiCodePoint |
| ) |  |

Definition at line 140 of file standard_message_codec_unittests.cc.

140 {
141 std::vector<uint8_t> bytes = {0x07, 0x05, 0x68, 0xe2, 0x98, 0xba, 0x77};
142 CheckEncodeDecode(EncodableValue(u8"h\u263Aw"), bytes);
143 }

References CheckEncodeDecode().

## ◆ TEST() [104/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeStringWithNonBMPCodePoint |
| ) |  |

Definition at line 145 of file standard_message_codec_unittests.cc.

145 {
146 std::vector<uint8_t> bytes = {0x07, 0x06, 0x68, 0xf0, 0x9f, 0x98, 0x82, 0x77};
147 CheckEncodeDecode(EncodableValue(u8"h\U0001F602w"), bytes);
148 }

References CheckEncodeDecode().

## ◆ TEST() [105/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeTrue |
| ) |  |

Definition at line 107 of file standard_message_codec_unittests.cc.

107 {
108 std::vector<uint8_t> bytes = {0x01};
109 CheckEncodeDecode(EncodableValue(true), bytes);
110 }

References CheckEncodeDecode().

## ◆ TEST() [106/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | CanEncodeAndDecodeVariableLengthCustomType |
| ) |  |

Definition at line 244 of file standard_message_codec_unittests.cc.

244 {
245 std::vector<uint8_t> bytes = {
246 0x81, // custom type
247 0x06, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, // data
248 0x07, 0x04, // string type and length
249 0x74, 0x65, 0x73, 0x74 // string characters
250 };
251 auto some_data_comparator = [](const EncodableValue& a,
252 const EncodableValue& b) {
253 const SomeData& data_a =
254 std::any_cast<SomeData>(std::get<CustomEncodableValue>(a));
255 const SomeData& data_b =
256 std::any_cast<SomeData>(std::get<CustomEncodableValue>(b));
257 return data_a.data() == data_b.data() && data_a.label() == data_b.label();
258 };
259 CheckEncodeDecode(CustomEncodableValue(
260 SomeData("test", {0x00, 0x01, 0x02, 0x03, 0x04, 0x05})),
261 bytes, &SomeDataExtensionSerializer::GetInstance(),
262 some_data_comparator);
263 }

References CheckEncodeDecode().

## ◆ TEST() [107/312]

flutter::TEST | ( | StandardMessageCodec | ,
|  | GetInstanceCachesInstance |
| ) |  |

Definition at line 82 of file standard_message_codec_unittests.cc.

82 {
83 const StandardMessageCodec& codec_a =
84 StandardMessageCodec::GetInstance(nullptr);
85 const StandardMessageCodec& codec_b =
86 StandardMessageCodec::GetInstance(nullptr);
87 EXPECT_EQ(&codec_a, &codec_b);
88 }

References flutter::StandardMessageCodec::GetInstance().

## ◆ TEST() [108/312]

flutter::TEST | ( | StandardMethodCodec | ,
|  | GetInstanceCachesInstance |
| ) |  |

Definition at line 35 of file standard_method_codec_unittests.cc.

35 {
36 const StandardMethodCodec& codec_a =
37 StandardMethodCodec::GetInstance(nullptr);
38 const StandardMethodCodec& codec_b =
39 StandardMethodCodec::GetInstance(nullptr);
40 EXPECT_EQ(&codec_a, &codec_b);
41 }

References flutter::StandardMethodCodec::GetInstance().

## ◆ TEST() [109/312]

flutter::TEST | ( | StandardMethodCodec | ,
|  | HandlesCustomTypeArguments |
| ) |  |

Definition at line 167 of file standard_method_codec_unittests.cc.

167 {
168 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance(
169 &PointExtensionSerializer::GetInstance());
170 Point point(7, 9);
171 MethodCall<> call(
172 "hello", std::make_unique<EncodableValue>(CustomEncodableValue(point)));
173 auto encoded = codec.EncodeMethodCall(call);
174 ASSERT_NE(encoded.get(), nullptr);
175 std::unique_ptr<MethodCall<>> decoded = codec.DecodeMethodCall(*encoded);
176 ASSERT_NE(decoded.get(), nullptr);
177
178 const Point& decoded_point = std::any_cast<Point>(
179 std::get<CustomEncodableValue>(*decoded->arguments()));
180 EXPECT_EQ(point, decoded_point);
181 };

References flutter::MethodCodec< T >::DecodeMethodCall(), flutter::MethodCodec< T >::EncodeMethodCall(), and flutter::StandardMethodCodec::GetInstance().

## ◆ TEST() [110/312]

flutter::TEST | ( | StandardMethodCodec | ,
|  | HandlesErrorEnvelopesWithDetails |
| ) |  |

Definition at line 130 of file standard_method_codec_unittests.cc.

130 {
131 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
132 EncodableValue details(EncodableList{
133 EncodableValue("a"),
134 EncodableValue(42),
135 });
136 auto encoded =
137 codec.EncodeErrorEnvelope("errorCode", "something failed", &details);
138 ASSERT_NE(encoded.get(), nullptr);
139 std::vector<uint8_t> bytes = {
140 0x01, 0x07, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f,
141 0x64, 0x65, 0x07, 0x10, 0x73, 0x6f, 0x6d, 0x65, 0x74, 0x68,
142 0x69, 0x6e, 0x67, 0x20, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64,
143 0x0c, 0x02, 0x07, 0x01, 0x61, 0x03, 0x2a, 0x00, 0x00, 0x00,
144 };
145 EXPECT_EQ(*encoded, bytes);
146
147 bool decoded_successfully = false;
148 MethodResultFunctions<> result_handler(
149 nullptr,
150 [&decoded_successfully](const std::string& code,
151 const std::string& message,
152 const EncodableValue* details) {
153 decoded_successfully = true;
154 EXPECT_EQ(code, "errorCode");
155 EXPECT_EQ(message, "something failed");
156 const auto* details_list = std::get_if<EncodableList>(details);
157 ASSERT_NE(details_list, nullptr);
158 EXPECT_EQ(std::get<std::string>((*details_list)[0]), "a");
159 EXPECT_EQ(std::get<int32_t>((*details_list)[1]), 42);
160 },
161 nullptr);
162 codec.DecodeAndProcessResponseEnvelope(encoded->data(), encoded->size(),
163 &result_handler);
164 EXPECT_TRUE(decoded_successfully);
165 }

References flutter::MethodCodec< T >::DecodeAndProcessResponseEnvelope(), flutter::MethodCodec< T >::EncodeErrorEnvelope(), flutter::StandardMethodCodec::GetInstance(), and message.

## ◆ TEST() [111/312]

flutter::TEST | ( | StandardMethodCodec | ,
|  | HandlesErrorEnvelopesWithNulls |
| ) |  |

Definition at line 105 of file standard_method_codec_unittests.cc.

105 {
106 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
107 auto encoded = codec.EncodeErrorEnvelope("errorCode");
108 ASSERT_NE(encoded.get(), nullptr);
109 std::vector<uint8_t> bytes = {0x01, 0x07, 0x09, 0x65, 0x72, 0x72, 0x6f,
110 0x72, 0x43, 0x6f, 0x64, 0x65, 0x00, 0x00};
111 EXPECT_EQ(*encoded, bytes);
112
113 bool decoded_successfully = false;
114 MethodResultFunctions<> result_handler(
115 nullptr,
116 [&decoded_successfully](const std::string& code,
117 const std::string& message,
118 const EncodableValue* details) {
119 decoded_successfully = true;
120 EXPECT_EQ(code, "errorCode");
121 EXPECT_EQ(message, "");
122 EXPECT_EQ(details, nullptr);
123 },
124 nullptr);
125 codec.DecodeAndProcessResponseEnvelope(encoded->data(), encoded->size(),
126 &result_handler);
127 EXPECT_TRUE(decoded_successfully);
128 }

References flutter::MethodCodec< T >::DecodeAndProcessResponseEnvelope(), flutter::MethodCodec< T >::EncodeErrorEnvelope(), flutter::StandardMethodCodec::GetInstance(), and message.

## ◆ TEST() [112/312]

flutter::TEST | ( | StandardMethodCodec | ,
|  | HandlesMethodCallsWithArgument |
| ) |  |

Definition at line 53 of file standard_method_codec_unittests.cc.

53 {
54 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
55 MethodCall<> call("hello", std::make_unique<EncodableValue>(EncodableList{
56 EncodableValue(42),
57 EncodableValue("world"),
58 }));
59 auto encoded = codec.EncodeMethodCall(call);
60 ASSERT_NE(encoded.get(), nullptr);
61 std::unique_ptr<MethodCall<>> decoded = codec.DecodeMethodCall(*encoded);
62 ASSERT_NE(decoded.get(), nullptr);
63 EXPECT_TRUE(MethodCallsAreEqual(call, *decoded));
64 }

References flutter::MethodCodec< T >::DecodeMethodCall(), flutter::MethodCodec< T >::EncodeMethodCall(), and flutter::StandardMethodCodec::GetInstance().

## ◆ TEST() [113/312]

flutter::TEST | ( | StandardMethodCodec | ,
|  | HandlesMethodCallsWithNullArguments |
| ) |  |

Definition at line 43 of file standard_method_codec_unittests.cc.

43 {
44 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
45 MethodCall<> call("hello", nullptr);
46 auto encoded = codec.EncodeMethodCall(call);
47 ASSERT_NE(encoded.get(), nullptr);
48 std::unique_ptr<MethodCall<>> decoded = codec.DecodeMethodCall(*encoded);
49 ASSERT_NE(decoded.get(), nullptr);
50 EXPECT_TRUE(MethodCallsAreEqual(call, *decoded));
51 }

References flutter::MethodCodec< T >::DecodeMethodCall(), flutter::MethodCodec< T >::EncodeMethodCall(), and flutter::StandardMethodCodec::GetInstance().

## ◆ TEST() [114/312]

flutter::TEST | ( | StandardMethodCodec | ,
|  | HandlesSuccessEnvelopesWithNullResult |
| ) |  |

Definition at line 66 of file standard_method_codec_unittests.cc.

66 {
67 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
68 auto encoded = codec.EncodeSuccessEnvelope();
69 ASSERT_NE(encoded.get(), nullptr);
70 std::vector<uint8_t> bytes = {0x00, 0x00};
71 EXPECT_EQ(*encoded, bytes);
72
73 bool decoded_successfully = false;
74 MethodResultFunctions<> result_handler(
75 [&decoded_successfully](const EncodableValue* result) {
76 decoded_successfully = true;
77 EXPECT_EQ(result, nullptr);
78 },
79 nullptr, nullptr);
80 codec.DecodeAndProcessResponseEnvelope(encoded->data(), encoded->size(),
81 &result_handler);
82 EXPECT_TRUE(decoded_successfully);
83 }

References flutter::MethodCodec< T >::DecodeAndProcessResponseEnvelope(), flutter::MethodCodec< T >::EncodeSuccessEnvelope(), and flutter::StandardMethodCodec::GetInstance().

## ◆ TEST() [115/312]

flutter::TEST | ( | StandardMethodCodec | ,
|  | HandlesSuccessEnvelopesWithResult |
| ) |  |

Definition at line 85 of file standard_method_codec_unittests.cc.

85 {
86 const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
87 EncodableValue result(42);
88 auto encoded = codec.EncodeSuccessEnvelope(&result);
89 ASSERT_NE(encoded.get(), nullptr);
90 std::vector<uint8_t> bytes = {0x00, 0x03, 0x2a, 0x00, 0x00, 0x00};
91 EXPECT_EQ(*encoded, bytes);
92
93 bool decoded_successfully = false;
94 MethodResultFunctions<> result_handler(
95 [&decoded_successfully](const EncodableValue* result) {
96 decoded_successfully = true;
97 EXPECT_EQ(std::get<int32_t>(*result), 42);
98 },
99 nullptr, nullptr);
100 codec.DecodeAndProcessResponseEnvelope(encoded->data(), encoded->size(),
101 &result_handler);
102 EXPECT_TRUE(decoded_successfully);
103 }

References flutter::MethodCodec< T >::DecodeAndProcessResponseEnvelope(), flutter::MethodCodec< T >::EncodeSuccessEnvelope(), and flutter::StandardMethodCodec::GetInstance().

## ◆ TEST() [116/312]

flutter::TEST | ( | TextEditingDeltaTest | ,
|  | TestTextEditingDeltaConstructor |
| ) |  |

Definition at line 11 of file text_editing_delta_unittests.cc.

11 {
12 // Here we are simulating inserting an "o" at the end of "hell".
13 std::string old_text = "hell";
14 std::string replacement_text = "hello";
15 TextRange range(0, 4);
16
17 TextEditingDelta delta = TextEditingDelta(old_text, range, replacement_text);
18
19 EXPECT_EQ(delta.old_text(), old_text);
20 EXPECT_EQ(delta.delta_text(), "hello");
21 EXPECT_EQ(delta.delta_start(), 0);
22 EXPECT_EQ(delta.delta_end(), 4);
23 }

References flutter::TextEditingDelta::delta_end(), flutter::TextEditingDelta::delta_start(), flutter::TextEditingDelta::delta_text(), and flutter::TextEditingDelta::old_text().

## ◆ TEST() [117/312]

flutter::TEST | ( | TextEditingDeltaTest | ,
|  | TestTextEditingDeltaNonTextConstructor |
| ) |  |

Definition at line 25 of file text_editing_delta_unittests.cc.

25 {
26 // Here we are simulating inserting an "o" at the end of "hell".
27 std::string old_text = "hello";
28
29 TextEditingDelta delta = TextEditingDelta(old_text);
30
31 EXPECT_EQ(delta.old_text(), old_text);
32 EXPECT_EQ(delta.delta_text(), "");
33 EXPECT_EQ(delta.delta_start(), -1);
34 EXPECT_EQ(delta.delta_end(), -1);
35 }

References flutter::TextEditingDelta::delta_end(), flutter::TextEditingDelta::delta_start(), flutter::TextEditingDelta::delta_text(), and flutter::TextEditingDelta::old_text().

## ◆ TEST() [118/312]

flutter::TEST | ( | TextInputModel | ,
|  | AddCodePoint |
| ) |  |

Definition at line 406 of file text_input_model_unittests.cc.

406 {
407 auto model = std::make_unique<TextInputModel>();
408 model->AddCodePoint('A');
409 model->AddCodePoint('B');
410 model->AddCodePoint(0x1f604);
411 model->AddCodePoint('D');
412 model->AddCodePoint('E');
413 EXPECT_EQ(model->selection(), TextRange(6));
414 EXPECT_EQ(model->composing_range(), TextRange(0));
415 EXPECT_STREQ(model->GetText().c_str(), "AB😄DE");
416 }

## ◆ TEST() [119/312]

flutter::TEST | ( | TextInputModel | ,
|  | AddCodePointReverseSelection |
| ) |  |

Definition at line 428 of file text_input_model_unittests.cc.

428 {
429 auto model = std::make_unique<TextInputModel>();
430 model->SetText("ABCDE");
431 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
432 model->AddCodePoint('x');
433 EXPECT_EQ(model->selection(), TextRange(2));
434 EXPECT_EQ(model->composing_range(), TextRange(0));
435 EXPECT_STREQ(model->GetText().c_str(), "AxE");
436 }

## ◆ TEST() [120/312]

flutter::TEST | ( | TextInputModel | ,
|  | AddCodePointReverseSelectionWideCharacter |
| ) |  |

Definition at line 448 of file text_input_model_unittests.cc.

448 {
449 auto model = std::make_unique<TextInputModel>();
450 model->SetText("ABCDE");
451 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
452 model->AddCodePoint(0x1f604);
453 EXPECT_EQ(model->selection(), TextRange(3));
454 EXPECT_EQ(model->composing_range(), TextRange(0));
455 EXPECT_STREQ(model->GetText().c_str(), "A😄E");
456 }

## ◆ TEST() [121/312]

flutter::TEST | ( | TextInputModel | ,
|  | AddCodePointSelection |
| ) |  |

Definition at line 418 of file text_input_model_unittests.cc.

418 {
419 auto model = std::make_unique<TextInputModel>();
420 model->SetText("ABCDE");
421 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
422 model->AddCodePoint('x');
423 EXPECT_EQ(model->selection(), TextRange(2));
424 EXPECT_EQ(model->composing_range(), TextRange(0));
425 EXPECT_STREQ(model->GetText().c_str(), "AxE");
426 }

## ◆ TEST() [122/312]

flutter::TEST | ( | TextInputModel | ,
|  | AddCodePointSelectionWideCharacter |
| ) |  |

Definition at line 438 of file text_input_model_unittests.cc.

438 {
439 auto model = std::make_unique<TextInputModel>();
440 model->SetText("ABCDE");
441 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
442 model->AddCodePoint(0x1f604);
443 EXPECT_EQ(model->selection(), TextRange(3));
444 EXPECT_EQ(model->composing_range(), TextRange(0));
445 EXPECT_STREQ(model->GetText().c_str(), "A😄E");
446 }

## ◆ TEST() [123/312]

flutter::TEST | ( | TextInputModel | ,
|  | AddText |
| ) |  |

Definition at line 458 of file text_input_model_unittests.cc.

458 {
459 auto model = std::make_unique<TextInputModel>();
460 model->AddText(u"ABCDE");
461 model->AddText("😄");
462 model->AddText("FGHIJ");
463 EXPECT_EQ(model->selection(), TextRange(12));
464 EXPECT_EQ(model->composing_range(), TextRange(0));
465 EXPECT_STREQ(model->GetText().c_str(), "ABCDE😄FGHIJ");
466 }

## ◆ TEST() [124/312]

flutter::TEST | ( | TextInputModel | ,
|  | AddTextReverseSelection |
| ) |  |

Definition at line 478 of file text_input_model_unittests.cc.

478 {
479 auto model = std::make_unique<TextInputModel>();
480 model->SetText("ABCDE");
481 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
482 model->AddText("xy");
483 EXPECT_EQ(model->selection(), TextRange(3));
484 EXPECT_EQ(model->composing_range(), TextRange(0));
485 EXPECT_STREQ(model->GetText().c_str(), "AxyE");
486 }

## ◆ TEST() [125/312]

flutter::TEST | ( | TextInputModel | ,
|  | AddTextReverseSelectionWideCharacter |
| ) |  |

Definition at line 498 of file text_input_model_unittests.cc.

498 {
499 auto model = std::make_unique<TextInputModel>();
500 model->SetText("ABCDE");
501 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
502 model->AddText(u"😄🙃");
503 EXPECT_EQ(model->selection(), TextRange(5));
504 EXPECT_EQ(model->composing_range(), TextRange(0));
505 EXPECT_STREQ(model->GetText().c_str(), "A😄🙃E");
506 }

## ◆ TEST() [126/312]

flutter::TEST | ( | TextInputModel | ,
|  | AddTextSelection |
| ) |  |

Definition at line 468 of file text_input_model_unittests.cc.

468 {
469 auto model = std::make_unique<TextInputModel>();
470 model->SetText("ABCDE");
471 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
472 model->AddText("xy");
473 EXPECT_EQ(model->selection(), TextRange(3));
474 EXPECT_EQ(model->composing_range(), TextRange(0));
475 EXPECT_STREQ(model->GetText().c_str(), "AxyE");
476 }

## ◆ TEST() [127/312]

flutter::TEST | ( | TextInputModel | ,
|  | AddTextSelectionWideCharacter |
| ) |  |

Definition at line 488 of file text_input_model_unittests.cc.

488 {
489 auto model = std::make_unique<TextInputModel>();
490 model->SetText("ABCDE");
491 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
492 model->AddText(u"😄🙃");
493 EXPECT_EQ(model->selection(), TextRange(5));
494 EXPECT_EQ(model->composing_range(), TextRange(0));
495 EXPECT_STREQ(model->GetText().c_str(), "A😄🙃E");
496 }

## ◆ TEST() [128/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceEnd |
| ) |  |

Definition at line 867 of file text_input_model_unittests.cc.

867 {
868 auto model = std::make_unique<TextInputModel>();
869 model->SetText("ABCDE");
870 EXPECT_TRUE(model->SetSelection(TextRange(5)));
871 ASSERT_TRUE(model->Backspace());
872 EXPECT_EQ(model->selection(), TextRange(4));
873 EXPECT_EQ(model->composing_range(), TextRange(0));
874 EXPECT_STREQ(model->GetText().c_str(), "ABCD");
875 }

## ◆ TEST() [129/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceEndComposing |
| ) |  |

Definition at line 951 of file text_input_model_unittests.cc.

951 {
952 auto model = std::make_unique<TextInputModel>();
953 model->SetText("ABCDE");
954 model->BeginComposing();
955 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
956 ASSERT_TRUE(model->Backspace());
957 EXPECT_EQ(model->selection(), TextRange(3));
958 EXPECT_EQ(model->composing_range(), TextRange(1, 3));
959 EXPECT_STREQ(model->GetText().c_str(), "ABCE");
960 }

## ◆ TEST() [130/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceEndReverseComposing |
| ) |  |

Definition at line 962 of file text_input_model_unittests.cc.

962 {
963 auto model = std::make_unique<TextInputModel>();
964 model->SetText("ABCDE");
965 model->BeginComposing();
966 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
967 ASSERT_TRUE(model->Backspace());
968 EXPECT_EQ(model->selection(), TextRange(3));
969 EXPECT_EQ(model->composing_range(), TextRange(3, 1));
970 EXPECT_STREQ(model->GetText().c_str(), "ABCE");
971 }

## ◆ TEST() [131/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceMiddle |
| ) |  |

Definition at line 857 of file text_input_model_unittests.cc.

857 {
858 auto model = std::make_unique<TextInputModel>();
859 model->SetText("ABCDE");
860 EXPECT_TRUE(model->SetSelection(TextRange(2)));
861 ASSERT_TRUE(model->Backspace());
862 EXPECT_EQ(model->selection(), TextRange(1));
863 EXPECT_EQ(model->composing_range(), TextRange(0));
864 EXPECT_STREQ(model->GetText().c_str(), "ACDE");
865 }

## ◆ TEST() [132/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceMiddleComposing |
| ) |  |

Definition at line 929 of file text_input_model_unittests.cc.

929 {
930 auto model = std::make_unique<TextInputModel>();
931 model->SetText("ABCDE");
932 model->BeginComposing();
933 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
934 ASSERT_TRUE(model->Backspace());
935 EXPECT_EQ(model->selection(), TextRange(1));
936 EXPECT_EQ(model->composing_range(), TextRange(1, 3));
937 EXPECT_STREQ(model->GetText().c_str(), "ACDE");
938 }

## ◆ TEST() [133/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceMiddleReverseComposing |
| ) |  |

Definition at line 940 of file text_input_model_unittests.cc.

940 {
941 auto model = std::make_unique<TextInputModel>();
942 model->SetText("ABCDE");
943 model->BeginComposing();
944 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 1));
945 ASSERT_TRUE(model->Backspace());
946 EXPECT_EQ(model->selection(), TextRange(1));
947 EXPECT_EQ(model->composing_range(), TextRange(3, 1));
948 EXPECT_STREQ(model->GetText().c_str(), "ACDE");
949 }

## ◆ TEST() [134/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceReverseSelection |
| ) |  |

Definition at line 897 of file text_input_model_unittests.cc.

897 {
898 auto model = std::make_unique<TextInputModel>();
899 model->SetText("ABCDE");
900 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
901 ASSERT_TRUE(model->Delete());
902 EXPECT_EQ(model->selection(), TextRange(1));
903 EXPECT_EQ(model->composing_range(), TextRange(0));
904 EXPECT_STREQ(model->GetText().c_str(), "AE");
905 }

## ◆ TEST() [135/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceSelection |
| ) |  |

Definition at line 887 of file text_input_model_unittests.cc.

887 {
888 auto model = std::make_unique<TextInputModel>();
889 model->SetText("ABCDE");
890 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
891 ASSERT_TRUE(model->Delete());
892 EXPECT_EQ(model->selection(), TextRange(1));
893 EXPECT_EQ(model->composing_range(), TextRange(0));
894 EXPECT_STREQ(model->GetText().c_str(), "AE");
895 }

## ◆ TEST() [136/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceStart |
| ) |  |

Definition at line 847 of file text_input_model_unittests.cc.

847 {
848 auto model = std::make_unique<TextInputModel>();
849 model->SetText("ABCDE");
850 EXPECT_TRUE(model->SetSelection(TextRange(0)));
851 ASSERT_FALSE(model->Backspace());
852 EXPECT_EQ(model->selection(), TextRange(0));
853 EXPECT_EQ(model->composing_range(), TextRange(0));
854 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
855 }

## ◆ TEST() [137/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceStartComposing |
| ) |  |

Definition at line 907 of file text_input_model_unittests.cc.

907 {
908 auto model = std::make_unique<TextInputModel>();
909 model->SetText("ABCDE");
910 model->BeginComposing();
911 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
912 ASSERT_FALSE(model->Backspace());
913 EXPECT_EQ(model->selection(), TextRange(1));
914 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
915 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
916 }

## ◆ TEST() [138/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceStartReverseComposing |
| ) |  |

Definition at line 918 of file text_input_model_unittests.cc.

918 {
919 auto model = std::make_unique<TextInputModel>();
920 model->SetText("ABCDE");
921 model->BeginComposing();
922 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 0));
923 ASSERT_FALSE(model->Backspace());
924 EXPECT_EQ(model->selection(), TextRange(1));
925 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
926 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
927 }

## ◆ TEST() [139/312]

flutter::TEST | ( | TextInputModel | ,
|  | BackspaceWideCharacters |
| ) |  |

Definition at line 877 of file text_input_model_unittests.cc.

877 {
878 auto model = std::make_unique<TextInputModel>();
879 model->SetText("😄🙃🤪🧐");
880 EXPECT_TRUE(model->SetSelection(TextRange(4)));
881 ASSERT_TRUE(model->Backspace());
882 EXPECT_EQ(model->selection(), TextRange(2));
883 EXPECT_EQ(model->composing_range(), TextRange(0));
884 EXPECT_STREQ(model->GetText().c_str(), "😄🤪🧐");
885 }

## ◆ TEST() [140/312]

flutter::TEST | ( | TextInputModel | ,
|  | CommitComposingNoTextWithNoSelection |
| ) |  |

Definition at line 230 of file text_input_model_unittests.cc.

230 {
231 auto model = std::make_unique<TextInputModel>();
232 model->SetText("ABCDE");
233 model->SetSelection(TextRange(0));
234
235 // Verify no changes on BeginComposing.
236 model->BeginComposing();
237 EXPECT_EQ(model->selection(), TextRange(0));
238 EXPECT_EQ(model->composing_range(), TextRange(0));
239 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
240
241 // Verify no changes on CommitComposing.
242 model->CommitComposing();
243 EXPECT_EQ(model->selection(), TextRange(0));
244 EXPECT_EQ(model->composing_range(), TextRange(0));
245 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
246
247 // Verify no changes on CommitComposing.
248 model->EndComposing();
249 EXPECT_EQ(model->selection(), TextRange(0));
250 EXPECT_EQ(model->composing_range(), TextRange(0));
251 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
252 }

## ◆ TEST() [141/312]

flutter::TEST | ( | TextInputModel | ,
|  | CommitComposingNoTextWithSelection |
| ) |  |

Definition at line 255 of file text_input_model_unittests.cc.

255 {
256 auto model = std::make_unique<TextInputModel>();
257 model->SetText("ABCDE");
258 model->SetSelection(TextRange(1, 3));
259
260 // Verify no changes on BeginComposing.
261 model->BeginComposing();
262 EXPECT_EQ(model->selection(), TextRange(1, 3));
263 EXPECT_EQ(model->composing_range(), TextRange(1));
264 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
265
266 // Verify no changes on CommitComposing.
267 model->CommitComposing();
268 EXPECT_EQ(model->selection(), TextRange(1, 3));
269 EXPECT_EQ(model->composing_range(), TextRange(1));
270 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
271
272 // Verify no changes on CommitComposing.
273 model->EndComposing();
274 EXPECT_EQ(model->selection(), TextRange(1, 3));
275 EXPECT_EQ(model->composing_range(), TextRange(0));
276 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
277 }

## ◆ TEST() [142/312]

flutter::TEST | ( | TextInputModel | ,
|  | CommitComposingTextWithNoSelection |
| ) |  |

Definition at line 280 of file text_input_model_unittests.cc.

280 {
281 auto model = std::make_unique<TextInputModel>();
282 model->SetText("ABCDE");
283 model->SetSelection(TextRange(1));
284
285 // Verify no changes on BeginComposing.
286 model->BeginComposing();
287 EXPECT_EQ(model->selection(), TextRange(1));
288 EXPECT_EQ(model->composing_range(), TextRange(1));
289 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
290
291 // Verify selection base, extent and composing extent increment as text is
292 // entered. Verify composing base does not change.
293 model->UpdateComposingText("つ");
294 EXPECT_EQ(model->selection(), TextRange(2));
295 EXPECT_EQ(model->composing_range(), TextRange(1, 2));
296 EXPECT_STREQ(model->GetText().c_str(), "AつBCDE");
297 model->UpdateComposingText("つる");
298 EXPECT_EQ(model->selection(), TextRange(3));
299 EXPECT_EQ(model->composing_range(), TextRange(1, 3));
300 EXPECT_STREQ(model->GetText().c_str(), "AつるBCDE");
301
302 // Verify that cursor position is set to correct offset from composing base.
303 model->UpdateComposingText("鶴");
304 EXPECT_TRUE(model->SetSelection(TextRange(1)));
305 EXPECT_EQ(model->selection(), TextRange(1));
306 EXPECT_EQ(model->composing_range(), TextRange(1, 2));
307 EXPECT_STREQ(model->GetText().c_str(), "A鶴BCDE");
308
309 // Verify composing base is set to composing extent on commit.
310 model->CommitComposing();
311 EXPECT_EQ(model->selection(), TextRange(2));
312 EXPECT_EQ(model->composing_range(), TextRange(2));
313 EXPECT_STREQ(model->GetText().c_str(), "A鶴BCDE");
314
315 // Verify that further text entry increments the selection base, extent and
316 // the composing extent. Verify that composing base does not change.
317 model->UpdateComposingText("が");
318 EXPECT_EQ(model->selection(), TextRange(3));
319 EXPECT_EQ(model->composing_range(), TextRange(2, 3));
320 EXPECT_STREQ(model->GetText().c_str(), "A鶴がBCDE");
321
322 // Verify composing base is set to composing extent on commit.
323 model->CommitComposing();
324 EXPECT_EQ(model->selection(), TextRange(3));
325 EXPECT_EQ(model->composing_range(), TextRange(3));
326 EXPECT_STREQ(model->GetText().c_str(), "A鶴がBCDE");
327
328 // Verify no changes on EndComposing.
329 model->EndComposing();
330 EXPECT_EQ(model->selection(), TextRange(3));
331 EXPECT_EQ(model->composing_range(), TextRange(0));
332 EXPECT_STREQ(model->GetText().c_str(), "A鶴がBCDE");
333 }

## ◆ TEST() [143/312]

flutter::TEST | ( | TextInputModel | ,
|  | CommitComposingTextWithSelection |
| ) |  |

Definition at line 336 of file text_input_model_unittests.cc.

336 {
337 auto model = std::make_unique<TextInputModel>();
338 model->SetText("ABCDE");
339 model->SetSelection(TextRange(1, 3));
340
341 // Verify no changes on BeginComposing.
342 model->BeginComposing();
343 EXPECT_EQ(model->selection(), TextRange(1, 3));
344 EXPECT_EQ(model->composing_range(), TextRange(1));
345 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
346
347 // Verify selection is replaced and selection base, extent and composing
348 // extent increment to the position immediately after the composing text.
349 // Verify composing base does not change.
350 model->UpdateComposingText("つ");
351 EXPECT_EQ(model->selection(), TextRange(2));
352 EXPECT_EQ(model->composing_range(), TextRange(1, 2));
353 EXPECT_STREQ(model->GetText().c_str(), "AつDE");
354
355 // Verify that further text entry increments the selection base, extent and
356 // the composing extent. Verify that composing base does not change.
357 model->UpdateComposingText("つる");
358 EXPECT_EQ(model->selection(), TextRange(3));
359 EXPECT_EQ(model->composing_range(), TextRange(1, 3));
360 EXPECT_STREQ(model->GetText().c_str(), "AつるDE");
361
362 // Verify that cursor position is set to correct offset from composing base.
363 model->UpdateComposingText("鶴");
364 EXPECT_TRUE(model->SetSelection(TextRange(1)));
365 EXPECT_EQ(model->selection(), TextRange(1));
366 EXPECT_EQ(model->composing_range(), TextRange(1, 2));
367 EXPECT_STREQ(model->GetText().c_str(), "A鶴DE");
368
369 // Verify composing base is set to composing extent on commit.
370 model->CommitComposing();
371 EXPECT_EQ(model->selection(), TextRange(2));
372 EXPECT_EQ(model->composing_range(), TextRange(2));
373 EXPECT_STREQ(model->GetText().c_str(), "A鶴DE");
374
375 // Verify that further text entry increments the selection base, extent and
376 // the composing extent. Verify that composing base does not change.
377 model->UpdateComposingText("が");
378 EXPECT_EQ(model->selection(), TextRange(3));
379 EXPECT_EQ(model->composing_range(), TextRange(2, 3));
380 EXPECT_STREQ(model->GetText().c_str(), "A鶴がDE");
381
382 // Verify composing base is set to composing extent on commit.
383 model->CommitComposing();
384 EXPECT_EQ(model->selection(), TextRange(3));
385 EXPECT_EQ(model->composing_range(), TextRange(3));
386 EXPECT_STREQ(model->GetText().c_str(), "A鶴がDE");
387
388 // Verify no changes on EndComposing.
389 model->EndComposing();
390 EXPECT_EQ(model->selection(), TextRange(3));
391 EXPECT_EQ(model->composing_range(), TextRange(0));
392 EXPECT_STREQ(model->GetText().c_str(), "A鶴がDE");
393 }

## ◆ TEST() [144/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteEnd |
| ) |  |

Definition at line 528 of file text_input_model_unittests.cc.

528 {
529 auto model = std::make_unique<TextInputModel>();
530 model->SetText("ABCDE");
531 EXPECT_TRUE(model->SetSelection(TextRange(5)));
532 ASSERT_FALSE(model->Delete());
533 EXPECT_EQ(model->selection(), TextRange(5));
534 EXPECT_EQ(model->composing_range(), TextRange(0));
535 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
536 }

## ◆ TEST() [145/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteEndComposing |
| ) |  |

Definition at line 616 of file text_input_model_unittests.cc.

616 {
617 auto model = std::make_unique<TextInputModel>();
618 model->SetText("ABCDE");
619 model->BeginComposing();
620 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
621 ASSERT_FALSE(model->Delete());
622 EXPECT_EQ(model->selection(), TextRange(4));
623 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
624 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
625 }

## ◆ TEST() [146/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteEndReverseComposing |
| ) |  |

Definition at line 627 of file text_input_model_unittests.cc.

627 {
628 auto model = std::make_unique<TextInputModel>();
629 model->SetText("ABCDE");
630 model->BeginComposing();
631 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
632 ASSERT_FALSE(model->Delete());
633 EXPECT_EQ(model->selection(), TextRange(4));
634 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
635 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
636 }

## ◆ TEST() [147/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteMiddle |
| ) |  |

Definition at line 518 of file text_input_model_unittests.cc.

518 {
519 auto model = std::make_unique<TextInputModel>();
520 model->SetText("ABCDE");
521 EXPECT_TRUE(model->SetSelection(TextRange(2)));
522 ASSERT_TRUE(model->Delete());
523 EXPECT_EQ(model->selection(), TextRange(2));
524 EXPECT_EQ(model->composing_range(), TextRange(0));
525 EXPECT_STREQ(model->GetText().c_str(), "ABDE");
526 }

## ◆ TEST() [148/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteMiddleComposing |
| ) |  |

Definition at line 594 of file text_input_model_unittests.cc.

594 {
595 auto model = std::make_unique<TextInputModel>();
596 model->SetText("ABCDE");
597 model->BeginComposing();
598 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
599 ASSERT_TRUE(model->Delete());
600 EXPECT_EQ(model->selection(), TextRange(2));
601 EXPECT_EQ(model->composing_range(), TextRange(1, 3));
602 EXPECT_STREQ(model->GetText().c_str(), "ABDE");
603 }

## ◆ TEST() [149/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteMiddleReverseComposing |
| ) |  |

Definition at line 605 of file text_input_model_unittests.cc.

605 {
606 auto model = std::make_unique<TextInputModel>();
607 model->SetText("ABCDE");
608 model->BeginComposing();
609 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 1));
610 ASSERT_TRUE(model->Delete());
611 EXPECT_EQ(model->selection(), TextRange(2));
612 EXPECT_EQ(model->composing_range(), TextRange(3, 1));
613 EXPECT_STREQ(model->GetText().c_str(), "ABDE");
614 }

## ◆ TEST() [150/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteReverseSelection |
| ) |  |

Definition at line 558 of file text_input_model_unittests.cc.

558 {
559 auto model = std::make_unique<TextInputModel>();
560 model->SetText("ABCDE");
561 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
562 ASSERT_TRUE(model->Delete());
563 EXPECT_EQ(model->selection(), TextRange(1));
564 EXPECT_EQ(model->composing_range(), TextRange(0));
565 EXPECT_STREQ(model->GetText().c_str(), "AE");
566 }

## ◆ TEST() [151/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSelection |
| ) |  |

Definition at line 548 of file text_input_model_unittests.cc.

548 {
549 auto model = std::make_unique<TextInputModel>();
550 model->SetText("ABCDE");
551 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
552 ASSERT_TRUE(model->Delete());
553 EXPECT_EQ(model->selection(), TextRange(1));
554 EXPECT_EQ(model->composing_range(), TextRange(0));
555 EXPECT_STREQ(model->GetText().c_str(), "AE");
556 }

## ◆ TEST() [152/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteStart |
| ) |  |

Definition at line 508 of file text_input_model_unittests.cc.

508 {
509 auto model = std::make_unique<TextInputModel>();
510 model->SetText("ABCDE");
511 EXPECT_TRUE(model->SetSelection(TextRange(0)));
512 ASSERT_TRUE(model->Delete());
513 EXPECT_EQ(model->selection(), TextRange(0));
514 EXPECT_EQ(model->composing_range(), TextRange(0));
515 EXPECT_STREQ(model->GetText().c_str(), "BCDE");
516 }

## ◆ TEST() [153/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteStartComposing |
| ) |  |

Definition at line 568 of file text_input_model_unittests.cc.

568 {
569 auto model = std::make_unique<TextInputModel>();
570 model->SetText("ABCDE");
571 model->BeginComposing();
572 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
573 EXPECT_EQ(model->selection(), TextRange(1));
574 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
575 ASSERT_TRUE(model->Delete());
576 EXPECT_EQ(model->selection(), TextRange(1));
577 EXPECT_EQ(model->composing_range(), TextRange(1, 3));
578 EXPECT_STREQ(model->GetText().c_str(), "ACDE");
579 }

## ◆ TEST() [154/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteStartReverseComposing |
| ) |  |

Definition at line 581 of file text_input_model_unittests.cc.

581 {
582 auto model = std::make_unique<TextInputModel>();
583 model->SetText("ABCDE");
584 model->BeginComposing();
585 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 0));
586 EXPECT_EQ(model->selection(), TextRange(1));
587 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
588 ASSERT_TRUE(model->Delete());
589 EXPECT_EQ(model->selection(), TextRange(1));
590 EXPECT_EQ(model->composing_range(), TextRange(3, 1));
591 EXPECT_STREQ(model->GetText().c_str(), "ACDE");
592 }

## ◆ TEST() [155/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAfterCursor |
| ) |  |

Definition at line 764 of file text_input_model_unittests.cc.

764 {
765 auto model = std::make_unique<TextInputModel>();
766 model->SetText("ABCDE");
767 EXPECT_TRUE(model->SetSelection(TextRange(2)));
768 EXPECT_TRUE(model->DeleteSurrounding(1, 1));
769 EXPECT_EQ(model->selection(), TextRange(2));
770 EXPECT_EQ(model->composing_range(), TextRange(0));
771 EXPECT_STREQ(model->GetText().c_str(), "ABCE");
772 }

## ◆ TEST() [156/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAfterCursorAll |
| ) |  |

Definition at line 785 of file text_input_model_unittests.cc.

785 {
786 auto model = std::make_unique<TextInputModel>();
787 model->SetText("ABCDE");
788 EXPECT_TRUE(model->SetSelection(TextRange(2)));
789 EXPECT_TRUE(model->DeleteSurrounding(1, 2));
790 EXPECT_EQ(model->selection(), TextRange(2));
791 EXPECT_EQ(model->composing_range(), TextRange(0));
792 EXPECT_STREQ(model->GetText().c_str(), "ABC");
793 }

## ◆ TEST() [157/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAfterCursorAllComposing |
| ) |  |

Definition at line 795 of file text_input_model_unittests.cc.

795 {
796 auto model = std::make_unique<TextInputModel>();
797 model->SetText("ABCDE");
798 model->BeginComposing();
799 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
800 EXPECT_TRUE(model->DeleteSurrounding(1, 2));
801 EXPECT_EQ(model->selection(), TextRange(1));
802 EXPECT_EQ(model->composing_range(), TextRange(1, 2));
803 EXPECT_STREQ(model->GetText().c_str(), "ABE");
804 }

## ◆ TEST() [158/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAfterCursorComposing |
| ) |  |

Definition at line 774 of file text_input_model_unittests.cc.

774 {
775 auto model = std::make_unique<TextInputModel>();
776 model->SetText("ABCDE");
777 model->BeginComposing();
778 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
779 EXPECT_TRUE(model->DeleteSurrounding(1, 1));
780 EXPECT_EQ(model->selection(), TextRange(1));
781 EXPECT_EQ(model->composing_range(), TextRange(1, 3));
782 EXPECT_STREQ(model->GetText().c_str(), "ABDE");
783 }

## ◆ TEST() [159/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAfterCursorGreedy |
| ) |  |

Definition at line 806 of file text_input_model_unittests.cc.

806 {
807 auto model = std::make_unique<TextInputModel>();
808 model->SetText("ABCDE");
809 EXPECT_TRUE(model->SetSelection(TextRange(2)));
810 EXPECT_TRUE(model->DeleteSurrounding(1, 3));
811 EXPECT_EQ(model->selection(), TextRange(2));
812 EXPECT_EQ(model->composing_range(), TextRange(0));
813 EXPECT_STREQ(model->GetText().c_str(), "ABC");
814 }

## ◆ TEST() [160/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAfterCursorGreedyComposing |
| ) |  |

Definition at line 816 of file text_input_model_unittests.cc.

816 {
817 auto model = std::make_unique<TextInputModel>();
818 model->SetText("ABCDE");
819 model->BeginComposing();
820 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
821 EXPECT_TRUE(model->DeleteSurrounding(1, 3));
822 EXPECT_EQ(model->selection(), TextRange(1));
823 EXPECT_EQ(model->composing_range(), TextRange(1, 2));
824 EXPECT_STREQ(model->GetText().c_str(), "ABE");
825 }

## ◆ TEST() [161/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAtCursor |
| ) |  |

Definition at line 638 of file text_input_model_unittests.cc.

638 {
639 auto model = std::make_unique<TextInputModel>();
640 model->SetText("ABCDE");
641 EXPECT_TRUE(model->SetSelection(TextRange(2)));
642 EXPECT_TRUE(model->DeleteSurrounding(0, 1));
643 EXPECT_EQ(model->selection(), TextRange(2));
644 EXPECT_EQ(model->composing_range(), TextRange(0));
645 EXPECT_STREQ(model->GetText().c_str(), "ABDE");
646 }

## ◆ TEST() [162/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAtCursorAll |
| ) |  |

Definition at line 659 of file text_input_model_unittests.cc.

659 {
660 auto model = std::make_unique<TextInputModel>();
661 model->SetText("ABCDE");
662 EXPECT_TRUE(model->SetSelection(TextRange(2)));
663 EXPECT_TRUE(model->DeleteSurrounding(0, 3));
664 EXPECT_EQ(model->selection(), TextRange(2));
665 EXPECT_EQ(model->composing_range(), TextRange(0));
666 EXPECT_STREQ(model->GetText().c_str(), "AB");
667 }

## ◆ TEST() [163/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAtCursorAllComposing |
| ) |  |

Definition at line 669 of file text_input_model_unittests.cc.

669 {
670 auto model = std::make_unique<TextInputModel>();
671 model->SetText("ABCDE");
672 model->BeginComposing();
673 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
674 EXPECT_TRUE(model->DeleteSurrounding(0, 2));
675 EXPECT_EQ(model->selection(), TextRange(2));
676 EXPECT_EQ(model->composing_range(), TextRange(1, 2));
677 EXPECT_STREQ(model->GetText().c_str(), "ABE");
678 }

## ◆ TEST() [164/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAtCursorComposing |
| ) |  |

Definition at line 648 of file text_input_model_unittests.cc.

648 {
649 auto model = std::make_unique<TextInputModel>();
650 model->SetText("ABCDE");
651 model->BeginComposing();
652 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
653 EXPECT_TRUE(model->DeleteSurrounding(0, 1));
654 EXPECT_EQ(model->selection(), TextRange(2));
655 EXPECT_EQ(model->composing_range(), TextRange(1, 3));
656 EXPECT_STREQ(model->GetText().c_str(), "ABDE");
657 }

## ◆ TEST() [165/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAtCursorGreedy |
| ) |  |

Definition at line 680 of file text_input_model_unittests.cc.

680 {
681 auto model = std::make_unique<TextInputModel>();
682 model->SetText("ABCDE");
683 EXPECT_TRUE(model->SetSelection(TextRange(2)));
684 EXPECT_TRUE(model->DeleteSurrounding(0, 4));
685 EXPECT_EQ(model->selection(), TextRange(2));
686 EXPECT_EQ(model->composing_range(), TextRange(0));
687 EXPECT_STREQ(model->GetText().c_str(), "AB");
688 }

## ◆ TEST() [166/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingAtCursorGreedyComposing |
| ) |  |

Definition at line 690 of file text_input_model_unittests.cc.

690 {
691 auto model = std::make_unique<TextInputModel>();
692 model->SetText("ABCDE");
693 model->BeginComposing();
694 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
695 EXPECT_TRUE(model->DeleteSurrounding(0, 4));
696 EXPECT_EQ(model->selection(), TextRange(2));
697 EXPECT_EQ(model->composing_range(), TextRange(1, 2));
698 EXPECT_STREQ(model->GetText().c_str(), "ABE");
699 }

## ◆ TEST() [167/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingBeforeCursor |
| ) |  |

Definition at line 701 of file text_input_model_unittests.cc.

701 {
702 auto model = std::make_unique<TextInputModel>();
703 model->SetText("ABCDE");
704 EXPECT_TRUE(model->SetSelection(TextRange(2)));
705 EXPECT_TRUE(model->DeleteSurrounding(-1, 1));
706 EXPECT_EQ(model->selection(), TextRange(1));
707 EXPECT_EQ(model->composing_range(), TextRange(0));
708 EXPECT_STREQ(model->GetText().c_str(), "ACDE");
709 }

## ◆ TEST() [168/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingBeforeCursorAll |
| ) |  |

Definition at line 722 of file text_input_model_unittests.cc.

722 {
723 auto model = std::make_unique<TextInputModel>();
724 model->SetText("ABCDE");
725 EXPECT_TRUE(model->SetSelection(TextRange(2)));
726 EXPECT_TRUE(model->DeleteSurrounding(-2, 2));
727 EXPECT_EQ(model->selection(), TextRange(0));
728 EXPECT_EQ(model->composing_range(), TextRange(0));
729 EXPECT_STREQ(model->GetText().c_str(), "CDE");
730 }

## ◆ TEST() [169/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingBeforeCursorAllComposing |
| ) |  |

Definition at line 732 of file text_input_model_unittests.cc.

732 {
733 auto model = std::make_unique<TextInputModel>();
734 model->SetText("ABCDE");
735 model->BeginComposing();
736 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 2));
737 EXPECT_TRUE(model->DeleteSurrounding(-2, 2));
738 EXPECT_EQ(model->selection(), TextRange(1));
739 EXPECT_EQ(model->composing_range(), TextRange(1, 2));
740 EXPECT_STREQ(model->GetText().c_str(), "ADE");
741 }

## ◆ TEST() [170/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingBeforeCursorComposing |
| ) |  |

Definition at line 711 of file text_input_model_unittests.cc.

711 {
712 auto model = std::make_unique<TextInputModel>();
713 model->SetText("ABCDE");
714 model->BeginComposing();
715 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 2));
716 EXPECT_TRUE(model->DeleteSurrounding(-1, 1));
717 EXPECT_EQ(model->selection(), TextRange(2));
718 EXPECT_EQ(model->composing_range(), TextRange(1, 3));
719 EXPECT_STREQ(model->GetText().c_str(), "ABDE");
720 }

## ◆ TEST() [171/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingBeforeCursorGreedy |
| ) |  |

Definition at line 743 of file text_input_model_unittests.cc.

743 {
744 auto model = std::make_unique<TextInputModel>();
745 model->SetText("ABCDE");
746 EXPECT_TRUE(model->SetSelection(TextRange(2)));
747 EXPECT_TRUE(model->DeleteSurrounding(-3, 3));
748 EXPECT_EQ(model->selection(), TextRange(0));
749 EXPECT_EQ(model->composing_range(), TextRange(0));
750 EXPECT_STREQ(model->GetText().c_str(), "CDE");
751 }

## ◆ TEST() [172/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingBeforeCursorGreedyComposing |
| ) |  |

Definition at line 753 of file text_input_model_unittests.cc.

753 {
754 auto model = std::make_unique<TextInputModel>();
755 model->SetText("ABCDE");
756 model->BeginComposing();
757 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 2));
758 EXPECT_TRUE(model->DeleteSurrounding(-3, 3));
759 EXPECT_EQ(model->selection(), TextRange(1));
760 EXPECT_EQ(model->composing_range(), TextRange(1, 2));
761 EXPECT_STREQ(model->GetText().c_str(), "ADE");
762 }

## ◆ TEST() [173/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingReverseSelection |
| ) |  |

Definition at line 837 of file text_input_model_unittests.cc.

837 {
838 auto model = std::make_unique<TextInputModel>();
839 model->SetText("ABCDE");
840 EXPECT_TRUE(model->SetSelection(TextRange(4, 3)));
841 EXPECT_TRUE(model->DeleteSurrounding(0, 1));
842 EXPECT_EQ(model->selection(), TextRange(3));
843 EXPECT_EQ(model->composing_range(), TextRange(0));
844 EXPECT_STREQ(model->GetText().c_str(), "ABCE");
845 }

## ◆ TEST() [174/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteSurroundingSelection |
| ) |  |

Definition at line 827 of file text_input_model_unittests.cc.

827 {
828 auto model = std::make_unique<TextInputModel>();
829 model->SetText("ABCDE");
830 EXPECT_TRUE(model->SetSelection(TextRange(2, 3)));
831 EXPECT_TRUE(model->DeleteSurrounding(0, 1));
832 EXPECT_EQ(model->selection(), TextRange(3));
833 EXPECT_EQ(model->composing_range(), TextRange(0));
834 EXPECT_STREQ(model->GetText().c_str(), "ABCE");
835 }

## ◆ TEST() [175/312]

flutter::TEST | ( | TextInputModel | ,
|  | DeleteWideCharacters |
| ) |  |

Definition at line 538 of file text_input_model_unittests.cc.

538 {
539 auto model = std::make_unique<TextInputModel>();
540 model->SetText("😄🙃🤪🧐");
541 EXPECT_TRUE(model->SetSelection(TextRange(4)));
542 ASSERT_TRUE(model->Delete());
543 EXPECT_EQ(model->selection(), TextRange(4));
544 EXPECT_EQ(model->composing_range(), TextRange(0));
545 EXPECT_STREQ(model->GetText().c_str(), "😄🙃🧐");
546 }

## ◆ TEST() [176/312]

flutter::TEST | ( | TextInputModel | ,
|  | GetCursorOffset |
| ) |  |

Definition at line 1691 of file text_input_model_unittests.cc.

1691 {
1692 auto model = std::make_unique<TextInputModel>();
1693 // These characters take 1, 2, 3 and 4 bytes in UTF-8.
1694 model->SetText("$¢€𐍈");
1695 EXPECT_TRUE(model->SetSelection(TextRange(0)));
1696 EXPECT_EQ(model->GetCursorOffset(), 0);
1697 EXPECT_TRUE(model->MoveCursorForward());
1698 EXPECT_EQ(model->GetCursorOffset(), 1);
1699 EXPECT_TRUE(model->MoveCursorForward());
1700 EXPECT_EQ(model->GetCursorOffset(), 3);
1701 EXPECT_TRUE(model->MoveCursorForward());
1702 EXPECT_EQ(model->GetCursorOffset(), 6);
1703 EXPECT_TRUE(model->MoveCursorForward());
1704 EXPECT_EQ(model->GetCursorOffset(), 10);
1705 }

## ◆ TEST() [177/312]

flutter::TEST | ( | TextInputModel | ,
|  | GetCursorOffsetReverseSelection |
| ) |  |

Definition at line 1714 of file text_input_model_unittests.cc.

1714 {
1715 auto model = std::make_unique<TextInputModel>();
1716 model->SetText("ABCDE");
1717 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
1718 EXPECT_EQ(model->GetCursorOffset(), 1);
1719 }

## ◆ TEST() [178/312]

flutter::TEST | ( | TextInputModel | ,
|  | GetCursorOffsetSelection |
| ) |  |

Definition at line 1707 of file text_input_model_unittests.cc.

1707 {
1708 auto model = std::make_unique<TextInputModel>();
1709 model->SetText("ABCDE");
1710 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
1711 EXPECT_EQ(model->GetCursorOffset(), 4);
1712 }

## ◆ TEST() [179/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackEnd |
| ) |  |

Definition at line 1119 of file text_input_model_unittests.cc.

1119 {
1120 auto model = std::make_unique<TextInputModel>();
1121 model->SetText("ABCDE");
1122 EXPECT_TRUE(model->SetSelection(TextRange(5)));
1123 EXPECT_TRUE(model->MoveCursorBack());
1124 EXPECT_EQ(model->selection(), TextRange(4));
1125 EXPECT_EQ(model->composing_range(), TextRange(0));
1126 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1127 }

## ◆ TEST() [180/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackEndComposing |
| ) |  |

Definition at line 1205 of file text_input_model_unittests.cc.

1205 {
1206 auto model = std::make_unique<TextInputModel>();
1207 model->SetText("ABCDE");
1208 model->BeginComposing();
1209 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
1210 EXPECT_TRUE(model->MoveCursorBack());
1211 EXPECT_EQ(model->selection(), TextRange(3));
1212 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1213 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1214 }

## ◆ TEST() [181/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackEndReverseComposing |
| ) |  |

Definition at line 1216 of file text_input_model_unittests.cc.

1216 {
1217 auto model = std::make_unique<TextInputModel>();
1218 model->SetText("ABCDE");
1219 model->BeginComposing();
1220 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
1221 EXPECT_TRUE(model->MoveCursorBack());
1222 EXPECT_EQ(model->selection(), TextRange(3));
1223 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1224 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1225 }

## ◆ TEST() [182/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackMiddle |
| ) |  |

Definition at line 1109 of file text_input_model_unittests.cc.

1109 {
1110 auto model = std::make_unique<TextInputModel>();
1111 model->SetText("ABCDE");
1112 EXPECT_TRUE(model->SetSelection(TextRange(2)));
1113 EXPECT_TRUE(model->MoveCursorBack());
1114 EXPECT_EQ(model->selection(), TextRange(1));
1115 EXPECT_EQ(model->composing_range(), TextRange(0));
1116 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1117 }

## ◆ TEST() [183/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackMiddleComposing |
| ) |  |

Definition at line 1183 of file text_input_model_unittests.cc.

1183 {
1184 auto model = std::make_unique<TextInputModel>();
1185 model->SetText("ABCDE");
1186 model->BeginComposing();
1187 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
1188 EXPECT_TRUE(model->MoveCursorBack());
1189 EXPECT_EQ(model->selection(), TextRange(1));
1190 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1191 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1192 }

## ◆ TEST() [184/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackMiddleReverseComposing |
| ) |  |

Definition at line 1194 of file text_input_model_unittests.cc.

1194 {
1195 auto model = std::make_unique<TextInputModel>();
1196 model->SetText("ABCDE");
1197 model->BeginComposing();
1198 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 1));
1199 EXPECT_TRUE(model->MoveCursorBack());
1200 EXPECT_EQ(model->selection(), TextRange(1));
1201 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1202 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1203 }

## ◆ TEST() [185/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackReverseSelection |
| ) |  |

Definition at line 1149 of file text_input_model_unittests.cc.

1149 {
1150 auto model = std::make_unique<TextInputModel>();
1151 model->SetText("ABCDE");
1152 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
1153 EXPECT_TRUE(model->MoveCursorBack());
1154 EXPECT_EQ(model->selection(), TextRange(1));
1155 EXPECT_EQ(model->composing_range(), TextRange(0));
1156 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1157 }

## ◆ TEST() [186/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackSelection |
| ) |  |

Definition at line 1139 of file text_input_model_unittests.cc.

1139 {
1140 auto model = std::make_unique<TextInputModel>();
1141 model->SetText("ABCDE");
1142 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
1143 EXPECT_TRUE(model->MoveCursorBack());
1144 EXPECT_EQ(model->selection(), TextRange(1));
1145 EXPECT_EQ(model->composing_range(), TextRange(0));
1146 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1147 }

## ◆ TEST() [187/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackStart |
| ) |  |

Definition at line 1099 of file text_input_model_unittests.cc.

1099 {
1100 auto model = std::make_unique<TextInputModel>();
1101 model->SetText("ABCDE");
1102 EXPECT_TRUE(model->SetSelection(TextRange(0)));
1103 EXPECT_FALSE(model->MoveCursorBack());
1104 EXPECT_EQ(model->selection(), TextRange(0));
1105 EXPECT_EQ(model->composing_range(), TextRange(0));
1106 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1107 }

## ◆ TEST() [188/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackStartComposing |
| ) |  |

Definition at line 1159 of file text_input_model_unittests.cc.

1159 {
1160 auto model = std::make_unique<TextInputModel>();
1161 model->SetText("ABCDE");
1162 model->BeginComposing();
1163 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
1164 EXPECT_TRUE(model->SetSelection(TextRange(1)));
1165 EXPECT_FALSE(model->MoveCursorBack());
1166 EXPECT_EQ(model->selection(), TextRange(1));
1167 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1168 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1169 }

## ◆ TEST() [189/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackStartReverseComposing |
| ) |  |

Definition at line 1171 of file text_input_model_unittests.cc.

1171 {
1172 auto model = std::make_unique<TextInputModel>();
1173 model->SetText("ABCDE");
1174 model->BeginComposing();
1175 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 0));
1176 EXPECT_TRUE(model->SetSelection(TextRange(1)));
1177 EXPECT_FALSE(model->MoveCursorBack());
1178 EXPECT_EQ(model->selection(), TextRange(1));
1179 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1180 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1181 }

## ◆ TEST() [190/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorBackWideCharacters |
| ) |  |

Definition at line 1129 of file text_input_model_unittests.cc.

1129 {
1130 auto model = std::make_unique<TextInputModel>();
1131 model->SetText("😄🙃🤪🧐");
1132 EXPECT_TRUE(model->SetSelection(TextRange(4)));
1133 ASSERT_TRUE(model->MoveCursorBack());
1134 EXPECT_EQ(model->selection(), TextRange(2));
1135 EXPECT_EQ(model->composing_range(), TextRange(0));
1136 EXPECT_STREQ(model->GetText().c_str(), "😄🙃🤪🧐");
1137 }

## ◆ TEST() [191/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardEnd |
| ) |  |

Definition at line 993 of file text_input_model_unittests.cc.

993 {
994 auto model = std::make_unique<TextInputModel>();
995 model->SetText("ABCDE");
996 EXPECT_TRUE(model->SetSelection(TextRange(5)));
997 EXPECT_FALSE(model->MoveCursorForward());
998 EXPECT_EQ(model->selection(), TextRange(5));
999 EXPECT_EQ(model->composing_range(), TextRange(0));
1000 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1001 }

## ◆ TEST() [192/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardEndComposing |
| ) |  |

Definition at line 1077 of file text_input_model_unittests.cc.

1077 {
1078 auto model = std::make_unique<TextInputModel>();
1079 model->SetText("ABCDE");
1080 model->BeginComposing();
1081 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
1082 EXPECT_FALSE(model->MoveCursorForward());
1083 EXPECT_EQ(model->selection(), TextRange(4));
1084 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1085 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1086 }

## ◆ TEST() [193/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardEndReverseComposing |
| ) |  |

Definition at line 1088 of file text_input_model_unittests.cc.

1088 {
1089 auto model = std::make_unique<TextInputModel>();
1090 model->SetText("ABCDE");
1091 model->BeginComposing();
1092 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
1093 EXPECT_FALSE(model->MoveCursorForward());
1094 EXPECT_EQ(model->selection(), TextRange(4));
1095 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1096 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1097 }

## ◆ TEST() [194/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardMiddle |
| ) |  |

Definition at line 983 of file text_input_model_unittests.cc.

983 {
984 auto model = std::make_unique<TextInputModel>();
985 model->SetText("ABCDE");
986 EXPECT_TRUE(model->SetSelection(TextRange(2)));
987 EXPECT_TRUE(model->MoveCursorForward());
988 EXPECT_EQ(model->selection(), TextRange(3));
989 EXPECT_EQ(model->composing_range(), TextRange(0));
990 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
991 }

## ◆ TEST() [195/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardMiddleComposing |
| ) |  |

Definition at line 1055 of file text_input_model_unittests.cc.

1055 {
1056 auto model = std::make_unique<TextInputModel>();
1057 model->SetText("ABCDE");
1058 model->BeginComposing();
1059 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
1060 EXPECT_TRUE(model->MoveCursorForward());
1061 EXPECT_EQ(model->selection(), TextRange(3));
1062 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1063 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1064 }

## ◆ TEST() [196/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardMiddleReverseComposing |
| ) |  |

Definition at line 1066 of file text_input_model_unittests.cc.

1066 {
1067 auto model = std::make_unique<TextInputModel>();
1068 model->SetText("ABCDE");
1069 model->BeginComposing();
1070 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 1));
1071 EXPECT_TRUE(model->MoveCursorForward());
1072 EXPECT_EQ(model->selection(), TextRange(3));
1073 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1074 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1075 }

## ◆ TEST() [197/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardReverseSelection |
| ) |  |

Definition at line 1023 of file text_input_model_unittests.cc.

1023 {
1024 auto model = std::make_unique<TextInputModel>();
1025 model->SetText("ABCDE");
1026 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
1027 EXPECT_TRUE(model->MoveCursorForward());
1028 EXPECT_EQ(model->selection(), TextRange(4));
1029 EXPECT_EQ(model->composing_range(), TextRange(0));
1030 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1031 }

## ◆ TEST() [198/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardSelection |
| ) |  |

Definition at line 1013 of file text_input_model_unittests.cc.

1013 {
1014 auto model = std::make_unique<TextInputModel>();
1015 model->SetText("ABCDE");
1016 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
1017 EXPECT_TRUE(model->MoveCursorForward());
1018 EXPECT_EQ(model->selection(), TextRange(4));
1019 EXPECT_EQ(model->composing_range(), TextRange(0));
1020 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1021 }

## ◆ TEST() [199/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardStart |
| ) |  |

Definition at line 973 of file text_input_model_unittests.cc.

973 {
974 auto model = std::make_unique<TextInputModel>();
975 model->SetText("ABCDE");
976 EXPECT_TRUE(model->SetSelection(TextRange(0)));
977 EXPECT_TRUE(model->MoveCursorForward());
978 EXPECT_EQ(model->selection(), TextRange(1));
979 EXPECT_EQ(model->composing_range(), TextRange(0));
980 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
981 }

## ◆ TEST() [200/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardStartComposing |
| ) |  |

Definition at line 1033 of file text_input_model_unittests.cc.

1033 {
1034 auto model = std::make_unique<TextInputModel>();
1035 model->SetText("ABCDE");
1036 model->BeginComposing();
1037 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
1038 EXPECT_TRUE(model->MoveCursorForward());
1039 EXPECT_EQ(model->selection(), TextRange(2));
1040 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1041 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1042 }

## ◆ TEST() [201/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardStartReverseComposing |
| ) |  |

Definition at line 1044 of file text_input_model_unittests.cc.

1044 {
1045 auto model = std::make_unique<TextInputModel>();
1046 model->SetText("ABCDE");
1047 model->BeginComposing();
1048 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 0));
1049 EXPECT_TRUE(model->MoveCursorForward());
1050 EXPECT_EQ(model->selection(), TextRange(2));
1051 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1052 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1053 }

## ◆ TEST() [202/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorForwardWideCharacters |
| ) |  |

Definition at line 1003 of file text_input_model_unittests.cc.

1003 {
1004 auto model = std::make_unique<TextInputModel>();
1005 model->SetText("😄🙃🤪🧐");
1006 EXPECT_TRUE(model->SetSelection(TextRange(4)));
1007 ASSERT_TRUE(model->MoveCursorForward());
1008 EXPECT_EQ(model->selection(), TextRange(6));
1009 EXPECT_EQ(model->composing_range(), TextRange(0));
1010 EXPECT_STREQ(model->GetText().c_str(), "😄🙃🤪🧐");
1011 }

## ◆ TEST() [203/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningEnd |
| ) |  |

Definition at line 1267 of file text_input_model_unittests.cc.

1267 {
1268 auto model = std::make_unique<TextInputModel>();
1269 model->SetText("ABCDE");
1270 EXPECT_TRUE(model->SetSelection(TextRange(5)));
1271 EXPECT_TRUE(model->MoveCursorToBeginning());
1272 EXPECT_EQ(model->selection(), TextRange(0));
1273 EXPECT_EQ(model->composing_range(), TextRange(0));
1274 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1275 }

## ◆ TEST() [204/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningEndComposing |
| ) |  |

Definition at line 1415 of file text_input_model_unittests.cc.

1415 {
1416 auto model = std::make_unique<TextInputModel>();
1417 model->SetText("ABCDE");
1418 model->BeginComposing();
1419 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
1420 EXPECT_TRUE(model->MoveCursorToBeginning());
1421 EXPECT_EQ(model->selection(), TextRange(1));
1422 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1423 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1424 }

## ◆ TEST() [205/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningEndReverseComposing |
| ) |  |

Definition at line 1437 of file text_input_model_unittests.cc.

1437 {
1438 auto model = std::make_unique<TextInputModel>();
1439 model->SetText("ABCDE");
1440 model->BeginComposing();
1441 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
1442 EXPECT_TRUE(model->MoveCursorToBeginning());
1443 EXPECT_EQ(model->selection(), TextRange(1));
1444 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1445 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1446 }

## ◆ TEST() [206/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningMiddle |
| ) |  |

Definition at line 1247 of file text_input_model_unittests.cc.

1247 {
1248 auto model = std::make_unique<TextInputModel>();
1249 model->SetText("ABCDE");
1250 EXPECT_TRUE(model->SetSelection(TextRange(2)));
1251 EXPECT_TRUE(model->MoveCursorToBeginning());
1252 EXPECT_EQ(model->selection(), TextRange(0));
1253 EXPECT_EQ(model->composing_range(), TextRange(0));
1254 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1255 }

## ◆ TEST() [207/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningMiddleComposing |
| ) |  |

Definition at line 1371 of file text_input_model_unittests.cc.

1371 {
1372 auto model = std::make_unique<TextInputModel>();
1373 model->SetText("ABCDE");
1374 model->BeginComposing();
1375 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
1376 EXPECT_TRUE(model->MoveCursorToBeginning());
1377 EXPECT_EQ(model->selection(), TextRange(1));
1378 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1379 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1380 }

## ◆ TEST() [208/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningMiddleReverseComposing |
| ) |  |

Definition at line 1393 of file text_input_model_unittests.cc.

1393 {
1394 auto model = std::make_unique<TextInputModel>();
1395 model->SetText("ABCDE");
1396 model->BeginComposing();
1397 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 1));
1398 EXPECT_TRUE(model->MoveCursorToBeginning());
1399 EXPECT_EQ(model->selection(), TextRange(1));
1400 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1401 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1402 }

## ◆ TEST() [209/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningReverseSelection |
| ) |  |

Definition at line 1307 of file text_input_model_unittests.cc.

1307 {
1308 auto model = std::make_unique<TextInputModel>();
1309 model->SetText("ABCDE");
1310 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
1311 EXPECT_TRUE(model->MoveCursorToBeginning());
1312 EXPECT_EQ(model->selection(), TextRange(0));
1313 EXPECT_EQ(model->composing_range(), TextRange(0));
1314 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1315 }

## ◆ TEST() [210/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningSelection |
| ) |  |

Definition at line 1287 of file text_input_model_unittests.cc.

1287 {
1288 auto model = std::make_unique<TextInputModel>();
1289 model->SetText("ABCDE");
1290 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
1291 EXPECT_TRUE(model->MoveCursorToBeginning());
1292 EXPECT_EQ(model->selection(), TextRange(0));
1293 EXPECT_EQ(model->composing_range(), TextRange(0));
1294 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1295 }

## ◆ TEST() [211/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningStart |
| ) |  |

Definition at line 1227 of file text_input_model_unittests.cc.

1227 {
1228 auto model = std::make_unique<TextInputModel>();
1229 model->SetText("ABCDE");
1230 EXPECT_TRUE(model->SetSelection(TextRange(0)));
1231 EXPECT_FALSE(model->MoveCursorToBeginning());
1232 EXPECT_EQ(model->selection(), TextRange(0));
1233 EXPECT_EQ(model->composing_range(), TextRange(0));
1234 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1235 }

## ◆ TEST() [212/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningStartComposing |
| ) |  |

Definition at line 1327 of file text_input_model_unittests.cc.

1327 {
1328 auto model = std::make_unique<TextInputModel>();
1329 model->SetText("ABCDE");
1330 model->BeginComposing();
1331 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
1332 EXPECT_FALSE(model->MoveCursorToBeginning());
1333 EXPECT_EQ(model->selection(), TextRange(1));
1334 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1335 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1336 }

## ◆ TEST() [213/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToBeginningStartReverseComposing |
| ) |  |

Definition at line 1349 of file text_input_model_unittests.cc.

1349 {
1350 auto model = std::make_unique<TextInputModel>();
1351 model->SetText("ABCDE");
1352 model->BeginComposing();
1353 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 0));
1354 EXPECT_FALSE(model->MoveCursorToBeginning());
1355 EXPECT_EQ(model->selection(), TextRange(1));
1356 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1357 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1358 }

## ◆ TEST() [214/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndEnd |
| ) |  |

Definition at line 1499 of file text_input_model_unittests.cc.

1499 {
1500 auto model = std::make_unique<TextInputModel>();
1501 model->SetText("ABCDE");
1502 EXPECT_TRUE(model->SetSelection(TextRange(5)));
1503 EXPECT_FALSE(model->MoveCursorToEnd());
1504 EXPECT_EQ(model->selection(), TextRange(5));
1505 EXPECT_EQ(model->composing_range(), TextRange(0));
1506 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1507 }

## ◆ TEST() [215/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndEndComposing |
| ) |  |

Definition at line 1647 of file text_input_model_unittests.cc.

1647 {
1648 auto model = std::make_unique<TextInputModel>();
1649 model->SetText("ABCDE");
1650 model->BeginComposing();
1651 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
1652 EXPECT_FALSE(model->MoveCursorToEnd());
1653 EXPECT_EQ(model->selection(), TextRange(4));
1654 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1655 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1656 }

## ◆ TEST() [216/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndEndReverseComposing |
| ) |  |

Definition at line 1669 of file text_input_model_unittests.cc.

1669 {
1670 auto model = std::make_unique<TextInputModel>();
1671 model->SetText("ABCDE");
1672 model->BeginComposing();
1673 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
1674 EXPECT_FALSE(model->MoveCursorToEnd());
1675 EXPECT_EQ(model->selection(), TextRange(4));
1676 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1677 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1678 }

## ◆ TEST() [217/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndMiddle |
| ) |  |

Definition at line 1479 of file text_input_model_unittests.cc.

1479 {
1480 auto model = std::make_unique<TextInputModel>();
1481 model->SetText("ABCDE");
1482 EXPECT_TRUE(model->SetSelection(TextRange(2)));
1483 EXPECT_TRUE(model->MoveCursorToEnd());
1484 EXPECT_EQ(model->selection(), TextRange(5));
1485 EXPECT_EQ(model->composing_range(), TextRange(0));
1486 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1487 }

## ◆ TEST() [218/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndMiddleComposing |
| ) |  |

Definition at line 1603 of file text_input_model_unittests.cc.

1603 {
1604 auto model = std::make_unique<TextInputModel>();
1605 model->SetText("ABCDE");
1606 model->BeginComposing();
1607 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
1608 EXPECT_TRUE(model->MoveCursorToEnd());
1609 EXPECT_EQ(model->selection(), TextRange(4));
1610 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1611 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1612 }

## ◆ TEST() [219/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndMiddleReverseComposing |
| ) |  |

Definition at line 1625 of file text_input_model_unittests.cc.

1625 {
1626 auto model = std::make_unique<TextInputModel>();
1627 model->SetText("ABCDE");
1628 model->BeginComposing();
1629 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 1));
1630 EXPECT_TRUE(model->MoveCursorToEnd());
1631 EXPECT_EQ(model->selection(), TextRange(4));
1632 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1633 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1634 }

## ◆ TEST() [220/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndReverseSelection |
| ) |  |

Definition at line 1539 of file text_input_model_unittests.cc.

1539 {
1540 auto model = std::make_unique<TextInputModel>();
1541 model->SetText("ABCDE");
1542 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
1543 EXPECT_TRUE(model->MoveCursorToEnd());
1544 EXPECT_EQ(model->selection(), TextRange(5));
1545 EXPECT_EQ(model->composing_range(), TextRange(0));
1546 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1547 }

## ◆ TEST() [221/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndSelection |
| ) |  |

Definition at line 1519 of file text_input_model_unittests.cc.

1519 {
1520 auto model = std::make_unique<TextInputModel>();
1521 model->SetText("ABCDE");
1522 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
1523 EXPECT_TRUE(model->MoveCursorToEnd());
1524 EXPECT_EQ(model->selection(), TextRange(5));
1525 EXPECT_EQ(model->composing_range(), TextRange(0));
1526 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1527 }

## ◆ TEST() [222/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndStart |
| ) |  |

Definition at line 1459 of file text_input_model_unittests.cc.

1459 {
1460 auto model = std::make_unique<TextInputModel>();
1461 model->SetText("ABCDE");
1462 EXPECT_TRUE(model->SetSelection(TextRange(0)));
1463 EXPECT_TRUE(model->MoveCursorToEnd());
1464 EXPECT_EQ(model->selection(), TextRange(5));
1465 EXPECT_EQ(model->composing_range(), TextRange(0));
1466 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1467 }

## ◆ TEST() [223/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndStartComposing |
| ) |  |

Definition at line 1559 of file text_input_model_unittests.cc.

1559 {
1560 auto model = std::make_unique<TextInputModel>();
1561 model->SetText("ABCDE");
1562 model->BeginComposing();
1563 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
1564 EXPECT_TRUE(model->MoveCursorToEnd());
1565 EXPECT_EQ(model->selection(), TextRange(4));
1566 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1567 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1568 }

## ◆ TEST() [224/312]

flutter::TEST | ( | TextInputModel | ,
|  | MoveCursorToEndStartReverseComposing |
| ) |  |

Definition at line 1581 of file text_input_model_unittests.cc.

1581 {
1582 auto model = std::make_unique<TextInputModel>();
1583 model->SetText("ABCDE");
1584 model->BeginComposing();
1585 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
1586 EXPECT_TRUE(model->MoveCursorToEnd());
1587 EXPECT_EQ(model->selection(), TextRange(4));
1588 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1589 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1590 }

## ◆ TEST() [225/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningEnd |
| ) |  |

Definition at line 1277 of file text_input_model_unittests.cc.

1277 {
1278 auto model = std::make_unique<TextInputModel>();
1279 model->SetText("ABCDE");
1280 EXPECT_TRUE(model->SetSelection(TextRange(5)));
1281 EXPECT_TRUE(model->SelectToBeginning());
1282 EXPECT_EQ(model->selection(), TextRange(5, 0));
1283 EXPECT_EQ(model->composing_range(), TextRange(0));
1284 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1285 }

## ◆ TEST() [226/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningEndComposing |
| ) |  |

Definition at line 1426 of file text_input_model_unittests.cc.

1426 {
1427 auto model = std::make_unique<TextInputModel>();
1428 model->SetText("ABCDE");
1429 model->BeginComposing();
1430 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
1431 EXPECT_TRUE(model->MoveCursorToBeginning());
1432 EXPECT_EQ(model->selection(), TextRange(1));
1433 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1434 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1435 }

## ◆ TEST() [227/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningEndReverseComposing |
| ) |  |

Definition at line 1448 of file text_input_model_unittests.cc.

1448 {
1449 auto model = std::make_unique<TextInputModel>();
1450 model->SetText("ABCDE");
1451 model->BeginComposing();
1452 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
1453 EXPECT_TRUE(model->SelectToBeginning());
1454 EXPECT_EQ(model->selection(), TextRange(4, 1));
1455 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1456 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1457 }

## ◆ TEST() [228/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningMiddle |
| ) |  |

Definition at line 1257 of file text_input_model_unittests.cc.

1257 {
1258 auto model = std::make_unique<TextInputModel>();
1259 model->SetText("ABCDE");
1260 EXPECT_TRUE(model->SetSelection(TextRange(2)));
1261 EXPECT_TRUE(model->SelectToBeginning());
1262 EXPECT_EQ(model->selection(), TextRange(2, 0));
1263 EXPECT_EQ(model->composing_range(), TextRange(0));
1264 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1265 }

## ◆ TEST() [229/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningMiddleComposing |
| ) |  |

Definition at line 1382 of file text_input_model_unittests.cc.

1382 {
1383 auto model = std::make_unique<TextInputModel>();
1384 model->SetText("ABCDE");
1385 model->BeginComposing();
1386 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
1387 EXPECT_TRUE(model->SelectToBeginning());
1388 EXPECT_EQ(model->selection(), TextRange(2, 1));
1389 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1390 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1391 }

## ◆ TEST() [230/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningMiddleReverseComposing |
| ) |  |

Definition at line 1404 of file text_input_model_unittests.cc.

1404 {
1405 auto model = std::make_unique<TextInputModel>();
1406 model->SetText("ABCDE");
1407 model->BeginComposing();
1408 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 1));
1409 EXPECT_TRUE(model->SelectToBeginning());
1410 EXPECT_EQ(model->selection(), TextRange(2, 1));
1411 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1412 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1413 }

## ◆ TEST() [231/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningReverseSelection |
| ) |  |

Definition at line 1317 of file text_input_model_unittests.cc.

1317 {
1318 auto model = std::make_unique<TextInputModel>();
1319 model->SetText("ABCDE");
1320 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
1321 EXPECT_TRUE(model->SelectToBeginning());
1322 EXPECT_EQ(model->selection(), TextRange(4, 0));
1323 EXPECT_EQ(model->composing_range(), TextRange(0));
1324 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1325 }

## ◆ TEST() [232/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningSelection |
| ) |  |

Definition at line 1297 of file text_input_model_unittests.cc.

1297 {
1298 auto model = std::make_unique<TextInputModel>();
1299 model->SetText("ABCDE");
1300 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
1301 EXPECT_TRUE(model->SelectToBeginning());
1302 EXPECT_EQ(model->selection(), TextRange(1, 0));
1303 EXPECT_EQ(model->composing_range(), TextRange(0));
1304 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1305 }

## ◆ TEST() [233/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningStart |
| ) |  |

Definition at line 1237 of file text_input_model_unittests.cc.

1237 {
1238 auto model = std::make_unique<TextInputModel>();
1239 model->SetText("ABCDE");
1240 EXPECT_TRUE(model->SetSelection(TextRange(0)));
1241 EXPECT_FALSE(model->SelectToBeginning());
1242 EXPECT_EQ(model->selection(), TextRange(0));
1243 EXPECT_EQ(model->composing_range(), TextRange(0));
1244 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1245 }

## ◆ TEST() [234/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningStartComposing |
| ) |  |

Definition at line 1338 of file text_input_model_unittests.cc.

1338 {
1339 auto model = std::make_unique<TextInputModel>();
1340 model->SetText("ABCDE");
1341 model->BeginComposing();
1342 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
1343 EXPECT_FALSE(model->SelectToBeginning());
1344 EXPECT_EQ(model->selection(), TextRange(1));
1345 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1346 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1347 }

## ◆ TEST() [235/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToBeginningStartReverseComposing |
| ) |  |

Definition at line 1360 of file text_input_model_unittests.cc.

1360 {
1361 auto model = std::make_unique<TextInputModel>();
1362 model->SetText("ABCDE");
1363 model->BeginComposing();
1364 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 0));
1365 EXPECT_FALSE(model->SelectToBeginning());
1366 EXPECT_EQ(model->selection(), TextRange(1));
1367 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1368 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1369 }

## ◆ TEST() [236/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndEnd |
| ) |  |

Definition at line 1509 of file text_input_model_unittests.cc.

1509 {
1510 auto model = std::make_unique<TextInputModel>();
1511 model->SetText("ABCDE");
1512 EXPECT_TRUE(model->SetSelection(TextRange(5)));
1513 EXPECT_FALSE(model->SelectToEnd());
1514 EXPECT_EQ(model->selection(), TextRange(5));
1515 EXPECT_EQ(model->composing_range(), TextRange(0));
1516 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1517 }

## ◆ TEST() [237/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndEndComposing |
| ) |  |

Definition at line 1658 of file text_input_model_unittests.cc.

1658 {
1659 auto model = std::make_unique<TextInputModel>();
1660 model->SetText("ABCDE");
1661 model->BeginComposing();
1662 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
1663 EXPECT_FALSE(model->SelectToEnd());
1664 EXPECT_EQ(model->selection(), TextRange(4));
1665 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1666 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1667 }

## ◆ TEST() [238/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndEndReverseComposing |
| ) |  |

Definition at line 1680 of file text_input_model_unittests.cc.

1680 {
1681 auto model = std::make_unique<TextInputModel>();
1682 model->SetText("ABCDE");
1683 model->BeginComposing();
1684 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
1685 EXPECT_FALSE(model->SelectToEnd());
1686 EXPECT_EQ(model->selection(), TextRange(4));
1687 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1688 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1689 }

## ◆ TEST() [239/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndMiddle |
| ) |  |

Definition at line 1489 of file text_input_model_unittests.cc.

1489 {
1490 auto model = std::make_unique<TextInputModel>();
1491 model->SetText("ABCDE");
1492 EXPECT_TRUE(model->SetSelection(TextRange(2)));
1493 EXPECT_TRUE(model->SelectToEnd());
1494 EXPECT_EQ(model->selection(), TextRange(2, 5));
1495 EXPECT_EQ(model->composing_range(), TextRange(0));
1496 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1497 }

## ◆ TEST() [240/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndMiddleComposing |
| ) |  |

Definition at line 1614 of file text_input_model_unittests.cc.

1614 {
1615 auto model = std::make_unique<TextInputModel>();
1616 model->SetText("ABCDE");
1617 model->BeginComposing();
1618 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 1));
1619 EXPECT_TRUE(model->SelectToEnd());
1620 EXPECT_EQ(model->selection(), TextRange(2, 4));
1621 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1622 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1623 }

## ◆ TEST() [241/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndMiddleReverseComposing |
| ) |  |

Definition at line 1636 of file text_input_model_unittests.cc.

1636 {
1637 auto model = std::make_unique<TextInputModel>();
1638 model->SetText("ABCDE");
1639 model->BeginComposing();
1640 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 1));
1641 EXPECT_TRUE(model->SelectToEnd());
1642 EXPECT_EQ(model->selection(), TextRange(2, 4));
1643 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
1644 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1645 }

## ◆ TEST() [242/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndReverseSelection |
| ) |  |

Definition at line 1549 of file text_input_model_unittests.cc.

1549 {
1550 auto model = std::make_unique<TextInputModel>();
1551 model->SetText("ABCDE");
1552 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
1553 EXPECT_TRUE(model->SelectToEnd());
1554 EXPECT_EQ(model->selection(), TextRange(4, 5));
1555 EXPECT_EQ(model->composing_range(), TextRange(0));
1556 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1557 }

## ◆ TEST() [243/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndSelection |
| ) |  |

Definition at line 1529 of file text_input_model_unittests.cc.

1529 {
1530 auto model = std::make_unique<TextInputModel>();
1531 model->SetText("ABCDE");
1532 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
1533 EXPECT_TRUE(model->SelectToEnd());
1534 EXPECT_EQ(model->selection(), TextRange(1, 5));
1535 EXPECT_EQ(model->composing_range(), TextRange(0));
1536 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1537 }

## ◆ TEST() [244/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndStart |
| ) |  |

Definition at line 1469 of file text_input_model_unittests.cc.

1469 {
1470 auto model = std::make_unique<TextInputModel>();
1471 model->SetText("ABCDE");
1472 EXPECT_TRUE(model->SetSelection(TextRange(0)));
1473 EXPECT_TRUE(model->SelectToEnd());
1474 EXPECT_EQ(model->selection(), TextRange(0, 5));
1475 EXPECT_EQ(model->composing_range(), TextRange(0));
1476 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1477 }

## ◆ TEST() [245/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndStartComposing |
| ) |  |

Definition at line 1570 of file text_input_model_unittests.cc.

1570 {
1571 auto model = std::make_unique<TextInputModel>();
1572 model->SetText("ABCDE");
1573 model->BeginComposing();
1574 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
1575 EXPECT_TRUE(model->SelectToEnd());
1576 EXPECT_EQ(model->selection(), TextRange(1, 4));
1577 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1578 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1579 }

## ◆ TEST() [246/312]

flutter::TEST | ( | TextInputModel | ,
|  | SelectToEndStartReverseComposing |
| ) |  |

Definition at line 1592 of file text_input_model_unittests.cc.

1592 {
1593 auto model = std::make_unique<TextInputModel>();
1594 model->SetText("ABCDE");
1595 model->BeginComposing();
1596 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
1597 EXPECT_TRUE(model->SelectToEnd());
1598 EXPECT_EQ(model->selection(), TextRange(1, 4));
1599 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
1600 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
1601 }

## ◆ TEST() [247/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetComposingRangeEnd |
| ) |  |

Definition at line 190 of file text_input_model_unittests.cc.

190 {
191 auto model = std::make_unique<TextInputModel>();
192 model->SetText("ABCDE");
193 model->BeginComposing();
194 EXPECT_TRUE(model->SetComposingRange(TextRange(5, 5), 0));
195 EXPECT_EQ(model->selection(), TextRange(5));
196 EXPECT_EQ(model->composing_range(), TextRange(5));
197 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
198 }

## ◆ TEST() [248/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetComposingRangeMiddle |
| ) |  |

Definition at line 180 of file text_input_model_unittests.cc.

180 {
181 auto model = std::make_unique<TextInputModel>();
182 model->SetText("ABCDE");
183 model->BeginComposing();
184 EXPECT_TRUE(model->SetComposingRange(TextRange(2, 2), 0));
185 EXPECT_EQ(model->selection(), TextRange(2));
186 EXPECT_EQ(model->composing_range(), TextRange(2));
187 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
188 }

## ◆ TEST() [249/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetComposingRangeOutsideString |
| ) |  |

Definition at line 220 of file text_input_model_unittests.cc.

220 {
221 auto model = std::make_unique<TextInputModel>();
222 model->SetText("ABCDE");
223 model->BeginComposing();
224 EXPECT_FALSE(model->SetComposingRange(TextRange(4, 6), 0));
225 EXPECT_FALSE(model->SetComposingRange(TextRange(5, 6), 0));
226 EXPECT_FALSE(model->SetComposingRange(TextRange(6, 6), 0));
227 }

## ◆ TEST() [250/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetComposingRangeReverseExtent |
| ) |  |

Definition at line 210 of file text_input_model_unittests.cc.

210 {
211 auto model = std::make_unique<TextInputModel>();
212 model->SetText("ABCDE");
213 model->BeginComposing();
214 EXPECT_TRUE(model->SetComposingRange(TextRange(4, 1), 3));
215 EXPECT_EQ(model->selection(), TextRange(4));
216 EXPECT_EQ(model->composing_range(), TextRange(4, 1));
217 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
218 }

## ◆ TEST() [251/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetComposingRangeStart |
| ) |  |

Definition at line 170 of file text_input_model_unittests.cc.

170 {
171 auto model = std::make_unique<TextInputModel>();
172 model->SetText("ABCDE");
173 model->BeginComposing();
174 EXPECT_TRUE(model->SetComposingRange(TextRange(0, 0), 0));
175 EXPECT_EQ(model->selection(), TextRange(0));
176 EXPECT_EQ(model->composing_range(), TextRange(0));
177 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
178 }

## ◆ TEST() [252/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetComposingRangeWithExtent |
| ) |  |

Definition at line 200 of file text_input_model_unittests.cc.

200 {
201 auto model = std::make_unique<TextInputModel>();
202 model->SetText("ABCDE");
203 model->BeginComposing();
204 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 3));
205 EXPECT_EQ(model->selection(), TextRange(4));
206 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
207 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
208 }

## ◆ TEST() [253/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionComposingEnd |
| ) |  |

Definition at line 99 of file text_input_model_unittests.cc.

99 {
100 auto model = std::make_unique<TextInputModel>();
101 model->SetText("ABCDE");
102 model->BeginComposing();
103 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
104 EXPECT_TRUE(model->SetSelection(TextRange(4)));
105 EXPECT_EQ(model->selection(), TextRange(4));
106 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
107 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
108 }

## ◆ TEST() [254/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionComposingMiddle |
| ) |  |

Definition at line 79 of file text_input_model_unittests.cc.

79 {
80 auto model = std::make_unique<TextInputModel>();
81 model->SetText("ABCDE");
82 model->BeginComposing();
83 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
84 EXPECT_TRUE(model->SetSelection(TextRange(2)));
85 EXPECT_EQ(model->selection(), TextRange(2));
86 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
87 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
88 }

## ◆ TEST() [255/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionComposingStart |
| ) |  |

Definition at line 59 of file text_input_model_unittests.cc.

59 {
60 auto model = std::make_unique<TextInputModel>();
61 model->SetText("ABCDE");
62 model->BeginComposing();
63 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
64 EXPECT_TRUE(model->SetSelection(TextRange(1)));
65 EXPECT_EQ(model->selection(), TextRange(1));
66 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
67 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
68 }

## ◆ TEST() [256/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionEnd |
| ) |  |

Definition at line 90 of file text_input_model_unittests.cc.

90 {
91 auto model = std::make_unique<TextInputModel>();
92 model->SetText("ABCDE");
93 EXPECT_TRUE(model->SetSelection(TextRange(5)));
94 EXPECT_EQ(model->selection(), TextRange(5));
95 EXPECT_EQ(model->composing_range(), TextRange(0));
96 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
97 }

## ◆ TEST() [257/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionMiddle |
| ) |  |

Definition at line 70 of file text_input_model_unittests.cc.

70 {
71 auto model = std::make_unique<TextInputModel>();
72 model->SetText("ABCDE");
73 EXPECT_TRUE(model->SetSelection(TextRange(2)));
74 EXPECT_EQ(model->selection(), TextRange(2));
75 EXPECT_EQ(model->composing_range(), TextRange(0));
76 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
77 }

## ◆ TEST() [258/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionOutsideComposingRange |
| ) |  |

Definition at line 158 of file text_input_model_unittests.cc.

158 {
159 auto model = std::make_unique<TextInputModel>();
160 model->SetText("ABCDE");
161 model->BeginComposing();
162 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
163 EXPECT_FALSE(model->SetSelection(TextRange(0)));
164 EXPECT_EQ(model->selection(), TextRange(1));
165 EXPECT_FALSE(model->SetSelection(TextRange(5)));
166 EXPECT_EQ(model->selection(), TextRange(1));
167 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
168 }

## ◆ TEST() [259/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionOutsideString |
| ) |  |

Definition at line 150 of file text_input_model_unittests.cc.

150 {
151 auto model = std::make_unique<TextInputModel>();
152 model->SetText("ABCDE");
153 EXPECT_FALSE(model->SetSelection(TextRange(4, 6)));
154 EXPECT_FALSE(model->SetSelection(TextRange(5, 6)));
155 EXPECT_FALSE(model->SetSelection(TextRange(6)));
156 }

## ◆ TEST() [260/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionReverseExtent |
| ) |  |

Definition at line 130 of file text_input_model_unittests.cc.

130 {
131 auto model = std::make_unique<TextInputModel>();
132 model->SetText("ABCDE");
133 EXPECT_TRUE(model->SetSelection(TextRange(4, 1)));
134 EXPECT_EQ(model->selection(), TextRange(4, 1));
135 EXPECT_EQ(model->composing_range(), TextRange(0));
136 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
137 }

## ◆ TEST() [261/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionReverseExtentComposing |
| ) |  |

Definition at line 139 of file text_input_model_unittests.cc.

139 {
140 auto model = std::make_unique<TextInputModel>();
141 model->SetText("ABCDE");
142 model->BeginComposing();
143 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
144 EXPECT_FALSE(model->SetSelection(TextRange(4, 1)));
145 EXPECT_EQ(model->selection(), TextRange(1));
146 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
147 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
148 }

## ◆ TEST() [262/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionStart |
| ) |  |

Definition at line 50 of file text_input_model_unittests.cc.

50 {
51 auto model = std::make_unique<TextInputModel>();
52 model->SetText("ABCDE");
53 EXPECT_TRUE(model->SetSelection(TextRange(0)));
54 EXPECT_EQ(model->selection(), TextRange(0));
55 EXPECT_EQ(model->composing_range(), TextRange(0));
56 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
57 }

## ◆ TEST() [263/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionWthExtent |
| ) |  |

Definition at line 110 of file text_input_model_unittests.cc.

110 {
111 auto model = std::make_unique<TextInputModel>();
112 model->SetText("ABCDE");
113 EXPECT_TRUE(model->SetSelection(TextRange(1, 4)));
114 EXPECT_EQ(model->selection(), TextRange(1, 4));
115 EXPECT_EQ(model->composing_range(), TextRange(0));
116 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
117 }

## ◆ TEST() [264/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetSelectionWthExtentComposing |
| ) |  |

Definition at line 119 of file text_input_model_unittests.cc.

119 {
120 auto model = std::make_unique<TextInputModel>();
121 model->SetText("ABCDE");
122 model->BeginComposing();
123 EXPECT_TRUE(model->SetComposingRange(TextRange(1, 4), 0));
124 EXPECT_FALSE(model->SetSelection(TextRange(1, 4)));
125 EXPECT_EQ(model->selection(), TextRange(1));
126 EXPECT_EQ(model->composing_range(), TextRange(1, 4));
127 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
128 }

## ◆ TEST() [265/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetText |
| ) |  |

Definition at line 15 of file text_input_model_unittests.cc.

15 {
16 auto model = std::make_unique<TextInputModel>();
17 model->SetText("ABCDE");
18 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
19 }

## ◆ TEST() [266/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetTextEmpty |
| ) |  |

Definition at line 27 of file text_input_model_unittests.cc.

27 {
28 auto model = std::make_unique<TextInputModel>();
29 model->SetText("");
30 EXPECT_STREQ(model->GetText().c_str(), "");
31 }

## ◆ TEST() [267/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetTextReplaceText |
| ) |  |

Definition at line 33 of file text_input_model_unittests.cc.

33 {
34 auto model = std::make_unique<TextInputModel>();
35 model->SetText("ABCDE");
36 EXPECT_STREQ(model->GetText().c_str(), "ABCDE");
37 model->SetText("");
38 EXPECT_STREQ(model->GetText().c_str(), "");
39 }

## ◆ TEST() [268/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetTextResetsSelection |
| ) |  |

Definition at line 41 of file text_input_model_unittests.cc.

41 {
42 auto model = std::make_unique<TextInputModel>();
43 model->SetText("ABCDE");
44 EXPECT_TRUE(model->SetSelection(TextRange(3)));
45 EXPECT_EQ(model->selection(), TextRange(3));
46 model->SetText("FGHJI");
47 EXPECT_EQ(model->selection(), TextRange(0));
48 }

## ◆ TEST() [269/312]

flutter::TEST | ( | TextInputModel | ,
|  | SetTextWideCharacters |
| ) |  |

Definition at line 21 of file text_input_model_unittests.cc.

21 {
22 auto model = std::make_unique<TextInputModel>();
23 model->SetText("😄🙃🤪🧐");
24 EXPECT_STREQ(model->GetText().c_str(), "😄🙃🤪🧐");
25 }

## ◆ TEST() [270/312]

flutter::TEST | ( | TextInputModel | ,
|  | UpdateComposingRemovesLastComposingCharacter |
| ) |  |

Definition at line 395 of file text_input_model_unittests.cc.

395 {
396 auto model = std::make_unique<TextInputModel>();
397 model->SetText("ABCDE");
398 model->BeginComposing();
399 model->SetComposingRange(TextRange(1, 2), 1);
400 model->UpdateComposingText("");
401 EXPECT_EQ(model->selection(), TextRange(1));
402 EXPECT_EQ(model->composing_range(), TextRange(1));
403 model->SetText("ACDE");
404 }

## ◆ TEST() [271/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsEndPosition |
| ) |  |

Definition at line 125 of file text_range_unittests.cc.

125 {
126 TextRange range(2, 6);
127 EXPECT_TRUE(range.Contains(6));
128 }

References flutter::TextRange::Contains().

## ◆ TEST() [272/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsEndPositionReversed |
| ) |  |

Definition at line 151 of file text_range_unittests.cc.

151 {
152 TextRange range(6, 2);
153 EXPECT_TRUE(range.Contains(6));
154 }

References flutter::TextRange::Contains().

## ◆ TEST() [273/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsMiddlePosition |
| ) |  |

Definition at line 119 of file text_range_unittests.cc.

119 {
120 TextRange range(2, 6);
121 EXPECT_TRUE(range.Contains(3));
122 EXPECT_TRUE(range.Contains(4));
123 }

References flutter::TextRange::Contains().

## ◆ TEST() [274/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsMiddlePositionReversed |
| ) |  |

Definition at line 145 of file text_range_unittests.cc.

145 {
146 TextRange range(6, 2);
147 EXPECT_TRUE(range.Contains(3));
148 EXPECT_TRUE(range.Contains(4));
149 }

References flutter::TextRange::Contains().

## ◆ TEST() [275/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsPostEndPosition |
| ) |  |

Definition at line 130 of file text_range_unittests.cc.

130 {
131 TextRange range(2, 6);
132 EXPECT_FALSE(range.Contains(7));
133 }

References flutter::TextRange::Contains().

## ◆ TEST() [276/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsPostEndPositionReversed |
| ) |  |

Definition at line 156 of file text_range_unittests.cc.

156 {
157 TextRange range(6, 2);
158 EXPECT_FALSE(range.Contains(7));
159 }

References flutter::TextRange::Contains().

## ◆ TEST() [277/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsPreStartPosition |
| ) |  |

Definition at line 109 of file text_range_unittests.cc.

109 {
110 TextRange range(2, 6);
111 EXPECT_FALSE(range.Contains(1));
112 }

References flutter::TextRange::Contains().

## ◆ TEST() [278/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsPreStartPositionReversed |
| ) |  |

Definition at line 135 of file text_range_unittests.cc.

135 {
136 TextRange range(6, 2);
137 EXPECT_FALSE(range.Contains(1));
138 }

References flutter::TextRange::Contains().

## ◆ TEST() [279/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangeEndPosition |
| ) |  |

Definition at line 182 of file text_range_unittests.cc.

182 {
183 TextRange range(2, 6);
184 EXPECT_TRUE(range.Contains(TextRange(6)));
185 }

References flutter::TextRange::Contains().

## ◆ TEST() [280/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangeEndPositionReversed |
| ) |  |

Definition at line 223 of file text_range_unittests.cc.

223 {
224 TextRange range(6, 2);
225 EXPECT_TRUE(range.Contains(TextRange(5)));
226 }

References flutter::TextRange::Contains().

## ◆ TEST() [281/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangeMiddlePosition |
| ) |  |

Definition at line 176 of file text_range_unittests.cc.

176 {
177 TextRange range(2, 6);
178 EXPECT_TRUE(range.Contains(TextRange(3, 4)));
179 EXPECT_TRUE(range.Contains(TextRange(4, 5)));
180 }

References flutter::TextRange::Contains().

## ◆ TEST() [282/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangeMiddlePositionReversed |
| ) |  |

Definition at line 212 of file text_range_unittests.cc.

212 {
213 TextRange range(6, 2);
214 EXPECT_TRUE(range.Contains(TextRange(3, 4)));
215 EXPECT_TRUE(range.Contains(TextRange(4, 5)));
216 }

References flutter::TextRange::Contains().

## ◆ TEST() [283/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangePostEndPosition |
| ) |  |

Definition at line 192 of file text_range_unittests.cc.

192 {
193 TextRange range(2, 6);
194 EXPECT_FALSE(range.Contains(TextRange(6, 7)));
195 }

References flutter::TextRange::Contains().

## ◆ TEST() [284/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangePostEndPositionReversed |
| ) |  |

Definition at line 228 of file text_range_unittests.cc.

228 {
229 TextRange range(6, 2);
230 EXPECT_FALSE(range.Contains(TextRange(6, 7)));
231 }

References flutter::TextRange::Contains().

## ◆ TEST() [285/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangePreStartPosition |
| ) |  |

Definition at line 161 of file text_range_unittests.cc.

161 {
162 TextRange range(2, 6);
163 EXPECT_FALSE(range.Contains(TextRange(0, 1)));
164 }

References flutter::TextRange::Contains().

## ◆ TEST() [286/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangePreStartPositionReversed |
| ) |  |

Definition at line 197 of file text_range_unittests.cc.

197 {
198 TextRange range(6, 2);
199 EXPECT_FALSE(range.Contains(TextRange(0, 1)));
200 }

References flutter::TextRange::Contains().

## ◆ TEST() [287/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangeSpanningEndPosition |
| ) |  |

Definition at line 187 of file text_range_unittests.cc.

187 {
188 TextRange range(2, 6);
189 EXPECT_FALSE(range.Contains(TextRange(5, 7)));
190 }

References flutter::TextRange::Contains().

## ◆ TEST() [288/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangeSpanningEndPositionReversed |
| ) |  |

Definition at line 218 of file text_range_unittests.cc.

218 {
219 TextRange range(6, 2);
220 EXPECT_FALSE(range.Contains(TextRange(5, 7)));
221 }

References flutter::TextRange::Contains().

## ◆ TEST() [289/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangeSpanningStartPosition |
| ) |  |

Definition at line 166 of file text_range_unittests.cc.

166 {
167 TextRange range(2, 6);
168 EXPECT_FALSE(range.Contains(TextRange(1, 3)));
169 }

References flutter::TextRange::Contains().

## ◆ TEST() [290/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangeSpanningStartPositionReversed |
| ) |  |

Definition at line 202 of file text_range_unittests.cc.

202 {
203 TextRange range(6, 2);
204 EXPECT_FALSE(range.Contains(TextRange(1, 3)));
205 }

References flutter::TextRange::Contains().

## ◆ TEST() [291/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangeStartPosition |
| ) |  |

Definition at line 171 of file text_range_unittests.cc.

171 {
172 TextRange range(2, 6);
173 EXPECT_TRUE(range.Contains(TextRange(2)));
174 }

References flutter::TextRange::Contains().

## ◆ TEST() [292/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsRangeStartPositionReversed |
| ) |  |

Definition at line 207 of file text_range_unittests.cc.

207 {
208 TextRange range(6, 2);
209 EXPECT_TRUE(range.Contains(TextRange(2)));
210 }

References flutter::TextRange::Contains().

## ◆ TEST() [293/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsStartPosition |
| ) |  |

Definition at line 114 of file text_range_unittests.cc.

114 {
115 TextRange range(2, 6);
116 EXPECT_TRUE(range.Contains(2));
117 }

References flutter::TextRange::Contains().

## ◆ TEST() [294/312]

flutter::TEST | ( | TextRange | ,
|  | ContainsStartPositionReversed |
| ) |  |

Definition at line 140 of file text_range_unittests.cc.

140 {
141 TextRange range(6, 2);
142 EXPECT_TRUE(range.Contains(2));
143 }

References flutter::TextRange::Contains().

## ◆ TEST() [295/312]

flutter::TEST | ( | TextRange | ,
|  | ReversedCollapsedRange |
| ) |  |

Definition at line 238 of file text_range_unittests.cc.

238 {
239 TextRange range(2, 2);
240 EXPECT_FALSE(range.reversed());
241 }

References flutter::TextRange::reversed().

## ◆ TEST() [296/312]

flutter::TEST | ( | TextRange | ,
|  | ReversedForwardRange |
| ) |  |

Definition at line 233 of file text_range_unittests.cc.

233 {
234 TextRange range(2, 6);
235 EXPECT_FALSE(range.reversed());
236 }

References flutter::TextRange::reversed().

## ◆ TEST() [297/312]

flutter::TEST | ( | TextRange | ,
|  | ReversedReversedRange |
| ) |  |

Definition at line 243 of file text_range_unittests.cc.

243 {
244 TextRange range(6, 2);
245 EXPECT_TRUE(range.reversed());
246 }

References flutter::TextRange::reversed().

## ◆ TEST() [298/312]

flutter::TEST | ( | TextRange | ,
|  | SetBase |
| ) |  |

Definition at line 53 of file text_range_unittests.cc.

53 {
54 TextRange range(3, 7);
55 range.set_base(4);
56 EXPECT_EQ(range.base(), size_t(4));
57 EXPECT_EQ(range.extent(), size_t(7));
58 }

References flutter::TextRange::base(), flutter::TextRange::extent(), and flutter::TextRange::set_base().

## ◆ TEST() [299/312]

flutter::TEST | ( | TextRange | ,
|  | SetBaseReversed |
| ) |  |

Definition at line 60 of file text_range_unittests.cc.

60 {
61 TextRange range(7, 3);
62 range.set_base(5);
63 EXPECT_EQ(range.base(), size_t(5));
64 EXPECT_EQ(range.extent(), size_t(3));
65 }

References flutter::TextRange::base(), flutter::TextRange::extent(), and flutter::TextRange::set_base().

## ◆ TEST() [300/312]

flutter::TEST | ( | TextRange | ,
|  | SetEnd |
| ) |  |

Definition at line 95 of file text_range_unittests.cc.

95 {
96 TextRange range(3, 7);
97 range.set_end(6);
98 EXPECT_EQ(range.base(), size_t(3));
99 EXPECT_EQ(range.extent(), size_t(6));
100 }

References flutter::TextRange::base(), flutter::TextRange::extent(), and flutter::TextRange::set_end().

## ◆ TEST() [301/312]

flutter::TEST | ( | TextRange | ,
|  | SetEndReversed |
| ) |  |

Definition at line 102 of file text_range_unittests.cc.

102 {
103 TextRange range(7, 3);
104 range.set_end(5);
105 EXPECT_EQ(range.base(), size_t(5));
106 EXPECT_EQ(range.extent(), size_t(3));
107 }

References flutter::TextRange::base(), flutter::TextRange::extent(), and flutter::TextRange::set_end().

## ◆ TEST() [302/312]

flutter::TEST | ( | TextRange | ,
|  | SetExtent |
| ) |  |

Definition at line 67 of file text_range_unittests.cc.

67 {
68 TextRange range(3, 7);
69 range.set_extent(6);
70 EXPECT_EQ(range.base(), size_t(3));
71 EXPECT_EQ(range.extent(), size_t(6));
72 }

References flutter::TextRange::base(), flutter::TextRange::extent(), and flutter::TextRange::set_extent().

## ◆ TEST() [303/312]

flutter::TEST | ( | TextRange | ,
|  | SetExtentReversed |
| ) |  |

Definition at line 74 of file text_range_unittests.cc.

74 {
75 TextRange range(7, 3);
76 range.set_extent(4);
77 EXPECT_EQ(range.base(), size_t(7));
78 EXPECT_EQ(range.extent(), size_t(4));
79 }

References flutter::TextRange::base(), flutter::TextRange::extent(), and flutter::TextRange::set_extent().

## ◆ TEST() [304/312]

flutter::TEST | ( | TextRange | ,
|  | SetStart |
| ) |  |

Definition at line 81 of file text_range_unittests.cc.

81 {
82 TextRange range(3, 7);
83 range.set_start(5);
84 EXPECT_EQ(range.base(), size_t(5));
85 EXPECT_EQ(range.extent(), size_t(7));
86 }

References flutter::TextRange::base(), flutter::TextRange::extent(), and flutter::TextRange::set_start().

## ◆ TEST() [305/312]

flutter::TEST | ( | TextRange | ,
|  | SetStartReversed |
| ) |  |

Definition at line 88 of file text_range_unittests.cc.

88 {
89 TextRange range(7, 3);
90 range.set_start(5);
91 EXPECT_EQ(range.base(), size_t(7));
92 EXPECT_EQ(range.extent(), size_t(5));
93 }

References flutter::TextRange::base(), flutter::TextRange::extent(), and flutter::TextRange::set_start().

## ◆ TEST() [306/312]

flutter::TEST | ( | TextRange | ,
|  | TextRangeFromPositionNonZero |
| ) |  |

Definition at line 22 of file text_range_unittests.cc.

22 {
23 TextRange range(3);
24 EXPECT_EQ(range.base(), size_t(3));
25 EXPECT_EQ(range.extent(), size_t(3));
26 EXPECT_EQ(range.start(), size_t(3));
27 EXPECT_EQ(range.end(), size_t(3));
28 EXPECT_EQ(range.length(), size_t(0));
29 EXPECT_EQ(range.position(), size_t(3));
30 EXPECT_TRUE(range.collapsed());
31 }

References flutter::TextRange::base(), flutter::TextRange::collapsed(), flutter::TextRange::end(), flutter::TextRange::extent(), flutter::TextRange::length(), flutter::TextRange::position(), and flutter::TextRange::start().

## ◆ TEST() [307/312]

flutter::TEST | ( | TextRange | ,
|  | TextRangeFromPositionZero |
| ) |  |

Definition at line 11 of file text_range_unittests.cc.

11 {
12 TextRange range(0);
13 EXPECT_EQ(range.base(), size_t(0));
14 EXPECT_EQ(range.extent(), size_t(0));
15 EXPECT_EQ(range.start(), size_t(0));
16 EXPECT_EQ(range.end(), size_t(0));
17 EXPECT_EQ(range.length(), size_t(0));
18 EXPECT_EQ(range.position(), size_t(0));
19 EXPECT_TRUE(range.collapsed());
20 }

References flutter::TextRange::base(), flutter::TextRange::collapsed(), flutter::TextRange::end(), flutter::TextRange::extent(), flutter::TextRange::length(), flutter::TextRange::position(), and flutter::TextRange::start().

## ◆ TEST() [308/312]

flutter::TEST | ( | TextRange | ,
|  | TextRangeFromRange |
| ) |  |

Definition at line 33 of file text_range_unittests.cc.

33 {
34 TextRange range(3, 7);
35 EXPECT_EQ(range.base(), size_t(3));
36 EXPECT_EQ(range.extent(), size_t(7));
37 EXPECT_EQ(range.start(), size_t(3));
38 EXPECT_EQ(range.end(), size_t(7));
39 EXPECT_EQ(range.length(), size_t(4));
40 EXPECT_FALSE(range.collapsed());
41 }

References flutter::TextRange::base(), flutter::TextRange::collapsed(), flutter::TextRange::end(), flutter::TextRange::extent(), flutter::TextRange::length(), and flutter::TextRange::start().

## ◆ TEST() [309/312]

flutter::TEST | ( | TextRange | ,
|  | TextRangeFromReversedRange |
| ) |  |

Definition at line 43 of file text_range_unittests.cc.

43 {
44 TextRange range(7, 3);
45 EXPECT_EQ(range.base(), size_t(7));
46 EXPECT_EQ(range.extent(), size_t(3));
47 EXPECT_EQ(range.start(), size_t(3));
48 EXPECT_EQ(range.end(), size_t(7));
49 EXPECT_EQ(range.length(), size_t(4));
50 EXPECT_FALSE(range.collapsed());
51 }

References flutter::TextRange::base(), flutter::TextRange::collapsed(), flutter::TextRange::end(), flutter::TextRange::extent(), flutter::TextRange::length(), and flutter::TextRange::start().

## ◆ TEST() [310/312]

flutter::TEST | ( | TextureRegistrarTest | ,
|  | MarkFrameAvailableInvalidTexture |
| ) |  |

Definition at line 143 of file texture_registrar_unittests.cc.

143 {
144 auto dummy_registrar_handle =
145 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
146 PluginRegistrar registrar(dummy_registrar_handle);
147
148 TextureRegistrar* textures = registrar.texture_registrar();
149
150 bool success = textures->MarkTextureFrameAvailable(42);
151 EXPECT_FALSE(success);
152 }

References flutter::TextureRegistrar::MarkTextureFrameAvailable(), and flutter::PluginRegistrar::texture_registrar().

## ◆ TEST() [311/312]

flutter::TEST | ( | TextureRegistrarTest | ,
|  | RegisterUnregisterTexture |
| ) |  |

Definition at line 87 of file texture_registrar_unittests.cc.

87 {
88 testing::ScopedStubFlutterApi scoped_api_stub(std::make_unique<TestApi>());
89 auto test_api = static_cast<TestApi*>(scoped_api_stub.stub());
90
91 auto dummy_registrar_handle =
92 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
93 PluginRegistrar registrar(dummy_registrar_handle);
94 TextureRegistrar* textures = registrar.texture_registrar();
95 ASSERT_NE(textures, nullptr);
96
97 EXPECT_EQ(test_api->last_texture_id(), -1);
98 auto texture = test_api->GetFakeTexture(0);
99 EXPECT_EQ(texture, nullptr);
100
101 auto pixel_buffer_texture = std::make_unique<TextureVariant>(
102 PixelBufferTexture([](size_t width, size_t height) { return nullptr; }));
103 int64_t texture_id = textures->RegisterTexture(pixel_buffer_texture.get());
104 EXPECT_EQ(test_api->last_texture_id(), texture_id);
105 EXPECT_EQ(test_api->textures_size(), static_cast<size_t>(1));
106
107 texture = test_api->GetFakeTexture(texture_id);
108 EXPECT_EQ(texture->texture_id, texture_id);
109 EXPECT_EQ(texture->user_data,
110 std::get_if<PixelBufferTexture>(pixel_buffer_texture.get()));
111
112 textures->MarkTextureFrameAvailable(texture_id);
113 textures->MarkTextureFrameAvailable(texture_id);
114 bool success = textures->MarkTextureFrameAvailable(texture_id);
115 EXPECT_TRUE(success);
116 EXPECT_EQ(texture->mark_count, 3);
117
118 fml::AutoResetWaitableEvent unregister_latch;
119 textures->UnregisterTexture(texture_id, [&]() { unregister_latch.Signal(); });
120 unregister_latch.Wait();
121
122 texture = test_api->GetFakeTexture(texture_id);
123 EXPECT_EQ(texture, nullptr);
124 EXPECT_EQ(test_api->textures_size(), static_cast<size_t>(0));
125 }

References flutter::TextureRegistrar::MarkTextureFrameAvailable(), flutter::TextureRegistrar::RegisterTexture(), texture_id, flutter::PluginRegistrar::texture_registrar(), and flutter::TextureRegistrar::UnregisterTexture().

## ◆ TEST() [312/312]

flutter::TEST | ( | TextureRegistrarTest | ,
|  | UnregisterInvalidTexture |
| ) |  |

Definition at line 129 of file texture_registrar_unittests.cc.

129 {
130 auto dummy_registrar_handle =
131 reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
132 PluginRegistrar registrar(dummy_registrar_handle);
133
134 TextureRegistrar* textures = registrar.texture_registrar();
135
136 fml::AutoResetWaitableEvent latch;
137 textures->UnregisterTexture(42, [&]() { latch.Signal(); });
138 latch.Wait();
139 }

References flutter::PluginRegistrar::texture_registrar(), and flutter::TextureRegistrar::UnregisterTexture().

## ◆ TEST_F() [1/3]

flutter::TEST_F | ( | DartProjectTest | ,
|  | DartEntrypointArguments |
| ) |  |

Definition at line 45 of file dart_project_unittests.cc.

45 {
46 DartProject project(L"test");
47
48 std::vector<std::string> test_arguments = {"arg1", "arg2", "arg3"};
49 project.set_dart_entrypoint_arguments(test_arguments);
50
51 auto returned_arguments = project.dart_entrypoint_arguments();
52 EXPECT_EQ(returned_arguments.size(), 3U);
53 EXPECT_EQ(returned_arguments[0], "arg1");
54 EXPECT_EQ(returned_arguments[1], "arg2");
55 EXPECT_EQ(returned_arguments[2], "arg3");
56 }

References flutter::DartProject::dart_entrypoint_arguments(), and flutter::DartProject::set_dart_entrypoint_arguments().

## ◆ TEST_F() [2/3]

flutter::TEST_F | ( | DartProjectTest | ,
|  | ProjectWithCustomPaths |
| ) |  |

Definition at line 38 of file dart_project_unittests.cc.

38 {
39 DartProject project(L"data\\assets", L"icu\\icudtl.dat", L"lib\\file.so");
40 EXPECT_EQ(GetProjectIcuDataPath(project), L"icu\\icudtl.dat");
41 EXPECT_EQ(GetProjectAssetsPath(project), L"data\\assets");
42 EXPECT_EQ(GetProjectAotLibraryPath(project), L"lib\\file.so");
43 }

## ◆ TEST_F() [3/3]

flutter::TEST_F | ( | DartProjectTest | ,
|  | StandardProjectFormat |
| ) |  |

Definition at line 31 of file dart_project_unittests.cc.

31 {
32 DartProject project(L"test");
33 EXPECT_EQ(GetProjectIcuDataPath(project), L"test\\icudtl.dat");
34 EXPECT_EQ(GetProjectAssetsPath(project), L"test\\flutter_assets");
35 EXPECT_EQ(GetProjectAotLibraryPath(project), L"test\\app.so");
36 }

## ◆ toLower()

static uint64_t flutter::toLower | ( | uint64_t | n | ) |
| static

Definition at line 80 of file keyboard_key_embedder_handler.cc.

80 {
81 constexpr uint64_t lower_a = 0x61;
82 constexpr uint64_t upper_a = 0x41;
83 constexpr uint64_t upper_z = 0x5a;
84
85 constexpr uint64_t lower_a_grave = 0xe0;
86 constexpr uint64_t upper_a_grave = 0xc0;
87 constexpr uint64_t upper_thorn = 0xde;
88 constexpr uint64_t division = 0xf7;
89
90 // ASCII range.
91 if (n >= upper_a && n <= upper_z) {
92 return n - upper_a + lower_a;
93 }
94
95 // EASCII range.
96 if (n >= upper_a_grave && n <= upper_thorn && n != division) {
97 return n - upper_a_grave + lower_a_grave;
98 }
99
100 return n;
101 }

## ◆ UndeadChar()

uint32_t flutter::UndeadChar | ( | uint32_t | ch | ) |
| inline

Definition at line 34 of file keyboard_utils.h.

34 {
35 return ch & ~kDeadKeyCharMask;
36 }

References kDeadKeyCharMask.

Referenced by flutter::KeyboardKeyChannelHandler::KeyboardHook().

## ◆ WindowsPlatformThreadPrioritySetter()

static void flutter::WindowsPlatformThreadPrioritySetter | ( | FlutterThreadPriority | priority | ) |
| static

Definition at line 48 of file flutter_windows_engine.h.

49 {
50 // TODO(99502): Add support for tracing to the windows embedding so we can
51 // mark thread priorities and success/failure.
52 switch (priority) {
53 case FlutterThreadPriority::kBackground: {
54 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
55 break;
56 }
57 case FlutterThreadPriority::kDisplay: {
58 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
59 break;
60 }
61 case FlutterThreadPriority::kRaster: {
62 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
63 break;
64 }
65 case FlutterThreadPriority::kNormal: {
66 // For normal or default priority we do not need to set the priority
67 // class.
68 break;
69 }
70 }
71 }

Referenced by flutter::FlutterWindowsEngine::Run(), and flutter::testing::TEST_F().

## Variable Documentation

## ◆ kControl

constexpr int flutter::kControl = 1 << 3
| constexpr

Definition at line 15 of file keyboard_utils.h.

Referenced by flutter::FlutterWindow::HandleMessage(), flutter::KeyboardKeyEmbedderHandler::SyncModifiersIfNeeded(), and flutter::testing::TEST().

## ◆ kDeadKeyCharMask

constexpr int flutter::kDeadKeyCharMask = 0x80000000
| constexpr

Definition at line 30 of file keyboard_utils.h.

Referenced by flutter::KeyboardManager::HandleMessage(), and UndeadChar().

## ◆ kExitTypeNames

constexpr const char* flutter::kExitTypeNames[]
| static constexpr

Initial value:
= {
PlatformHandler::kExitTypeRequired, PlatformHandler::kExitTypeCancelable}

Definition at line 392 of file platform_handler.cc.

Referenced by flutter::PlatformHandler::RequestAppExit().

## ◆ kGetPreferredLanguageRegKey

constexpr const wchar_t flutter::kGetPreferredLanguageRegKey[]
| constexpr

Initial value:
=
L"Control panel\\International\\User Profile"

Definition at line 18 of file system_utils.h.

## ◆ kGetPreferredLanguageRegValue

constexpr const wchar_t flutter::kGetPreferredLanguageRegValue[] = L"Languages"
| constexpr

Definition at line 20 of file system_utils.h.

## ◆ kHasScrollingAction

constexpr int flutter::kHasScrollingAction
| constexpr

Initial value:
=
FlutterSemanticsAction::kFlutterSemanticsActionScrollLeft |
FlutterSemanticsAction::kFlutterSemanticsActionScrollRight |
FlutterSemanticsAction::kFlutterSemanticsActionScrollUp |
FlutterSemanticsAction::kFlutterSemanticsActionScrollDown

Definition at line 16 of file accessibility_bridge.cc.

## ◆ kKeyCodeControlLeft

constexpr int flutter::kKeyCodeControlLeft = 0xa2
| constexpr

Definition at line 21 of file keyboard_utils.h.

Referenced by flutter::KeyboardKeyEmbedderHandler::SyncModifiersIfNeeded().

## ◆ kKeyCodeShiftLeft

constexpr int flutter::kKeyCodeShiftLeft = 0xa0
| constexpr

Definition at line 18 of file keyboard_utils.h.

Referenced by flutter::KeyboardKeyEmbedderHandler::SyncModifiersIfNeeded().

## ◆ kScanCodeControlLeft

constexpr int flutter::kScanCodeControlLeft = 0x1d
| constexpr

Definition at line 19 of file keyboard_utils.h.

Referenced by flutter::KeyboardKeyEmbedderHandler::SyncModifiersIfNeeded(), and flutter::testing::TEST().

## ◆ kScanCodeControlRight

constexpr int flutter::kScanCodeControlRight = 0xe01d
| constexpr

Definition at line 20 of file keyboard_utils.h.

Referenced by flutter::KeyboardKeyEmbedderHandler::SyncModifiersIfNeeded(), and flutter::testing::TEST().

## ◆ kScanCodeShiftLeft

constexpr int flutter::kScanCodeShiftLeft = 0x2a
| constexpr

Definition at line 16 of file keyboard_utils.h.

Referenced by flutter::KeyboardKeyEmbedderHandler::SyncModifiersIfNeeded(), flutter::testing::TEST(), and flutter::testing::TEST_F().

## ◆ kScanCodeShiftRight

constexpr int flutter::kScanCodeShiftRight = 0x36
| constexpr

Definition at line 17 of file keyboard_utils.h.

Referenced by flutter::KeyboardKeyEmbedderHandler::SyncModifiersIfNeeded(), flutter::testing::TEST(), and flutter::testing::TEST_F().

## ◆ kShift

constexpr int flutter::kShift = 1 << 0
| constexpr

Definition at line 14 of file keyboard_utils.h.

Referenced by flutter::FlutterWindow::HandleMessage(), flutter::KeyboardKeyEmbedderHandler::SyncModifiersIfNeeded(), and flutter::testing::TEST().

## ◆ kWindowFrameBufferID

constexpr uint32_t flutter::kWindowFrameBufferID = 0
| inline constexpr

Definition at line 31 of file flutter_windows_view.h.

Referenced by flutter::FlutterWindowsView::GetFrameBufferId().

flutter::GetPreferredLanguagesFromMUI
std::wstring GetPreferredLanguagesFromMUI(const WindowsProcTable &windows_proc_table)
Definition: system_utils.cc:28
flutter::AppExitType::cancelable
@ cancelable
flutter::AppLifecycleState::kHidden
@ kHidden
flutter::CheckEncodeDecodeWithEncodePrefix
static void CheckEncodeDecodeWithEncodePrefix(const EncodableValue &value, const std::vector< uint8_t > &expected_encoding_prefix, size_t expected_encoding_length)
Definition: standard_message_codec_unittests.cc:62
flutter::WindowStateEvent::kHide
@ kHide
flutter::PlatformProvidedMenu::kServicesSubmenu
@ kServicesSubmenu
extended
bool extended
Definition: keyboard_key_handler_unittests.cc:118
flutter::PlatformProvidedMenu::kStopSpeaking
@ kStopSpeaking
user_data
void * user_data
Definition: flutter_windows_view_unittests.cc:47
character
char32_t character
Definition: keyboard_key_handler_unittests.cc:117
flutter::PlatformProvidedMenu::kMinimizeWindow
@ kMinimizeWindow
flutter::GetExecutableDirectory
std::filesystem::path GetExecutableDirectory()
Definition: path_utils.cc:16
flutter::PlatformProvidedMenu::kToggleFullScreen
@ kToggleFullScreen
flutter::ParseLanguageName
LanguageInfo ParseLanguageName(std::wstring language_name)
Definition: system_utils.cc:71
FlutterDesktopViewRef
struct FlutterDesktopView * FlutterDesktopViewRef
Definition: flutter_windows.h:29
flutter::WindowStateEvent::kFocus
@ kFocus
flutter::AppLifecycleState::kInactive
@ kInactive
flutter::WindowStateEvent::kShow
@ kShow
flutter::PlatformProvidedMenu::kStartSpeaking
@ kStartSpeaking
flutter::BinaryReply
std::function< void(const uint8_t *reply, size_t reply_size)> BinaryReply
Definition: binary_messenger.h:17
flutter::GetMaskBitmaps
void GetMaskBitmaps(HBITMAP bitmap, HBITMAP &mask_bitmap)
Definition: cursor_handler.cc:243
flutter::GetSwitchesFromEnvironment
std::vector< std::string > GetSwitchesFromEnvironment()
Definition: engine_switches.cc:14
flutter::PlatformProvidedMenu::kHideOtherApplications
@ kHideOtherApplications
flutter::PlatformProvidedMenu::kArrangeWindowsInFront
@ kArrangeWindowsInFront
flutter::StandardMessageCodec::GetInstance
static const StandardMessageCodec & GetInstance(const StandardCodecSerializer *serializer=nullptr)
Definition: standard_codec.cc:293
flutter::PlatformProvidedMenu::kAbout
@ kAbout
flutter::WindowProcDelegate
std::function< std::optional< LRESULT >(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)> WindowProcDelegate
Definition: plugin_registrar_windows.h:24
FlutterDesktopMessengerRef
struct FlutterDesktopMessenger * FlutterDesktopMessengerRef
Definition: flutter_messenger.h:19
flutter::EncodableList
std::vector< EncodableValue > EncodableList
Definition: encodable_value.h:94
flutter::PlatformProvidedMenu::kShowAllApplications
@ kShowAllApplications
FlutterDesktopMessage
Definition: flutter_messenger.h:31
flutter::AppLifecycleState::kResumed
@ kResumed
flutter::WindowStateEvent::kUnfocus
@ kUnfocus
flutter::AppLifecycleState::kDetached
@ kDetached
message
Win32Message message
Definition: keyboard_unittests.cc:137
flutter::kDeadKeyCharMask
constexpr int kDeadKeyCharMask
Definition: keyboard_utils.h:30
flutter::BinaryMessageHandler
std::function< void(const uint8_t *message, size_t message_size, BinaryReply reply)> BinaryMessageHandler
Definition: binary_messenger.h:24
flutter::EncodableMap
std::map< EncodableValue, EncodableValue > EncodableMap
Definition: encodable_value.h:95
flutter::AppExitType::required
@ required
flutter::PlatformProvidedMenu::kQuit
@ kQuit
flutter::CheckEncodeDecode
static void CheckEncodeDecode(const EncodableValue &value, const std::vector< uint8_t > &expected_encoding, const StandardCodecSerializer *serializer=nullptr, const std::function< bool(const EncodableValue &a, const EncodableValue &b)> &custom_comparator=nullptr)
Definition: standard_message_codec_unittests.cc:37
texture_id
int64_t texture_id
Definition: texture_registrar_unittests.cc:24
FlutterDesktopPluginRegistrar
Definition: window_state.h:31
flutter::GetPreferredLanguages
std::vector< std::wstring > GetPreferredLanguages(const WindowsProcTable &windows_proc_table)
Definition: system_utils.cc:45
flutter::PlatformProvidedMenu::kZoomWindow
@ kZoomWindow
flutter::AppLifecycleState::kPaused
@ kPaused