Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[webview_flutter_wkwebview] The rest of the Objective-C HostApi methods #5604

Merged
merged 26 commits into from
May 10, 2022
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7dde204
bunch of work for other apis
bparrishMines May 2, 2022
cdd76b0
compiles again
bparrishMines May 2, 2022
56351ea
working tests
bparrishMines May 2, 2022
d045afc
formatting
bparrishMines May 2, 2022
e10b1fb
fix cookie host api
bparrishMines May 2, 2022
b09d7a6
first create tests
bparrishMines May 2, 2022
a13148b
create tests
bparrishMines May 2, 2022
be098ef
more class implemented
bparrishMines May 2, 2022
76cb1b8
uidelegate and navigation delgate and formatting
bparrishMines May 2, 2022
650e731
converter tests
bparrishMines May 2, 2022
c0e7166
uiview and scrollview
bparrishMines May 3, 2022
5bd77f2
finished nsobject
bparrishMines May 3, 2022
3961002
formatting
bparrishMines May 3, 2022
8f0ba5b
small spaces
bparrishMines May 3, 2022
fc6a356
delete generated files
bparrishMines May 3, 2022
d2c8762
remove simple ast and fix tests
bparrishMines May 3, 2022
fe35717
remove template files
bparrishMines May 3, 2022
8509944
lints bro
bparrishMines May 3, 2022
b721b68
shorthand
bparrishMines May 3, 2022
bdcfff9
fix message
bparrishMines May 4, 2022
de645bd
review comments
bparrishMines May 10, 2022
8bca337
cant test lower version
bparrishMines May 10, 2022
1764362
Merge branch 'main' of github.com:flutter/plugins into test_ground
bparrishMines May 10, 2022
9e88548
PR comments
bparrishMines May 10, 2022
a747430
Merge branch 'main' of github.com:flutter/plugins into test_ground
bparrishMines May 10, 2022
45744b7
Merge branch 'main' of github.com:flutter/plugins into test_ground
bparrishMines May 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
formatting
bparrishMines committed May 3, 2022
commit 3961002623870eea24e17f1df802a668d9d226f2
Original file line number Diff line number Diff line change
@@ -18,20 +18,29 @@ - (void)testAddObserver {
FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init];
[instanceManager addInstance:mockObject withIdentifier:0];

FWFObjectHostApiImpl *hostApi = [[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager];

FWFObjectHostApiImpl *hostApi =
[[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager];

NSObject *observerObject = [[NSObject alloc] init];
[instanceManager addInstance:observerObject withIdentifier:1];

FlutterError *error;
[hostApi addObserverForObjectWithIdentifier:@0
observerIdentifier:@1
keyPath:@"myKey"
options:@[[FWFNSKeyValueObservingOptionsEnumData makeWithValue:FWFNSKeyValueObservingOptionsEnumOldValue],
[FWFNSKeyValueObservingOptionsEnumData makeWithValue:FWFNSKeyValueObservingOptionsEnumNewValue]]
error:&error];

OCMVerify([mockObject addObserver:observerObject forKeyPath:@"myKey" options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:nil]);
[hostApi
addObserverForObjectWithIdentifier:@0
observerIdentifier:@1
keyPath:@"myKey"
options:@[
[FWFNSKeyValueObservingOptionsEnumData
makeWithValue:FWFNSKeyValueObservingOptionsEnumOldValue],
[FWFNSKeyValueObservingOptionsEnumData
makeWithValue:FWFNSKeyValueObservingOptionsEnumNewValue]
]
error:&error];

OCMVerify([mockObject addObserver:observerObject
forKeyPath:@"myKey"
options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew)
context:nil]);
XCTAssertNil(error);
}

