Skip to content
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

[ios] Fix flaky GeoJsonSource tests #593

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
56 changes: 22 additions & 34 deletions example/integration_test/style/source/geojson_source_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart';
import 'package:mapbox_maps_example/empty_map_widget.dart' as app;
import '../../utils/retry.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -54,31 +55,24 @@ void main() {

var source = await mapboxMap.style.getSource('source') as GeoJsonSource;
expect(source.id, 'source');
var maxzoom = await source.maxzoom;
expect(maxzoom, 1.0);

var attribution = await source.attribution;
final maxzoom = await source.maxzoom;
expect(maxzoom, 1.0);
final attribution = await source.attribution;
expect(attribution, "abc");

var buffer = await source.buffer;
final buffer = await source.buffer;
expect(buffer, 1.0);

var tolerance = await source.tolerance;
final tolerance = await source.tolerance;
expect(tolerance, 1.0);

var cluster = await source.cluster;
final cluster = await source.cluster;
expect(cluster, true);

var clusterRadius = await source.clusterRadius;
final clusterRadius = await source.clusterRadius;
expect(clusterRadius, 1.0);

var clusterMaxZoom = await source.clusterMaxZoom;
final clusterMaxZoom = await source.clusterMaxZoom;
expect(clusterMaxZoom, 1.0);

var clusterMinPoints = await source.clusterMinPoints;
final clusterMinPoints = await source.clusterMinPoints;
expect(clusterMinPoints, 1.0);

var clusterProperties = await source.clusterProperties;
final clusterProperties = await source.clusterProperties;
expect(clusterProperties, {
"sum": [
[
Expand All @@ -95,25 +89,19 @@ void main() {
1.0
]
});

var lineMetrics = await source.lineMetrics;
final lineMetrics = await source.lineMetrics;
expect(lineMetrics, true);

var generateId = await source.generateId;
final generateId = await source.generateId;
expect(generateId, true);

// TODO: Investigate why this check is susceptible to fail on iOS
// https://mapbox.atlassian.net/browse/MAPSFLT-141
if (Platform.isAndroid) {
var prefetchZoomDelta = await source.prefetchZoomDelta;
expect(prefetchZoomDelta, 1.0);
}

var tileCacheBudget = await source.tileCacheBudget;
expect(tileCacheBudget?.size,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)).size);
expect(tileCacheBudget?.type,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)).type);
await retry(2, () async {
await expectLater(source.prefetchZoomDelta, completion(1.0));
});
await retry(2, () async {
await expectLater(
source.tileCacheBudget,
completion(TileCacheBudget.inMegabytes(
TileCacheBudgetInMegabytes(size: 3))));
});
});
}
// End of generated file.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart';
import 'package:mapbox_maps_example/empty_map_widget.dart' as app;
import '../../utils/retry.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand All @@ -31,15 +32,15 @@ void main() {

var source = await mapboxMap.style.getSource('source') as ImageSource;
expect(source.id, 'source');
var coordinates = await source.coordinates;

final coordinates = await source.coordinates;
expect(coordinates, [
[0.0, 1.0],
[0.0, 1.0],
[0.0, 1.0],
[0.0, 1.0]
]);

var prefetchZoomDelta = await source.prefetchZoomDelta;
final prefetchZoomDelta = await source.prefetchZoomDelta;
expect(prefetchZoomDelta, 1.0);
});
}
Expand Down
49 changes: 18 additions & 31 deletions example/integration_test/style/source/raster_source_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart';
import 'package:mapbox_maps_example/empty_map_widget.dart' as app;
import '../../utils/retry.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -39,50 +40,36 @@ void main() {

var source = await mapboxMap.style.getSource('source') as RasterSource;
expect(source.id, 'source');
var tiles = await source.tiles;
expect(tiles, ["a", "b", "c"]);

var bounds = await source.bounds;
final tiles = await source.tiles;
expect(tiles, ["a", "b", "c"]);
final bounds = await source.bounds;
expect(bounds, [0.0, 1.0, 2.0, 3.0]);

var minzoom = await source.minzoom;
final minzoom = await source.minzoom;
expect(minzoom, 1.0);

