Update HeaderFilterRegex once and for all. (flutter/engine#48145)
Includes a test (`header_filter_regex_test.dart`) that hopefully keeps us on rails going forward.
This commit is contained in:
@@ -45,10 +45,19 @@ CheckOptions:
|
||||
- key: readability-identifier-naming.PrivateMemberSuffix
|
||||
value: "_"
|
||||
|
||||
# Lint headers within paths that contain "/flutter/" but not:
|
||||
# - gen (generated code, the fact it compiles is good enough™)
|
||||
# - third_party (we didn't author most of the code, and can't fix the lints)
|
||||
# Intended to include (lint) all headers except:
|
||||
# ... those in ../../gen (generated files don't need to follow clang tidy)
|
||||
# ... those in flutter/third_party (we didn't author this code, it's a dep)
|
||||
#
|
||||
# Note this is because of our buildroot setup, so the full path of a lint is:
|
||||
# "../../flutter/impeller/core/runtime_types.h:1:1" as reported.
|
||||
HeaderFilterRegex: "(!third_party/)(!gen/).*/flutter/.*"
|
||||
# Unfortunately Clang Tidy uses an ancient version of regular expressions
|
||||
# without lookaheads, so the next best thing is to write out every directory
|
||||
# except third_party.
|
||||
#
|
||||
# If we ever add a new root directory, we'll have to update this expression.
|
||||
#
|
||||
# See the test in ./tools/clang_tidy/test/header_filter_regex_test.dart which
|
||||
# should theoretically catch if new directories are added but this regex is not
|
||||
# updated.
|
||||
#
|
||||
# tl;dr: I'm sorry.
|
||||
HeaderFilterRegex: "[..\/]+\/flutter\/(assets|benchmarking|build|ci|common|display_list|docs|examples|flow|flutter_frontend_server|flutter_vma|fml|impeller|lib|runtime|shell|skia|sky|testing|tools|vulkan|wasm|web_sdk)\/.*"
|
||||
|
||||
@@ -42,7 +42,7 @@ class VertexBufferBuilder {
|
||||
return impeller::IndexType::kUnknown;
|
||||
}
|
||||
|
||||
void SetLabel(std::string label) { label_ = std::move(label); }
|
||||
void SetLabel(const std::string& label) { label_ = label; }
|
||||
|
||||
void Reserve(size_t count) { return vertices_.reserve(count); }
|
||||
|
||||
|
||||
@@ -31,12 +31,13 @@ static fml::scoped_nsprotocol<id<MTLTexture>> CreateOffscreenTexture(id<MTLDevic
|
||||
// non-Objective-C TUs.
|
||||
class DarwinContextMetal {
|
||||
public:
|
||||
explicit DarwinContextMetal(bool impeller,
|
||||
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch)
|
||||
explicit DarwinContextMetal(
|
||||
bool impeller,
|
||||
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
|
||||
: context_(impeller ? nil : [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice]),
|
||||
impeller_context_(impeller ? [[FlutterDarwinContextMetalImpeller alloc]
|
||||
init:std::move(is_gpu_disabled_sync_switch)]
|
||||
: nil),
|
||||
impeller_context_(
|
||||
impeller ? [[FlutterDarwinContextMetalImpeller alloc] init:is_gpu_disabled_sync_switch]
|
||||
: nil),
|
||||
offscreen_texture_(CreateOffscreenTexture(
|
||||
impeller ? [impeller_context_ context]->GetMTLDevice() : [context_ device])) {}
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ typedef enum {
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
} FlutterStandardCodecObjcType;
|
||||
|
||||
// NOLINTBEGIN(google-objc-function-naming)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///\name Reader Helpers
|
||||
///@{
|
||||
@@ -111,6 +113,7 @@ bool FlutterStandardCodecHelperWriteNumber(CFMutableDataRef data,
|
||||
|
||||
///@}
|
||||
|
||||
// NOLINTEND(google-objc-function-naming)
|
||||
// NOLINTEND(google-runtime-int)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
@@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* Initializes a FlutterDarwinContextMetalImpeller.
|
||||
*/
|
||||
- (instancetype)init:(std::shared_ptr<const fml::SyncSwitch>)is_gpu_disabled_sync_switch;
|
||||
- (instancetype)init:(const std::shared_ptr<const fml::SyncSwitch>&)is_gpu_disabled_sync_switch;
|
||||
|
||||
/**
|
||||
* Creates an external texture with the specified ID and contents.
|
||||
|
||||
@@ -20,21 +20,21 @@
|
||||
FLUTTER_ASSERT_ARC
|
||||
|
||||
static std::shared_ptr<impeller::ContextMTL> CreateImpellerContext(
|
||||
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch) {
|
||||
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch) {
|
||||
std::vector<std::shared_ptr<fml::Mapping>> shader_mappings = {
|
||||
std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_data,
|
||||
impeller_entity_shaders_length),
|
||||
std::make_shared<fml::NonOwnedMapping>(impeller_entity_shaders_data,
|
||||
impeller_entity_shaders_length),
|
||||
#if IMPELLER_ENABLE_3D
|
||||
std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_data,
|
||||
impeller_scene_shaders_length),
|
||||
std::make_shared<fml::NonOwnedMapping>(impeller_scene_shaders_data,
|
||||
impeller_scene_shaders_length),
|
||||
#endif // IMPELLER_ENABLE_3D
|
||||
std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_data,
|
||||
impeller_modern_shaders_length),
|
||||
std::make_shared<fml::NonOwnedMapping>(impeller_framebuffer_blend_shaders_data,
|
||||
impeller_framebuffer_blend_shaders_length),
|
||||
std::make_shared<fml::NonOwnedMapping>(impeller_modern_shaders_data,
|
||||
impeller_modern_shaders_length),
|
||||
std::make_shared<fml::NonOwnedMapping>(impeller_framebuffer_blend_shaders_data,
|
||||
impeller_framebuffer_blend_shaders_length),
|
||||
};
|
||||
auto context = impeller::ContextMTL::Create(
|
||||
shader_mappings, std::move(is_gpu_disabled_sync_switch), "Impeller Library");
|
||||
auto context = impeller::ContextMTL::Create(shader_mappings, is_gpu_disabled_sync_switch,
|
||||
"Impeller Library");
|
||||
if (!context) {
|
||||
FML_LOG(ERROR) << "Could not create Metal Impeller Context.";
|
||||
return nullptr;
|
||||
@@ -46,10 +46,10 @@ static std::shared_ptr<impeller::ContextMTL> CreateImpellerContext(
|
||||
|
||||
@implementation FlutterDarwinContextMetalImpeller
|
||||
|
||||
- (instancetype)init:(std::shared_ptr<const fml::SyncSwitch>)is_gpu_disabled_sync_switch {
|
||||
- (instancetype)init:(const std::shared_ptr<const fml::SyncSwitch>&)is_gpu_disabled_sync_switch {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_context = CreateImpellerContext(std::move(is_gpu_disabled_sync_switch));
|
||||
_context = CreateImpellerContext(is_gpu_disabled_sync_switch);
|
||||
id<MTLDevice> device = _context->GetMTLDevice();
|
||||
if (!device) {
|
||||
FML_DLOG(ERROR) << "Could not acquire Metal device.";
|
||||
|
||||
@@ -22,11 +22,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* The dart entrypoint that is associated with `main()`. This is to be used as an argument to the
|
||||
* `runWithEntrypoint*` methods.
|
||||
*/
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern NSString* const FlutterDefaultDartEntrypoint;
|
||||
|
||||
/**
|
||||
* The default Flutter initial route ("/").
|
||||
*/
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern NSString* const FlutterDefaultInitialRoute;
|
||||
|
||||
/**
|
||||
|
||||
@@ -250,6 +250,7 @@ typedef void (*FlutterPluginRegistrantCallback)(NSObject<FlutterPluginRegistry>*
|
||||
* Flutter Framework (e.g. When an interact-able widget is covering the platform view).
|
||||
*/
|
||||
typedef enum {
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
/**
|
||||
* Flutter blocks all the UIGestureRecognizers on the platform view as soon as it
|
||||
* decides they should be blocked.
|
||||
@@ -266,6 +267,7 @@ typedef enum {
|
||||
* but never recognizing the gesture (and never invoking actions).
|
||||
*/
|
||||
FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded,
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
} FlutterPlatformViewGestureRecognizersBlockingPolicy;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* with the update.
|
||||
*/
|
||||
FLUTTER_DARWIN_EXPORT
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern NSNotificationName const FlutterSemanticsUpdateNotification;
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,19 +7,16 @@
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#include "fml/memory/weak_ptr.h"
|
||||
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h"
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterKeyPrimaryResponder.h"
|
||||
#import "flutter/shell/platform/embedder/embedder.h"
|
||||
|
||||
namespace {
|
||||
typedef void* _VoidPtr;
|
||||
}
|
||||
|
||||
typedef void (^FlutterSendKeyEvent)(const FlutterKeyEvent& /* event */,
|
||||
_Nullable FlutterKeyEventCallback /* callback */,
|
||||
_Nullable _VoidPtr /* user_data */);
|
||||
void* _Nullable /* user_data */);
|
||||
|
||||
/**
|
||||
* A primary responder of |FlutterKeyboardManager| that handles events by
|
||||
|
||||
@@ -27,10 +27,10 @@ FLUTTER_ASSERT_ARC;
|
||||
@interface TestKeyEvent : NSObject
|
||||
@property(nonatomic) FlutterKeyEvent* data;
|
||||
@property(nonatomic) FlutterKeyEventCallback callback;
|
||||
@property(nonatomic) _VoidPtr userData;
|
||||
@property(nonatomic) void* _Nullable userData;
|
||||
- (nonnull instancetype)initWithEvent:(const FlutterKeyEvent*)event
|
||||
callback:(nullable FlutterKeyEventCallback)callback
|
||||
userData:(nullable _VoidPtr)userData;
|
||||
userData:(void* _Nullable)userData;
|
||||
- (BOOL)hasCallback;
|
||||
- (void)respond:(BOOL)handled;
|
||||
@end
|
||||
@@ -38,7 +38,7 @@ FLUTTER_ASSERT_ARC;
|
||||
@implementation TestKeyEvent
|
||||
- (instancetype)initWithEvent:(const FlutterKeyEvent*)event
|
||||
callback:(nullable FlutterKeyEventCallback)callback
|
||||
userData:(nullable _VoidPtr)userData {
|
||||
userData:(void* _Nullable)userData {
|
||||
self = [super init];
|
||||
_data = new FlutterKeyEvent(*event);
|
||||
if (event->character != nullptr) {
|
||||
@@ -132,7 +132,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -192,7 +192,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -251,7 +251,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -350,7 +350,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -420,7 +420,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -453,7 +453,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -541,7 +541,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -734,7 +734,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -816,7 +816,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -940,7 +940,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -995,7 +995,7 @@ typedef void (^ResponseCallback)(bool handled);
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event callback:nil userData:nil]];
|
||||
callback(true, user_data);
|
||||
}];
|
||||
|
||||
@@ -244,7 +244,7 @@ void FlutterPlatformViewsController::OnCreate(FlutterMethodCall* call, FlutterRe
|
||||
FlutterTouchInterceptingView* touch_interceptor = [[[FlutterTouchInterceptingView alloc]
|
||||
initWithEmbeddedView:platform_view
|
||||
platformViewsController:GetWeakPtr()
|
||||
gestureRecognizersBlockingPolicy:gesture_recognizers_blocking_policies[viewType]]
|
||||
gestureRecognizersBlockingPolicy:gesture_recognizers_blocking_policies_[viewType]]
|
||||
autorelease];
|
||||
|
||||
touch_interceptors_[viewId] =
|
||||
@@ -317,7 +317,7 @@ void FlutterPlatformViewsController::RegisterViewFactory(
|
||||
FML_CHECK(factories_.count(idString) == 0);
|
||||
factories_[idString] =
|
||||
fml::scoped_nsobject<NSObject<FlutterPlatformViewFactory>>([factory retain]);
|
||||
gesture_recognizers_blocking_policies[idString] = gestureRecognizerBlockingPolicy;
|
||||
gesture_recognizers_blocking_policies_[idString] = gestureRecognizerBlockingPolicy;
|
||||
}
|
||||
|
||||
void FlutterPlatformViewsController::BeginFrame(SkISize frame_size) {
|
||||
|
||||
@@ -395,7 +395,7 @@ class FlutterPlatformViewsController {
|
||||
|
||||
// The FlutterPlatformViewGestureRecognizersBlockingPolicy for each type of platform view.
|
||||
std::map<std::string, FlutterPlatformViewGestureRecognizersBlockingPolicy>
|
||||
gesture_recognizers_blocking_policies;
|
||||
gesture_recognizers_blocking_policies_;
|
||||
|
||||
bool catransaction_added_ = false;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
@class FlutterTextInputView;
|
||||
|
||||
typedef NS_ENUM(NSInteger, FlutterTextInputAction) {
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
FlutterTextInputActionUnspecified,
|
||||
FlutterTextInputActionDone,
|
||||
FlutterTextInputActionGo,
|
||||
@@ -22,12 +23,15 @@ typedef NS_ENUM(NSInteger, FlutterTextInputAction) {
|
||||
FlutterTextInputActionRoute,
|
||||
FlutterTextInputActionEmergencyCall,
|
||||
FlutterTextInputActionNewline,
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, FlutterFloatingCursorDragState) {
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
FlutterFloatingCursorDragStateStart,
|
||||
FlutterFloatingCursorDragStateUpdate,
|
||||
FlutterFloatingCursorDragStateEnd,
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
};
|
||||
|
||||
@protocol FlutterTextInputDelegate <NSObject>
|
||||
|
||||
@@ -15,15 +15,19 @@
|
||||
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterViewResponder.h"
|
||||
|
||||
typedef NS_ENUM(NSInteger, FlutterScribbleFocusStatus) {
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
FlutterScribbleFocusStatusUnfocused,
|
||||
FlutterScribbleFocusStatusFocusing,
|
||||
FlutterScribbleFocusStatusFocused,
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, FlutterScribbleInteractionStatus) {
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
FlutterScribbleInteractionStatusNone,
|
||||
FlutterScribbleInteractionStatusStarted,
|
||||
FlutterScribbleInteractionStatusEnding,
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
};
|
||||
|
||||
@interface FlutterTextInputPlugin
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, FlutterUndoRedoDirection) {
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
FlutterUndoRedoDirectionUndo,
|
||||
FlutterUndoRedoDirectionRedo,
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
};
|
||||
|
||||
@class FlutterUndoManagerPlugin;
|
||||
|
||||
@@ -20,18 +20,23 @@ class FlutterPlatformViewsController;
|
||||
}
|
||||
|
||||
FLUTTER_DARWIN_EXPORT
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern NSNotificationName const FlutterViewControllerWillDealloc;
|
||||
|
||||
FLUTTER_DARWIN_EXPORT
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern NSNotificationName const FlutterViewControllerHideHomeIndicator;
|
||||
|
||||
FLUTTER_DARWIN_EXPORT
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern NSNotificationName const FlutterViewControllerShowHomeIndicator;
|
||||
|
||||
typedef NS_ENUM(NSInteger, FlutterKeyboardMode) {
|
||||
// NOLINTBEGIN(readability-identifier-naming)
|
||||
FlutterKeyboardModeHidden = 0,
|
||||
FlutterKeyboardModeDocked = 1,
|
||||
FlutterKeyboardModeFloating = 2,
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
};
|
||||
|
||||
typedef void (^FlutterKeyboardAnimationCallback)(fml::TimePoint);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* MacOS doesn't provide a scan code, but a virtual keycode to represent a
|
||||
* physical key.
|
||||
*/
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern const std::map<uint32_t, uint64_t> keyCodeToPhysicalKey;
|
||||
|
||||
/**
|
||||
@@ -23,6 +24,7 @@ extern const std::map<uint32_t, uint64_t> keyCodeToPhysicalKey;
|
||||
* This is used to derive logical keys that can't or shouldn't be derived from
|
||||
* |charactersIgnoringModifiers|.
|
||||
*/
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern const std::map<uint32_t, uint64_t> keyCodeToLogicalKey;
|
||||
|
||||
/**
|
||||
@@ -96,29 +98,34 @@ constexpr uint32_t kModifierFlagSidedMask = kModifierFlagControlLeft | kModifier
|
||||
/**
|
||||
* Map |UIKey.keyCode| to the matching sided modifier in UIEventModifierFlags.
|
||||
*/
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern const std::map<uint32_t, ModifierFlag> keyCodeToModifierFlag;
|
||||
|
||||
/**
|
||||
* Map a bit of bitmask of sided modifiers in UIEventModifierFlags to their
|
||||
* corresponding |UIKey.keyCode|.
|
||||
*/
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern const std::map<ModifierFlag, uint32_t> modifierFlagToKeyCode;
|
||||
|
||||
/**
|
||||
* Maps a sided modifier key to the corresponding flag matching either side of
|
||||
* that type of modifier.
|
||||
*/
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern const std::map<ModifierFlag, ModifierFlag> sidedModifierToAny;
|
||||
|
||||
/**
|
||||
* Maps a non-sided modifier key to the corresponding flag matching the left key
|
||||
* of that type of modifier.
|
||||
*/
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern const std::map<ModifierFlag, ModifierFlag> anyModifierToLeft;
|
||||
|
||||
/**
|
||||
* A set of keycodes corresponding to function keys.
|
||||
*/
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
extern const std::set<uint32_t> functionKeyCodes;
|
||||
|
||||
#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_KEY_CODE_MAP_INTERNAL_H_
|
||||
|
||||
@@ -20,7 +20,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testCreate {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* object = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
XCTAssertNotNil(object);
|
||||
@@ -28,7 +28,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testSetChildren {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* parent = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
SemanticsObject* child = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
|
||||
@@ -40,7 +40,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testAccessibilityHitTestFocusAtLeaf {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* object0 = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
SemanticsObject* object1 = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
|
||||
@@ -84,7 +84,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testAccessibilityHitTestNoFocusableItem {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* object0 = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
SemanticsObject* object1 = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
|
||||
@@ -122,9 +122,9 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testAccessibilityScrollToVisible {
|
||||
fml::WeakPtrFactory<flutter::MockAccessibilityBridge> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
fml::WeakPtrFactory<flutter::testing::MockAccessibilityBridge> factory(
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::testing::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* object3 = [[SemanticsObject alloc] initWithBridge:bridge uid:3];
|
||||
|
||||
flutter::SemanticsNode node3;
|
||||
@@ -140,9 +140,9 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testAccessibilityScrollToVisibleWithChild {
|
||||
fml::WeakPtrFactory<flutter::MockAccessibilityBridge> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
fml::WeakPtrFactory<flutter::testing::MockAccessibilityBridge> factory(
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::testing::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* object3 = [[SemanticsObject alloc] initWithBridge:bridge uid:3];
|
||||
|
||||
flutter::SemanticsNode node3;
|
||||
@@ -159,7 +159,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testAccessibilityHitTestOutOfRect {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* object0 = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
SemanticsObject* object1 = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
|
||||
@@ -202,7 +202,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testReplaceChildAtIndex {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* parent = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
SemanticsObject* child1 = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
|
||||
@@ -216,7 +216,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testPlainSemanticsObjectWithLabelHasStaticTextTrait {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
flutter::SemanticsNode node;
|
||||
node.label = "foo";
|
||||
@@ -227,7 +227,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testNodeWithImplicitScrollIsAnAccessibilityElementWhenItisHidden {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
flutter::SemanticsNode node;
|
||||
node.flags = static_cast<int32_t>(flutter::SemanticsFlags::kHasImplicitScrolling) |
|
||||
@@ -239,7 +239,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testNodeWithImplicitScrollIsNotAnAccessibilityElementWhenItisNotHidden {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
flutter::SemanticsNode node;
|
||||
node.flags = static_cast<int32_t>(flutter::SemanticsFlags::kHasImplicitScrolling);
|
||||
@@ -250,7 +250,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testIntresetingSemanticsObjectWithLabelHasStaticTextTrait {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
flutter::SemanticsNode node;
|
||||
node.label = "foo";
|
||||
@@ -263,7 +263,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testIntresetingSemanticsObjectWithLabelHasStaticTextTrait1 {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
flutter::SemanticsNode node;
|
||||
node.label = "foo";
|
||||
@@ -275,7 +275,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testIntresetingSemanticsObjectWithLabelHasStaticTextTrait2 {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
flutter::SemanticsNode node;
|
||||
node.label = "foo";
|
||||
@@ -287,7 +287,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testVerticalFlutterScrollableSemanticsObject {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
|
||||
float transformScale = 0.5f;
|
||||
@@ -325,7 +325,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testVerticalFlutterScrollableSemanticsObjectNoWindowDoesNotCrash {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridgeNoWindow());
|
||||
new flutter::testing::MockAccessibilityBridgeNoWindow());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
|
||||
float transformScale = 0.5f;
|
||||
@@ -353,7 +353,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testHorizontalFlutterScrollableSemanticsObject {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
|
||||
float transformScale = 0.5f;
|
||||
@@ -391,7 +391,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testCanHandleInfiniteScrollExtent {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
|
||||
float transformScale = 0.5f;
|
||||
@@ -430,7 +430,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testCanHandleNaNScrollExtentAndScrollPoisition {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
|
||||
float transformScale = 0.5f;
|
||||
@@ -467,7 +467,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testFlutterScrollableSemanticsObjectIsNotHittestable {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
|
||||
flutter::SemanticsNode node;
|
||||
@@ -486,7 +486,7 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testFlutterScrollableSemanticsObjectIsHiddenWhenVoiceOverIsRunning {
|
||||
flutter::MockAccessibilityBridge* mock = new flutter::MockAccessibilityBridge();
|
||||
flutter::testing::MockAccessibilityBridge* mock = new flutter::testing::MockAccessibilityBridge();
|
||||
mock->isVoiceOverRunningValue = false;
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(mock);
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
@@ -509,7 +509,7 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testFlutterScrollableSemanticsObjectWithLabelValueHintIsNotHiddenWhenVoiceOverIsRunning {
|
||||
flutter::MockAccessibilityBridge* mock = new flutter::MockAccessibilityBridge();
|
||||
flutter::testing::MockAccessibilityBridge* mock = new flutter::testing::MockAccessibilityBridge();
|
||||
mock->isVoiceOverRunningValue = true;
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(mock);
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
@@ -538,7 +538,7 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testFlutterSemanticsObjectMergeTooltipToLabel {
|
||||
flutter::MockAccessibilityBridge* mock = new flutter::MockAccessibilityBridge();
|
||||
flutter::testing::MockAccessibilityBridge* mock = new flutter::testing::MockAccessibilityBridge();
|
||||
mock->isVoiceOverRunningValue = true;
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(mock);
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
@@ -554,7 +554,7 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testFlutterSemanticsObjectAttributedStringsDoNotCrashWhenEmpty {
|
||||
flutter::MockAccessibilityBridge* mock = new flutter::MockAccessibilityBridge();
|
||||
flutter::testing::MockAccessibilityBridge* mock = new flutter::testing::MockAccessibilityBridge();
|
||||
mock->isVoiceOverRunningValue = true;
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(mock);
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
@@ -567,7 +567,7 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testFlutterScrollableSemanticsObjectReturnsParentContainerIfNoChildren {
|
||||
flutter::MockAccessibilityBridge* mock = new flutter::MockAccessibilityBridge();
|
||||
flutter::testing::MockAccessibilityBridge* mock = new flutter::testing::MockAccessibilityBridge();
|
||||
mock->isVoiceOverRunningValue = true;
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(mock);
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
@@ -611,7 +611,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testFlutterScrollableSemanticsObjectHidesScrollBar {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
|
||||
flutter::SemanticsNode node;
|
||||
@@ -633,7 +633,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testSemanticsObjectBuildsAttributedString {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
flutter::SemanticsNode node;
|
||||
node.label = "label";
|
||||
@@ -689,7 +689,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testShouldTriggerAnnouncement {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* object = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
|
||||
@@ -726,9 +726,9 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testShouldDispatchShowOnScreenActionForHeader {
|
||||
fml::WeakPtrFactory<flutter::MockAccessibilityBridge> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
fml::WeakPtrFactory<flutter::testing::MockAccessibilityBridge> factory(
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::testing::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* object = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
|
||||
|
||||
// Handle initial setting of node with header.
|
||||
@@ -747,9 +747,9 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testShouldDispatchShowOnScreenActionForHidden {
|
||||
fml::WeakPtrFactory<flutter::MockAccessibilityBridge> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
fml::WeakPtrFactory<flutter::testing::MockAccessibilityBridge> factory(
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::testing::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* object = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
|
||||
|
||||
// Handle initial setting of node with hidden.
|
||||
@@ -768,9 +768,9 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testFlutterSwitchSemanticsObjectMatchesUISwitch {
|
||||
fml::WeakPtrFactory<flutter::MockAccessibilityBridge> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
fml::WeakPtrFactory<flutter::testing::MockAccessibilityBridge> factory(
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::testing::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
FlutterSwitchSemanticsObject* object = [[FlutterSwitchSemanticsObject alloc] initWithBridge:bridge
|
||||
uid:1];
|
||||
|
||||
@@ -802,9 +802,9 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testFlutterSemanticsObjectOfRadioButton {
|
||||
fml::WeakPtrFactory<flutter::MockAccessibilityBridge> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
fml::WeakPtrFactory<flutter::testing::MockAccessibilityBridge> factory(
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::testing::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
FlutterSemanticsObject* object = [[FlutterSemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
|
||||
// Handle initial setting of node with header.
|
||||
@@ -820,9 +820,9 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testFlutterSwitchSemanticsObjectMatchesUISwitchDisabled {
|
||||
fml::WeakPtrFactory<flutter::MockAccessibilityBridge> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
fml::WeakPtrFactory<flutter::testing::MockAccessibilityBridge> factory(
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::testing::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
FlutterSwitchSemanticsObject* object = [[FlutterSwitchSemanticsObject alloc] initWithBridge:bridge
|
||||
uid:1];
|
||||
|
||||
@@ -843,7 +843,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testSemanticsObjectDeallocated {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* parent = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
SemanticsObject* child = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
|
||||
@@ -890,7 +890,8 @@ FLUTTER_ASSERT_ARC
|
||||
parent.childrenInTraversalOrder.push_back(2);
|
||||
|
||||
{
|
||||
flutter::MockAccessibilityBridge* mock = new flutter::MockAccessibilityBridge();
|
||||
flutter::testing::MockAccessibilityBridge* mock =
|
||||
new flutter::testing::MockAccessibilityBridge();
|
||||
mock->isVoiceOverRunningValue = true;
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(mock);
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
@@ -926,7 +927,7 @@ FLUTTER_ASSERT_ARC
|
||||
|
||||
- (void)testAccessibilityHitTestSearchCanReturnPlatformView {
|
||||
fml::WeakPtrFactory<flutter::AccessibilityBridgeIos> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::AccessibilityBridgeIos> bridge = factory.GetWeakPtr();
|
||||
SemanticsObject* object0 = [[SemanticsObject alloc] initWithBridge:bridge uid:0];
|
||||
SemanticsObject* object1 = [[SemanticsObject alloc] initWithBridge:bridge uid:1];
|
||||
@@ -974,9 +975,9 @@ FLUTTER_ASSERT_ARC
|
||||
}
|
||||
|
||||
- (void)testFlutterPlatformViewSemanticsContainer {
|
||||
fml::WeakPtrFactory<flutter::MockAccessibilityBridge> factory(
|
||||
new flutter::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
fml::WeakPtrFactory<flutter::testing::MockAccessibilityBridge> factory(
|
||||
new flutter::testing::MockAccessibilityBridge());
|
||||
fml::WeakPtr<flutter::testing::MockAccessibilityBridge> bridge = factory.GetWeakPtr();
|
||||
__weak FlutterTouchInterceptingView* weakPlatformView;
|
||||
@autoreleasepool {
|
||||
FlutterTouchInterceptingView* platformView = [[FlutterTouchInterceptingView alloc] init];
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
const CGRect kScreenSize = CGRectMake(0, 0, 600, 800);
|
||||
|
||||
namespace flutter {
|
||||
namespace {
|
||||
namespace testing {
|
||||
|
||||
class SemanticsActionObservation {
|
||||
public:
|
||||
@@ -83,7 +83,7 @@ class MockAccessibilityBridgeNoWindow : public AccessibilityBridgeIos {
|
||||
private:
|
||||
UIView* view_;
|
||||
};
|
||||
} // namespace
|
||||
} // namespace testing
|
||||
} // namespace flutter
|
||||
|
||||
@interface SemanticsObject (Tests)
|
||||
|
||||
@@ -99,7 +99,7 @@ class AccessibilityBridge final : public AccessibilityBridgeIos {
|
||||
int32_t last_focused_semantics_object_id_;
|
||||
fml::scoped_nsobject<NSMutableDictionary<NSNumber*, SemanticsObject*>> objects_;
|
||||
fml::scoped_nsprotocol<FlutterBasicMessageChannel*> accessibility_channel_;
|
||||
int32_t previous_route_id_;
|
||||
int32_t previous_route_id_ = 0;
|
||||
std::unordered_map<int32_t, flutter::CustomAccessibilityAction> actions_;
|
||||
std::vector<int32_t> previous_routes_;
|
||||
std::unique_ptr<IosDelegate> ios_delegate_;
|
||||
|
||||
@@ -49,7 +49,6 @@ AccessibilityBridge::AccessibilityBridge(
|
||||
platform_views_controller_(std::move(platform_views_controller)),
|
||||
last_focused_semantics_object_id_(kSemanticObjectIdInvalid),
|
||||
objects_([[NSMutableDictionary alloc] init]),
|
||||
previous_route_id_(0),
|
||||
previous_routes_({}),
|
||||
ios_delegate_(ios_delegate ? std::move(ios_delegate)
|
||||
: std::make_unique<DefaultIosDelegate>()),
|
||||
|
||||
@@ -60,7 +60,7 @@ class IOSContext {
|
||||
IOSRenderingAPI api,
|
||||
IOSRenderingBackend backend,
|
||||
MsaaSampleCount msaa_samples,
|
||||
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch);
|
||||
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/// @brief Collects the context object. This must happen on the thread on
|
||||
|
||||
@@ -23,7 +23,7 @@ std::unique_ptr<IOSContext> IOSContext::Create(
|
||||
IOSRenderingAPI api,
|
||||
IOSRenderingBackend backend,
|
||||
MsaaSampleCount msaa_samples,
|
||||
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch) {
|
||||
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch) {
|
||||
switch (api) {
|
||||
case IOSRenderingAPI::kSoftware:
|
||||
FML_CHECK(backend != IOSRenderingBackend::kImpeller)
|
||||
@@ -38,7 +38,7 @@ std::unique_ptr<IOSContext> IOSContext::Create(
|
||||
case IOSRenderingBackend::kSkia:
|
||||
return std::make_unique<IOSContextMetalSkia>(msaa_samples);
|
||||
case IOSRenderingBackend::kImpeller:
|
||||
return std::make_unique<IOSContextMetalImpeller>(std::move(is_gpu_disabled_sync_switch));
|
||||
return std::make_unique<IOSContextMetalImpeller>(is_gpu_disabled_sync_switch);
|
||||
}
|
||||
#endif // SHELL_ENABLE_METAL
|
||||
default:
|
||||
|
||||
@@ -20,7 +20,8 @@ namespace flutter {
|
||||
|
||||
class IOSContextMetalImpeller final : public IOSContext {
|
||||
public:
|
||||
IOSContextMetalImpeller(std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch);
|
||||
explicit IOSContextMetalImpeller(
|
||||
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch);
|
||||
|
||||
~IOSContextMetalImpeller();
|
||||
|
||||
|
||||
@@ -9,11 +9,10 @@
|
||||
namespace flutter {
|
||||
|
||||
IOSContextMetalImpeller::IOSContextMetalImpeller(
|
||||
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch)
|
||||
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
|
||||
: IOSContext(MsaaSampleCount::kFour),
|
||||
darwin_context_metal_impeller_(fml::scoped_nsobject<FlutterDarwinContextMetalImpeller>{
|
||||
[[FlutterDarwinContextMetalImpeller alloc]
|
||||
init:std::move(is_gpu_disabled_sync_switch)]}) {}
|
||||
[[FlutterDarwinContextMetalImpeller alloc] init:is_gpu_disabled_sync_switch]}) {}
|
||||
|
||||
IOSContextMetalImpeller::~IOSContextMetalImpeller() = default;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class PlatformMessageHandlerIos : public PlatformMessageHandler {
|
||||
public:
|
||||
static NSObject<FlutterTaskQueue>* MakeBackgroundTaskQueue();
|
||||
|
||||
PlatformMessageHandlerIos(fml::RefPtr<fml::TaskRunner> platform_task_runner);
|
||||
explicit PlatformMessageHandlerIos(fml::RefPtr<fml::TaskRunner> platform_task_runner);
|
||||
|
||||
void HandlePlatformMessage(std::unique_ptr<PlatformMessage> message) override;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class PlatformViewIOS final : public PlatformView {
|
||||
const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller,
|
||||
const flutter::TaskRunners& task_runners,
|
||||
const std::shared_ptr<fml::ConcurrentTaskRunner>& worker_task_runner,
|
||||
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch);
|
||||
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch);
|
||||
|
||||
~PlatformViewIOS() override;
|
||||
|
||||
@@ -112,7 +112,7 @@ class PlatformViewIOS final : public PlatformView {
|
||||
ScopedObserver& operator=(const ScopedObserver&) = delete;
|
||||
|
||||
private:
|
||||
id<NSObject> observer_;
|
||||
id<NSObject> observer_ = nil;
|
||||
};
|
||||
|
||||
/// Wrapper that guarantees we communicate clearing Accessibility
|
||||
@@ -142,7 +142,6 @@ class PlatformViewIOS final : public PlatformView {
|
||||
const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller_;
|
||||
AccessibilityBridgeManager accessibility_bridge_;
|
||||
fml::scoped_nsprotocol<FlutterTextInputPlugin*> text_input_plugin_;
|
||||
fml::closure firstFrameCallback_;
|
||||
ScopedObserver dealloc_view_controller_observer_;
|
||||
std::vector<std::string> platform_resolved_locale_;
|
||||
std::shared_ptr<PlatformMessageHandlerIos> platform_message_handler_;
|
||||
|
||||
@@ -57,7 +57,7 @@ PlatformViewIOS::PlatformViewIOS(
|
||||
const std::shared_ptr<FlutterPlatformViewsController>& platform_views_controller,
|
||||
const flutter::TaskRunners& task_runners,
|
||||
const std::shared_ptr<fml::ConcurrentTaskRunner>& worker_task_runner,
|
||||
std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch)
|
||||
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
|
||||
: PlatformViewIOS(
|
||||
delegate,
|
||||
IOSContext::Create(
|
||||
@@ -65,7 +65,7 @@ PlatformViewIOS::PlatformViewIOS(
|
||||
delegate.OnPlatformViewGetSettings().enable_impeller ? IOSRenderingBackend::kImpeller
|
||||
: IOSRenderingBackend::kSkia,
|
||||
static_cast<MsaaSampleCount>(delegate.OnPlatformViewGetSettings().msaa_samples),
|
||||
std::move(is_gpu_disabled_sync_switch)),
|
||||
is_gpu_disabled_sync_switch),
|
||||
platform_views_controller,
|
||||
task_runners) {}
|
||||
|
||||
@@ -250,7 +250,7 @@ std::unique_ptr<std::vector<std::string>> PlatformViewIOS::ComputePlatformResolv
|
||||
return out;
|
||||
}
|
||||
|
||||
PlatformViewIOS::ScopedObserver::ScopedObserver() : observer_(nil) {}
|
||||
PlatformViewIOS::ScopedObserver::ScopedObserver() {}
|
||||
|
||||
PlatformViewIOS::ScopedObserver::~ScopedObserver() {
|
||||
if (observer_) {
|
||||
|
||||
@@ -7,13 +7,9 @@
|
||||
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterKeyPrimaryResponder.h"
|
||||
#include "flutter/shell/platform/embedder/embedder.h"
|
||||
|
||||
namespace {
|
||||
typedef void* _VoidPtr;
|
||||
}
|
||||
|
||||
typedef void (^FlutterSendEmbedderKeyEvent)(const FlutterKeyEvent& /* event */,
|
||||
_Nullable FlutterKeyEventCallback /* callback */,
|
||||
_Nullable _VoidPtr /* user_data */);
|
||||
void* _Nullable /* user_data */);
|
||||
|
||||
/**
|
||||
* A primary responder of |FlutterKeyboardManager| that handles events by
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
@interface TestKeyEvent : NSObject
|
||||
@property(nonatomic) FlutterKeyEvent* data;
|
||||
@property(nonatomic) FlutterKeyEventCallback callback;
|
||||
@property(nonatomic) _VoidPtr userData;
|
||||
@property(nonatomic) void* userData;
|
||||
- (nonnull instancetype)initWithEvent:(const FlutterKeyEvent*)event
|
||||
callback:(nullable FlutterKeyEventCallback)callback
|
||||
userData:(nullable _VoidPtr)userData;
|
||||
userData:(nullable void*)userData;
|
||||
- (BOOL)hasCallback;
|
||||
- (void)respond:(BOOL)handled;
|
||||
@end
|
||||
@@ -24,7 +24,7 @@
|
||||
@implementation TestKeyEvent
|
||||
- (instancetype)initWithEvent:(const FlutterKeyEvent*)event
|
||||
callback:(nullable FlutterKeyEventCallback)callback
|
||||
userData:(nullable _VoidPtr)userData {
|
||||
userData:(nullable void*)userData {
|
||||
self = [super init];
|
||||
_data = new FlutterKeyEvent(*event);
|
||||
if (event->character != nullptr) {
|
||||
@@ -122,7 +122,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, BasicKeyEvent) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -200,7 +200,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, NonAsciiCharacters) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -270,7 +270,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, MultipleCharacters) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -312,7 +312,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, SynthesizeForDuplicateDownEvent) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -371,7 +371,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, IgnoreDuplicateUpEvent) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -401,7 +401,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, ConvertAbruptRepeatEventsToDown) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -437,7 +437,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, ToggleModifiersDuringKeyTap) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -547,7 +547,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, SpecialModiferFlags) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -695,7 +695,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, IdentifyLeftAndRightModifiers) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -781,7 +781,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, SynthesizeMissedModifierEvents) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -985,7 +985,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, SynthesizeMissedModifierEventsInNorma
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -1059,7 +1059,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, ConvertCapsLockEvents) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -1138,7 +1138,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, SynchronizeCapsLockStateOnCapsLock) {
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
@@ -1172,7 +1172,7 @@ TEST(FlutterEmbedderKeyResponderUnittests, SynchronizeCapsLockStateOnNormalKey)
|
||||
|
||||
FlutterEmbedderKeyResponder* responder = [[FlutterEmbedderKeyResponder alloc]
|
||||
initWithSendEvent:^(const FlutterKeyEvent& event, _Nullable FlutterKeyEventCallback callback,
|
||||
_Nullable _VoidPtr user_data) {
|
||||
void* _Nullable user_data) {
|
||||
[events addObject:[[TestKeyEvent alloc] initWithEvent:&event
|
||||
callback:callback
|
||||
userData:user_data]];
|
||||
|
||||
@@ -31,6 +31,7 @@ dev_dependencies:
|
||||
litetest: any
|
||||
process_fakes: any
|
||||
smith: any
|
||||
yaml: any
|
||||
|
||||
dependency_overrides:
|
||||
args:
|
||||
@@ -63,5 +64,13 @@ dependency_overrides:
|
||||
path: ../pkg/process_fakes
|
||||
process_runner:
|
||||
path: ../../third_party/pkg/process_runner
|
||||
source_span:
|
||||
path: ../../../third_party/dart/third_party/pkg/source_span
|
||||
smith:
|
||||
path: ../../../third_party/dart/pkg/smith
|
||||
string_scanner:
|
||||
path: ../../../third_party/dart/third_party/pkg/string_scanner
|
||||
term_glyph:
|
||||
path: ../../../third_party/dart/third_party/pkg/term_glyph
|
||||
yaml:
|
||||
path: ../../../third_party/dart/third_party/pkg/yaml
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// Copyright 2013 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:yaml/yaml.dart' as yaml;
|
||||
|
||||
/// Tests that `HeaderFilterRegex` works as expected in `.clang_tidy`.
|
||||
void main() {
|
||||
// Find the root of the repo.
|
||||
final Engine engine = Engine.findWithin(path.dirname(Platform.script.path));
|
||||
|
||||
// Find the `.clang_tidy` file and "parse" it (it's YAML).
|
||||
final yaml.YamlDocument dotClangTidy = yaml.loadYamlDocument(
|
||||
File(path.join(engine.flutterDir.path, '.clang-tidy')).readAsStringSync(),
|
||||
);
|
||||
|
||||
// Find the `HeaderFilterRegex` entry.
|
||||
if (dotClangTidy.contents is! yaml.YamlMap) {
|
||||
stderr.writeln('Expected .clang-tidy to be a YAML map.');
|
||||
exit(1);
|
||||
}
|
||||
final yaml.YamlMap nodes = dotClangTidy.contents as yaml.YamlMap;
|
||||
final yaml.YamlNode? headerFilterRegex = nodes.nodes['HeaderFilterRegex'];
|
||||
if (headerFilterRegex == null) {
|
||||
stderr.writeln('Expected .clang-tidy to have a HeaderFilterRegex entry.');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
final RegExp regexValue = RegExp(headerFilterRegex.value.toString());
|
||||
|
||||
test('contains every root directory in the regex', () {
|
||||
// These are a list of directories that should _not_ be included.
|
||||
const Set<String> intentionallyOmitted = <String>{
|
||||
'.git',
|
||||
'.github',
|
||||
'prebuilts',
|
||||
'third_party',
|
||||
};
|
||||
|
||||
// Find all the directories in the repo root aside from the ones above.
|
||||
final Set<String> rootDirs = <String>{};
|
||||
for (final FileSystemEntity entity in engine.flutterDir.listSync()) {
|
||||
if (entity is! Directory) {
|
||||
continue;
|
||||
}
|
||||
final String name = path.basename(entity.path);
|
||||
if (intentionallyOmitted.contains(name)) {
|
||||
continue;
|
||||
}
|
||||
rootDirs.add(name);
|
||||
}
|
||||
|
||||
// Create a fake file in that path, and assert that it matches the regex.
|
||||
for (final String rootDir in rootDirs) {
|
||||
final String file = path.join('..', '..', 'flutter', rootDir, 'foo');
|
||||
if (!regexValue.hasMatch(file)) {
|
||||
// This is because reason: ... doesn't work in pkg/litetest.
|
||||
stderr.writeln('Expected "$file" to be caught by HeaderFilterRegex (${regexValue.pattern}).');
|
||||
}
|
||||
expect(regexValue.hasMatch(file), isTrue);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user