@@ -42,17 +51,16 @@ - (void)testRemoveObserver {
[instanceManager addInstance:mockObject withIdentifier:0];

FWFObjectHostApiImpl *hostApi =
[[FWFObjectHostApiImpl alloc]
initWithInstanceManager:instanceManager];

[[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager];

NSObject *observerObject = [[NSObject alloc] init];
[instanceManager addInstance:observerObject withIdentifier:1];

FlutterError *error;
[hostApi removeObserverForObjectWithIdentifier:@0
observerIdentifier:@1
keyPath:@"myKey"
error:&error];
observerIdentifier:@1
keyPath:@"myKey"
error:&error];
OCMVerify([mockObject removeObserver:observerObject forKeyPath:@"myKey"]);
XCTAssertNil(error);
}
@@ -64,8 +72,7 @@ - (void)testDispose {
[instanceManager addInstance:object withIdentifier:0];

FWFObjectHostApiImpl *hostApi =
[[FWFObjectHostApiImpl alloc]
initWithInstanceManager:instanceManager];
[[FWFObjectHostApiImpl alloc] initWithInstanceManager:instanceManager];

FlutterError *error;
[hostApi disposeObjectWithIdentifier:@0 error:&error];
Original file line number Diff line number Diff line change
@@ -19,14 +19,12 @@ - (void)testGetContentOffset {
FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init];
[instanceManager addInstance:mockScrollView withIdentifier:0];

FWFScrollViewHostApiImpl *hostApi = [[FWFScrollViewHostApiImpl alloc]
initWithInstanceManager:instanceManager];
FWFScrollViewHostApiImpl *hostApi =
[[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager];

FlutterError *error;
NSArray<NSNumber *> *expectedValue = @[@1.0, @2.0];
XCTAssertEqualObjects(
[hostApi contentOffsetForScrollViewWithIdentifier:@0
error:&error],
NSArray<NSNumber *> *expectedValue = @[ @1.0, @2.0 ];
XCTAssertEqualObjects([hostApi contentOffsetForScrollViewWithIdentifier:@0 error:&error],
expectedValue);
XCTAssertNil(error);
}
@@ -39,14 +37,10 @@ - (void)testScrollBy {
[instanceManager addInstance:scrollView withIdentifier:0];

FWFScrollViewHostApiImpl *hostApi =
[[FWFScrollViewHostApiImpl alloc]
initWithInstanceManager:instanceManager];
[[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager];

FlutterError *error;
[hostApi scrollByForScrollViewWithIdentifier:@0
x:@1
y:@2
error:&error];
[hostApi scrollByForScrollViewWithIdentifier:@0 x:@1 y:@2 error:&error];
XCTAssertEqual(scrollView.contentOffset.x, 2);
XCTAssertEqual(scrollView.contentOffset.y, 4);
XCTAssertNil(error);
@@ -59,14 +53,10 @@ - (void)testSetContentOffset {
[instanceManager addInstance:scrollView withIdentifier:0];

FWFScrollViewHostApiImpl *hostApi =
[[FWFScrollViewHostApiImpl alloc]
initWithInstanceManager:instanceManager];
[[FWFScrollViewHostApiImpl alloc] initWithInstanceManager:instanceManager];

FlutterError *error;
[hostApi setContentOffsetForScrollViewWithIdentifier:@0
toX:@1
y:@2
error:&error];
[hostApi setContentOffsetForScrollViewWithIdentifier:@0 toX:@1 y:@2 error:&error];
XCTAssertEqual(scrollView.contentOffset.x, 1);
XCTAssertEqual(scrollView.contentOffset.y, 2);
XCTAssertNil(error);
Original file line number Diff line number Diff line change
@@ -19,14 +19,11 @@ - (void)testSetBackgroundColor {
[instanceManager addInstance:mockUIView withIdentifier:0];

FWFUIViewHostApiImpl *hostApi =
[[FWFUIViewHostApiImpl alloc]
initWithInstanceManager:instanceManager];
[[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager];

FlutterError *error;
[hostApi setBackgroundColorForViewWithIdentifier:@0
toValue:@123
error:&error];

[hostApi setBackgroundColorForViewWithIdentifier:@0 toValue:@123 error:&error];

OCMVerify([mockUIView setBackgroundColor:[UIColor colorWithRed:(123 >> 16 & 0xff) / 255.0
green:(123 >> 8 & 0xff) / 255.0
blue:(123 & 0xff) / 255.0
@@ -41,13 +38,10 @@ - (void)testSetOpaque {
[instanceManager addInstance:mockUIView withIdentifier:0];

FWFUIViewHostApiImpl *hostApi =
[[FWFUIViewHostApiImpl alloc]
initWithInstanceManager:instanceManager];
[[FWFUIViewHostApiImpl alloc] initWithInstanceManager:instanceManager];

FlutterError *error;
[hostApi setOpaqueForViewWithIdentifier:@0
isOpaque:@YES
error:&error];
[hostApi setOpaqueForViewWithIdentifier:@0 isOpaque:@YES error:&error];
OCMVerify([mockUIView setOpaque:YES]);
XCTAssertNil(error);
}
Loading