var maxzoom = await source.maxzoom;
final maxzoom = await source.maxzoom;
expect(maxzoom, 1.0);

var tileSize = await source.tileSize;
final tileSize = await source.tileSize;
expect(tileSize, 1.0);

var scheme = await source.scheme;
final scheme = await source.scheme;
expect(scheme, Scheme.XYZ);

var attribution = await source.attribution;
final attribution = await source.attribution;
expect(attribution, "abc");

var volatile = await source.volatile;
final volatile = await source.volatile;
expect(volatile, true);

var prefetchZoomDelta = await source.prefetchZoomDelta;
final prefetchZoomDelta = await source.prefetchZoomDelta;
expect(prefetchZoomDelta, 1.0);

var tileCacheBudget = await source.tileCacheBudget;
expect(tileCacheBudget?.size,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)).size);
expect(tileCacheBudget?.type,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)).type);

var minimumTileUpdateInterval = await source.minimumTileUpdateInterval;
final tileCacheBudget = await source.tileCacheBudget;
expect(tileCacheBudget,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)));
final minimumTileUpdateInterval = await source.minimumTileUpdateInterval;
expect(minimumTileUpdateInterval, 1.0);

var maxOverscaleFactorForParentTiles =
final maxOverscaleFactorForParentTiles =
await source.maxOverscaleFactorForParentTiles;
expect(maxOverscaleFactorForParentTiles, 1.0);

var tileRequestsDelay = await source.tileRequestsDelay;
final tileRequestsDelay = await source.tileRequestsDelay;
expect(tileRequestsDelay, 1.0);

var tileNetworkRequestsDelay = await source.tileNetworkRequestsDelay;
final tileNetworkRequestsDelay = await source.tileNetworkRequestsDelay;
expect(tileNetworkRequestsDelay, 1.0);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart';
import 'package:mapbox_maps_example/empty_map_widget.dart' as app;
import '../../utils/retry.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand All @@ -32,29 +33,22 @@ void main() {

var source = await mapboxMap.style.getSource('source') as RasterArraySource;
expect(source.id, 'source');
var tiles = await source.tiles;
expect(tiles, ["a", "b", "c"]);

var bounds = await source.bounds;
final tiles = await source.tiles;
expect(tiles, ["a", "b", "c"]);
final bounds = await source.bounds;
expect(bounds, [0.0, 1.0, 2.0, 3.0]);

var minzoom = await source.minzoom;
final minzoom = await source.minzoom;
expect(minzoom, 1.0);

var maxzoom = await source.maxzoom;
final maxzoom = await source.maxzoom;
expect(maxzoom, 1.0);

var tileSize = await source.tileSize;
final tileSize = await source.tileSize;
expect(tileSize, 1.0);

var attribution = await source.attribution;
final attribution = await source.attribution;
expect(attribution, "abc");

var tileCacheBudget = await source.tileCacheBudget;
expect(tileCacheBudget?.size,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)).size);
expect(tileCacheBudget?.type,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)).type);
final tileCacheBudget = await source.tileCacheBudget;
expect(tileCacheBudget,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)));
});
}
// End of generated file.
49 changes: 18 additions & 31 deletions example/integration_test/style/source/rasterdem_source_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart';
import 'package:mapbox_maps_example/empty_map_widget.dart' as app;
import '../../utils/retry.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -39,50 +40,36 @@ void main() {

var source = await mapboxMap.style.getSource('source') as RasterDemSource;
expect(source.id, 'source');
var tiles = await source.tiles;
expect(tiles, ["a", "b", "c"]);

var bounds = await source.bounds;
final tiles = await source.tiles;
expect(tiles, ["a", "b", "c"]);
final bounds = await source.bounds;
expect(bounds, [0.0, 1.0, 2.0, 3.0]);

var minzoom = await source.minzoom;
final minzoom = await source.minzoom;
expect(minzoom, 1.0);

var maxzoom = await source.maxzoom;
final maxzoom = await source.maxzoom;
expect(maxzoom, 1.0);

var tileSize = await source.tileSize;
final tileSize = await source.tileSize;
expect(tileSize, 1.0);

