5#import <OCMock/OCMock.h>
6#import <XCTest/XCTest.h>
18class MockDelegate :
public PlatformView::Delegate {
20 void OnPlatformViewCreated(std::unique_ptr<Surface> surface)
override {}
21 void OnPlatformViewDestroyed()
override {}
22 void OnPlatformViewScheduleFrame()
override {}
23 void OnPlatformViewAddView(int64_t
view_id,
24 const ViewportMetrics& viewport_metrics,
25 AddViewCallback
callback)
override {}
26 void OnPlatformViewRemoveView(int64_t
view_id, RemoveViewCallback
callback)
override {}
27 void OnPlatformViewSetNextFrameCallback(
const fml::closure& closure)
override {}
28 void OnPlatformViewSetViewportMetrics(int64_t
view_id,
const ViewportMetrics& metrics)
override {}
30 void OnPlatformViewDispatchPlatformMessage(std::unique_ptr<PlatformMessage>
message)
override {}
31 void OnPlatformViewDispatchPointerDataPacket(std::unique_ptr<PointerDataPacket> packet)
override {
34 return {.has_platform_view =
false};
36 void OnPlatformViewSendViewFocusEvent(
const ViewFocusEvent& event)
override {}
37 void OnPlatformViewDispatchSemanticsAction(int64_t
view_id,
41 void OnPlatformViewSetSemanticsEnabled(
bool enabled)
override {}
42 void OnPlatformViewSetAccessibilityFeatures(int32_t flags)
override {}
43 void OnPlatformViewRegisterTexture(std::shared_ptr<Texture>
texture)
override {}
44 void OnPlatformViewUnregisterTexture(int64_t
texture_id)
override {}
45 void OnPlatformViewMarkTextureFrameAvailable(int64_t
texture_id)
override {}
48 std::unique_ptr<const fml::Mapping> snapshot_data,
49 std::unique_ptr<const fml::Mapping> snapshot_instructions)
override {
51 void LoadDartDeferredLibraryError(intptr_t loading_unit_id,
52 const std::string error_message,
53 bool transient)
override {}
54 void UpdateAssetResolverByType(std::unique_ptr<flutter::AssetResolver> updated_asset_resolver,
56 std::shared_ptr<fml::BasicTaskRunner> OnPlatformViewGetShutdownSafeIOTaskRunner()
const override {
71- (void)testSetSemanticsTreeEnabled {
72 flutter::MockDelegate mock_delegate;
73 auto thread = std::make_unique<fml::Thread>(
"PlatformViewIOSTest");
74 auto thread_task_runner = thread->GetTaskRunner();
80 id messenger = OCMProtocolMock(
@protocol(FlutterBinaryMessenger));
85 OCMStub([flutterViewController isViewLoaded]).andReturn(NO);
86 OCMStub([flutterViewController
engine]).andReturn(
engine);
87 OCMStub([
engine binaryMessenger]).andReturn(messenger);
89 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
94 std::make_shared<fml::SyncSwitch>());
96 thread_task_runner->PostTask([&] {
107 [engine stopMocking];
110- (void)testLocaleCanBeSetWithoutViewController {
111 flutter::MockDelegate mock_delegate;
112 auto thread = std::make_unique<fml::Thread>(
"PlatformViewIOSTest");
113 auto thread_task_runner = thread->GetTaskRunner();
119 id messenger = OCMProtocolMock(
@protocol(FlutterBinaryMessenger));
124 OCMStub([flutterViewController isViewLoaded]).andReturn(NO);
125 OCMStub([flutterViewController
engine]).andReturn(
engine);
126 OCMStub([
engine binaryMessenger]).andReturn(messenger);
128 auto platform_view = std::make_unique<flutter::PlatformViewIOS>(
133 std::make_shared<fml::SyncSwitch>());
135 thread_task_runner->PostTask([&] {
136 std::string locale =
"en-US";
138 platform_view->SetOwnerViewController(flutterViewController);
139 OCMVerify([flutterViewController setApplicationLocale:
@"en-US"]);
144 [engine stopMocking];
AssetResolverType
Identifies the type of AssetResolver an instance is.
A Mapping like NonOwnedMapping, but uses Free as its release proc.
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
G_BEGIN_DECLS FlutterViewId view_id
FlutterDesktopBinaryReply callback
static void LoadDartDeferredLibrary(JNIEnv *env, jobject obj, jlong shell_holder, jint jLoadingUnitId, jobjectArray jSearchPaths)
std::function< void()> closure
impeller::ShaderType type