Skip to content

Commit

Permalink
chore: add tests, update ci, update readme (#22)
Browse files Browse the repository at this point in the history
* Update README.md

* Update README.md

* add tests

* add tests to vector_map_tiles_pmtiles

* add lints and format check to ci

* add example to ci checks, build web in pr workflow
  • Loading branch information
josxha authored Feb 8, 2024
1 parent 07f4294 commit 8f407ed
Show file tree
Hide file tree
Showing 16 changed files with 769 additions and 17 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/on-commit-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ jobs:
channel: "stable"
- name: Install melos
run: dart pub global activate melos
- name: Install coverde
run: dart pub global activate coverde
- name: Bootstrap melos
run: melos bootstrap
- name: Analyze all projects
run: melos run analyze --no-select
- name: Install coverde
run: dart pub global activate coverde
- name: Run tests with coverage
run: melos run test_with_coverage --no-select
- name: Run Codecov
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
jobs:
test:
runs-on: ubuntu-latest
name: Test
name: Analyze & Test
steps:
- name: Checkout project
uses: actions/checkout@v3
Expand All @@ -20,10 +20,12 @@ jobs:
channel: "stable"
- name: Install melos
run: dart pub global activate melos
- name: Install coverde
run: dart pub global activate coverde
- name: Bootstrap melos
run: melos bootstrap
- name: Analyze all projects
run: melos run analyze --no-select
- name: Install coverde
run: dart pub global activate coverde
- name: Run tests with coverage
run: melos run test_with_coverage --no-select
- name: Run Codecov
Expand Down Expand Up @@ -54,3 +56,19 @@ jobs:
with:
name: apk
path: example/build/app/outputs/flutter-apk/app-release.apk
build-web:
runs-on: ubuntu-latest
needs: [ test ]
if: github.repository == 'josxha/flutter_map_plugins'
defaults:
run:
working-directory: ./example
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: Build Web
run: flutter build web
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ build/
# ignore coverage info
**/coverage/lcov.info
coverage/filtered.lcov.info

# ignore generated files by melos
pubspec_overrides.yaml
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Plugins for the flutter_map ecosystem
# Plugins for the flutter_map ecosystem 🗺️

This repository contains multiple flutter packages that extend the
functionality of [flutter_map](https://pub.dev/packages/flutter_map).
Expand All @@ -9,10 +9,17 @@ functionality of [flutter_map](https://pub.dev/packages/flutter_map).
[![Issues](https://img.shields.io/github/issues/josxha/flutter_map_plugins)](https://github.com/josxha/flutter_map_plugins/issues)
[![Open PRs](https://badgen.net/github/open-prs/josxha/flutter_map_cache?label=Open+PRs&color=green)](https://GitHub.com/josxha/flutter_map_plugins/pulls)

A combined example app can be found under
[./example](https://github.com/josxha/flutter_map_plugins).
- A combined example app can be found under
[./example](https://github.com/josxha/flutter_map_plugins)
or use the hosted version
at [https://flutter-map-plugins.web.app](https://flutter-map-plugins.web.app/).
- Need a list of all `flutter_map` plugins? Check out
the [awesome-flutter-map](https://github.com/josxha/awesome-flutter-map?tab=readme-ov-file#awesome-flutter-map)
list.

## [flutter_map_cache](https://pub.dev/packages/flutter_map_cache)
## Packages

### [flutter_map_cache](https://pub.dev/packages/flutter_map_cache)

[![Pub Version](https://img.shields.io/pub/v/flutter_map_cache)](https://pub.dev/packages/flutter_map_cache)
[![likes](https://img.shields.io/pub/likes/flutter_map_cache?logo=flutter)](https://pub.dev/packages/flutter_map_cache)
Expand All @@ -26,7 +33,7 @@ storage backend you would possibly want.
and flutter_map.
- Support for tile cancellation

## [flutter_map_pmtiles](https://pub.dev/packages/flutter_map_pmtiles)
### [flutter_map_pmtiles](https://pub.dev/packages/flutter_map_pmtiles)

[![Pub Version](https://img.shields.io/pub/v/flutter_map_pmtiles)](https://pub.dev/packages/flutter_map_pmtiles)
[![likes](https://img.shields.io/pub/likes/flutter_map_pmtiles?logo=flutter)](https://pub.dev/packages/flutter_map_pmtiles)
Expand All @@ -42,7 +49,7 @@ flutter_map tile layers.
learn more about
PMTiles.

## [vector_map_tiles_pmtiles](https://pub.dev/packages/vector_map_tiles_pmtiles)
### [vector_map_tiles_pmtiles](https://pub.dev/packages/vector_map_tiles_pmtiles)

[![Pub Version](https://img.shields.io/pub/v/vector_map_tiles_pmtiles)](https://pub.dev/packages/vector_map_tiles_pmtiles)
[![likes](https://img.shields.io/pub/likes/vector_map_tiles_pmtiles?logo=flutter)](https://pub.dev/packages/vector_map_tiles_pmtiles)
Expand All @@ -57,4 +64,10 @@ adds support for vector tiles to flutter_map.
- PMTiles is an open archive format for pyramids of tile data, accessible via
HTTP Range Requests. Head over to [protomaps.com](https://protomaps.com/) to
learn more about
PMTiles.
PMTiles.

## Contributions

A huge thanks to all contributors! 😎

[![List of contributors](https://contrib.rocks/image?repo=josxha/flutter_map_plugins)](https://github.com/josxha/flutter_map_plugins/graphs/contributors)
7 changes: 4 additions & 3 deletions flutter_map_cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ A slim yet powerful caching plugin for flutter_map tile layers.
- Many tile providers **require users in their tile usage policy** to cache
tile requests. This decreases the load on those servers and is important
especially if they are donation based like the OpenStreetMap.
- Commercial tile providers normally charge per tile request. By caching tiles
you can reduce the amount of tile requests and **lower your costs**.
- Caching map tiles provides a **better user experience** since the region the
user visited **loads nearby instantly**. Most of the time a user visits the
same regions often, e.g. because it is the region he lives in.
- Especially raster tiles that are used by default on flutter_map, the data
consumption can be high really fast. Caching tiles **lowers the amount of used
mobile data and bandwidth** with itself is an enthusiasm factor you don't want
to miss out on.
consumption can be high quite fast. Caching tiles **lowers the amount of used
mobile data and bandwidth**.

## Features

Expand Down
6 changes: 6 additions & 0 deletions flutter_map_pmtiles/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ dependencies:
pmtiles: ^1.2.0

dev_dependencies:
flutter_test:
sdk: flutter
test: ^1.24.9
mockito: ^5.4.4
build_runner: ^2.4.8
latlong2: ^0.9.0
flutter_lints: ^3.0.0
23 changes: 23 additions & 0 deletions flutter_map_pmtiles/test/integration_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:pmtiles/pmtiles.dart';

@GenerateNiceMocks([MockSpec<PmTilesArchive>()])
import 'integration_test.mocks.dart';
import 'utils/test_app.dart';

Future<void> main() async {
testWidgets('FlutterMap with MbTilesTileProvider', (tester) async {
final pmTiles = MockPmTilesArchive();
when(pmTiles.tile(captureAny)).thenAnswer((params) async => Tile(
params.positionalArguments.first,
bytes: TileProvider.transparentImage,
compression: Compression.none,
type: TileType.png,
));
await tester.pumpWidget(TestApp(pmTiles: pmTiles));
await tester.pumpAndSettle();
});
}
Loading

0 comments on commit 8f407ed

Please sign in to comment.