var attribution = await source.attribution;
final attribution = await source.attribution;
expect(attribution, "abc");

var encoding = await source.encoding;
final encoding = await source.encoding;
expect(encoding, Encoding.TERRARIUM);

var volatile = await source.volatile;
final volatile = await source.volatile;
expect(volatile, true);

var prefetchZoomDelta = await source.prefetchZoomDelta;
final prefetchZoomDelta = await source.prefetchZoomDelta;
expect(prefetchZoomDelta, 1.0);

var tileCacheBudget = await source.tileCacheBudget;
expect(tileCacheBudget?.size,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)).size);
expect(tileCacheBudget?.type,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)).type);

var minimumTileUpdateInterval = await source.minimumTileUpdateInterval;
final tileCacheBudget = await source.tileCacheBudget;
expect(tileCacheBudget,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)));
final minimumTileUpdateInterval = await source.minimumTileUpdateInterval;
expect(minimumTileUpdateInterval, 1.0);

var maxOverscaleFactorForParentTiles =
final maxOverscaleFactorForParentTiles =
await source.maxOverscaleFactorForParentTiles;
expect(maxOverscaleFactorForParentTiles, 1.0);

var tileRequestsDelay = await source.tileRequestsDelay;
final tileRequestsDelay = await source.tileRequestsDelay;
expect(tileRequestsDelay, 1.0);

var tileNetworkRequestsDelay = await source.tileNetworkRequestsDelay;
final tileNetworkRequestsDelay = await source.tileNetworkRequestsDelay;
expect(tileNetworkRequestsDelay, 1.0);
});
}
Expand Down
46 changes: 17 additions & 29 deletions example/integration_test/style/source/vector_source_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart';
import 'package:mapbox_maps_example/empty_map_widget.dart' as app;
import '../../utils/retry.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -38,47 +39,34 @@ void main() {

var source = await mapboxMap.style.getSource('source') as VectorSource;
expect(source.id, 'source');
var tiles = await source.tiles;
expect(tiles, ["a", "b", "c"]);

var bounds = await source.bounds;
final tiles = await source.tiles;
expect(tiles, ["a", "b", "c"]);
final bounds = await source.bounds;
expect(bounds, [0.0, 1.0, 2.0, 3.0]);

var scheme = await source.scheme;
final scheme = await source.scheme;
expect(scheme, Scheme.XYZ);

var minzoom = await source.minzoom;
final minzoom = await source.minzoom;
expect(minzoom, 1.0);

var maxzoom = await source.maxzoom;
final maxzoom = await source.maxzoom;
expect(maxzoom, 1.0);

var attribution = await source.attribution;
final attribution = await source.attribution;
expect(attribution, "abc");

var volatile = await source.volatile;
final volatile = await source.volatile;
expect(volatile, true);

var prefetchZoomDelta = await source.prefetchZoomDelta;
final prefetchZoomDelta = await source.prefetchZoomDelta;
expect(prefetchZoomDelta, 1.0);

var tileCacheBudget = await source.tileCacheBudget;
expect(tileCacheBudget?.size,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)).size);
expect(tileCacheBudget?.type,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)).type);

var minimumTileUpdateInterval = await source.minimumTileUpdateInterval;
final tileCacheBudget = await source.tileCacheBudget;
expect(tileCacheBudget,
TileCacheBudget.inMegabytes(TileCacheBudgetInMegabytes(size: 3)));
final minimumTileUpdateInterval = await source.minimumTileUpdateInterval;
expect(minimumTileUpdateInterval, 1.0);

var maxOverscaleFactorForParentTiles =
final maxOverscaleFactorForParentTiles =
await source.maxOverscaleFactorForParentTiles;
expect(maxOverscaleFactorForParentTiles, 1.0);

var tileRequestsDelay = await source.tileRequestsDelay;
final tileRequestsDelay = await source.tileRequestsDelay;
expect(tileRequestsDelay, 1.0);

var tileNetworkRequestsDelay = await source.tileNetworkRequestsDelay;
final tileNetworkRequestsDelay = await source.tileNetworkRequestsDelay;
expect(tileNetworkRequestsDelay, 1.0);
});
}
Expand Down
Loading