-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding tests for ViewController platform view support.
- Loading branch information
1 parent
330c99e
commit 444f71e
Showing
7 changed files
with
216 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
shell/platform/darwin/macos/framework/Source/FlutterPlatformViewMock.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// 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 <Foundation/Foundation.h> | ||
#import <Foundation/NSObject.h> | ||
|
||
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformViews.h" | ||
|
||
@interface FlutterPlatformViewMock : NSObject <FlutterPlatformView> | ||
@property(nonatomic, strong) NSView* view; | ||
@end | ||
|
||
@interface MockPlatformView : NSView | ||
@end | ||
|
||
@interface FlutterPlatformViewMockFactory : NSObject <FlutterPlatformViewFactory> | ||
@end |
42 changes: 42 additions & 0 deletions
42
shell/platform/darwin/macos/framework/Source/FlutterPlatformViewMock.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// 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 <Cocoa/Cocoa.h> | ||
#import <Foundation/Foundation.h> | ||
|
||
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformViewMock.h" | ||
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformViews.h" | ||
|
||
@implementation MockPlatformView | ||
|
||
- (instancetype)initWithFrame:(CGRect)frame { | ||
self = [super initWithFrame:frame]; | ||
return self; | ||
} | ||
|
||
@end | ||
|
||
@implementation FlutterPlatformViewMock | ||
|
||
- (instancetype)initWithFrame:(CGRect)frame arguments:(id _Nullable)args { | ||
if (self = [super init]) { | ||
_view = [[MockPlatformView alloc] initWithFrame:frame]; | ||
} | ||
return self; | ||
} | ||
|
||
@end | ||
|
||
@implementation FlutterPlatformViewMockFactory | ||
- (NSObject<FlutterPlatformView>*)createWithFrame:(CGRect)frame | ||
viewIdentifier:(int64_t)viewId | ||
arguments:(id _Nullable)args { | ||
return [[FlutterPlatformViewMock alloc] initWithFrame:frame arguments:args]; | ||
} | ||
|
||
- (NSObject<FlutterMessageCodec>*)createArgsCodec { | ||
return [FlutterStandardMessageCodec sharedInstance]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
shell/platform/darwin/macos/framework/Source/MockFlutterPlatformView.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <Foundation/NSObject.h> | ||
|
||
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformViews.h" | ||
|
||
@interface MockFlutterPlatformView : NSObject <FlutterPlatformView> | ||
@property(nonatomic, strong) NSView* view; | ||
@end | ||
|
||
@interface MockPlatformView : NSTextView | ||
@end | ||
|
||
@interface MockFlutterPlatformFactory : NSObject <FlutterPlatformViewFactory> | ||
@end |