Flutter Engine
 
Loading...
Searching...
No Matches
SemanticsObjectTestMocks.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_SEMANTICSOBJECTTESTMOCKS_H_
6#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_SEMANTICSOBJECTTESTMOCKS_H_
7
9
10const CGRect kScreenSize = CGRectMake(0, 0, 600, 800);
11
12namespace flutter {
13namespace testing {
14
16 public:
17 SemanticsActionObservation(int32_t observed_id, SemanticsAction observed_action)
18 : id(observed_id), action(observed_action), args({}) {}
19
20 SemanticsActionObservation(int32_t observed_id,
21 SemanticsAction observed_action,
23 : id(observed_id),
24 action(observed_action),
25 args(args.GetMapping(), args.GetMapping() + args.GetSize()) {}
26
27 int32_t id;
29 std::vector<uint8_t> args;
30};
31
33 public:
35 view_ = [[UIView alloc] initWithFrame:kScreenSize];
36 window_ = [[UIWindow alloc] initWithFrame:kScreenSize];
37 [window_ addSubview:view_];
38 }
39 bool isVoiceOverRunning() const override { return isVoiceOverRunningValue; }
40 UIView* view() const override { return view_; }
41 UIView<UITextInput>* textInputView() override { return nil; }
42
43 NSString* GetDefaultLocale() override { return mockedLocale; }
44 void DispatchSemanticsAction(int32_t id, SemanticsAction action) override {
45 SemanticsActionObservation observation(id, action);
46 observations.push_back(observation);
47 }
48 void DispatchSemanticsAction(int32_t id,
50 fml::MallocMapping args) override {
51 SemanticsActionObservation observation(id, action, args);
52 observations.push_back(observation);
53 }
54 void AccessibilityObjectDidBecomeFocused(int32_t id) override {}
55 void AccessibilityObjectDidLoseFocus(int32_t id) override {}
57 std::vector<SemanticsActionObservation> observations;
59 NSString* mockedLocale;
60
61 private:
62 UIView* view_;
63 UIWindow* window_;
64};
65
67 public:
69 view_ = [[UIView alloc] initWithFrame:kScreenSize];
70 }
71 bool isVoiceOverRunning() const override { return isVoiceOverRunningValue; }
72 UIView* view() const override { return view_; }
73 UIView<UITextInput>* textInputView() override { return nil; }
74 void DispatchSemanticsAction(int32_t id, SemanticsAction action) override {
75 SemanticsActionObservation observation(id, action);
76 observations.push_back(observation);
77 }
78 void DispatchSemanticsAction(int32_t id,
80 fml::MallocMapping args) override {
81 SemanticsActionObservation observation(id, action, args);
82 observations.push_back(observation);
83 }
84 void AccessibilityObjectDidBecomeFocused(int32_t id) override {}
85 void AccessibilityObjectDidLoseFocus(int32_t id) override {}
86 NSString* GetDefaultLocale() override { return nil; }
88 std::vector<SemanticsActionObservation> observations;
90
91 private:
92 UIView* view_;
93};
94} // namespace testing
95} // namespace flutter
96
97@interface SemanticsObject (Tests)
99- (BOOL)accessibilityScrollToVisibleWithChild:(id)child;
100- (id)_accessibilityHitTest:(CGPoint)point withEvent:(UIEvent*)event;
101@end
102
103#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_SEMANTICSOBJECTTESTMOCKS_H_
const CGRect kScreenSize
Interface that represents an accessibility bridge for iOS.
void DispatchSemanticsAction(int32_t id, SemanticsAction action, fml::MallocMapping args) override
UIView< UITextInput > * textInputView() override
FlutterPlatformViewsController * GetPlatformViewsController() const override
void DispatchSemanticsAction(int32_t id, SemanticsAction action) override
std::vector< SemanticsActionObservation > observations
void AccessibilityObjectDidBecomeFocused(int32_t id) override
std::vector< SemanticsActionObservation > observations
void DispatchSemanticsAction(int32_t id, SemanticsAction action, fml::MallocMapping args) override
FlutterPlatformViewsController * GetPlatformViewsController() const override
void DispatchSemanticsAction(int32_t id, SemanticsAction action) override
SemanticsActionObservation(int32_t observed_id, SemanticsAction observed_action)
SemanticsActionObservation(int32_t observed_id, SemanticsAction observed_action, fml::MallocMapping &args)
A Mapping like NonOwnedMapping, but uses Free as its release proc.
Definition mapping.h:144
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
instancetype initWithFrame
const uintptr_t id
int BOOL