forked from flutter/packages
-
Notifications
You must be signed in to change notification settings - Fork 4
[DO NOT MERGE] Add BitmapRegistry #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aednlaxer
wants to merge
18
commits into
main
Choose a base branch
from
add-bitmap-registry
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1098e79
Add BitmapRegistry
aednlaxer bdd65ab
Update example code
aednlaxer 774ffae
Initialize ImageRegistry in FLTGoogleMapsPlugin.m
aednlaxer 140dbb2
Update BitmapRegistry example
aednlaxer 94fbf0c
Rename ImageRegistry to FGMImageRegistry on iOS
aednlaxer 5b8555b
Update comments
aednlaxer 06b40c2
Use toBitmapDescriptor when creating bitmaps inside ImageRegistry
aednlaxer 0f13881
Add RegisteredMapBitmap doc and example
aednlaxer e8a25eb
Add default implementation tests
aednlaxer d19b6c9
Fix existing Android tests
aednlaxer 08a408b
Add more tests
aednlaxer ebfb4eb
Clean up iOS implementation
aednlaxer 2e2bf8d
Fix tests
aednlaxer 49d9a05
Reformat code
aednlaxer c7518ee
Rename PlatformBitmapRegisteredMapBitmap to PlatformRegisteredMapBitmap
aednlaxer bd53fba
Fix tests
aednlaxer 9799b6a
Add doc for getBitmap
aednlaxer dcf3876
Add hasRegisteredMapBitmap method to maps inspector
aednlaxer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
packages/google_maps_flutter/google_maps_flutter/test/bitmap_registry_test.dart
This file contains hidden or 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,63 @@ | ||
| import 'dart:typed_data'; | ||
|
|
||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:google_maps_flutter/google_maps_flutter.dart'; | ||
| import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; | ||
|
|
||
| import 'fake_google_maps_flutter_platform.dart'; | ||
|
|
||
| void main() { | ||
| late FakeGoogleMapsFlutterPlatform platform; | ||
|
|
||
| setUp(() { | ||
| platform = FakeGoogleMapsFlutterPlatform(); | ||
| GoogleMapsFlutterPlatform.instance = platform; | ||
| }); | ||
|
|
||
| test('Adding bitmap to registry', () async { | ||
| final BytesMapBitmap bitmap = BytesMapBitmap(Uint8List(20)); | ||
| final int id = await GoogleMapBitmapRegistry.instance.register(bitmap); | ||
| expect(id, 1); | ||
| expect( | ||
| platform.bitmapRegistryRecorder.bitmaps, | ||
| <String>['REGISTER $id $bitmap'], | ||
| ); | ||
| }); | ||
|
|
||
| test('Removing bitmap from registry', () async { | ||
| final BytesMapBitmap bitmap = BytesMapBitmap(Uint8List(20)); | ||
| final int id = await GoogleMapBitmapRegistry.instance.register(bitmap); | ||
| await GoogleMapBitmapRegistry.instance.unregister(id); | ||
| expect( | ||
| platform.bitmapRegistryRecorder.bitmaps, | ||
| <String>['REGISTER $id $bitmap', 'UNREGISTER $id'], | ||
| ); | ||
| }); | ||
|
|
||
| test('Clearing bitmap registry', () async { | ||
| final BytesMapBitmap bitmap = BytesMapBitmap(Uint8List(20)); | ||
| final int id1 = await GoogleMapBitmapRegistry.instance.register(bitmap); | ||
| final int id2 = await GoogleMapBitmapRegistry.instance.register(bitmap); | ||
| expect( | ||
| platform.bitmapRegistryRecorder.bitmaps, | ||
| <String>['REGISTER $id1 $bitmap', 'REGISTER $id2 $bitmap'], | ||
| ); | ||
|
|
||
| await GoogleMapBitmapRegistry.instance.clear(); | ||
| expect( | ||
| platform.bitmapRegistryRecorder.bitmaps, | ||
| <String>['REGISTER $id1 $bitmap', 'REGISTER $id2 $bitmap', 'CLEAR CACHE'], | ||
| ); | ||
| }); | ||
|
|
||
| test('Bitmap ID is incremental', () async { | ||
| final BytesMapBitmap bitmap = BytesMapBitmap(Uint8List(20)); | ||
| final int id1 = await GoogleMapBitmapRegistry.instance.register(bitmap); | ||
| final int id2 = await GoogleMapBitmapRegistry.instance.register(bitmap); | ||
| final int id3 = await GoogleMapBitmapRegistry.instance.register(bitmap); | ||
| final int id4 = await GoogleMapBitmapRegistry.instance.register(bitmap); | ||
| expect(id2, id1 + 1); | ||
| expect(id3, id1 + 2); | ||
| expect(id4, id1 + 3); | ||
| }); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
23 changes: 14 additions & 9 deletions
23
...ps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/ImageRegistry.java
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.