device infos
This commit is contained in:
@@ -6,7 +6,6 @@ import 'package:miler/data/service_profile.dart';
|
||||
import 'package:miler/data/stop_area.dart';
|
||||
import 'package:miler/views/Dashboard/home/homepage_banner.dart';
|
||||
import 'package:miler/views/Dashboard/pickups/pickups.dart';
|
||||
import 'package:miler/views/helpers/constants/Colorconstants.dart';
|
||||
|
||||
/// ─────────────────────────────────────────────────────────────────────────
|
||||
/// THE WORK QUEUE, NOT A LIST OF CARDS
|
||||
@@ -96,22 +95,19 @@ void main() {
|
||||
await ready(tester);
|
||||
const inset = 34.0;
|
||||
|
||||
// Live stop: the banner is up, and the floor clears the banner.
|
||||
// ── One surface, where there were two ──
|
||||
//
|
||||
// This case used to be a three-way check, because a **Start delivery**
|
||||
// bar shared this corner with the live strip. That bar is gone — the
|
||||
// release it made now happens per stop, when the rider slides Start ride
|
||||
// on the map, which is the moment he actually sets off. See `startRound`.
|
||||
//
|
||||
// What the rule protects is unchanged: the floor reserves exactly what is
|
||||
// floating over the list, plus the device inset.
|
||||
expect(
|
||||
bottomReservationFor(inset: inset, live: true, unreleased: true),
|
||||
bottomReservationFor(inset: inset, live: true),
|
||||
inset + ActivePickupBanner.maxHeight,
|
||||
);
|
||||
// A live stop suppresses the start bar, so the banner wins even when
|
||||
// there is unreleased work — the two never stack.
|
||||
expect(
|
||||
bottomReservationFor(inset: inset, live: true, unreleased: false),
|
||||
inset + ActivePickupBanner.maxHeight,
|
||||
);
|
||||
// Nothing running, load in hand: the start bar.
|
||||
expect(
|
||||
bottomReservationFor(inset: inset, live: false, unreleased: true),
|
||||
inset + StartRoundBar.maxHeight,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('the device inset is always counted', (tester) async {
|
||||
@@ -120,16 +116,8 @@ void main() {
|
||||
// inset, so on a gesture-navigation phone the last row of the run sat
|
||||
// behind the banner *and* behind the navigation.
|
||||
for (final live in const [true, false]) {
|
||||
final withInset = bottomReservationFor(
|
||||
inset: 34,
|
||||
live: live,
|
||||
unreleased: true,
|
||||
);
|
||||
final without = bottomReservationFor(
|
||||
inset: 0,
|
||||
live: live,
|
||||
unreleased: true,
|
||||
);
|
||||
final withInset = bottomReservationFor(inset: 34, live: live);
|
||||
final without = bottomReservationFor(inset: 0, live: live);
|
||||
expect(withInset - without, 34);
|
||||
}
|
||||
});
|
||||
@@ -137,98 +125,29 @@ void main() {
|
||||
testWidgets('an idle queue reserves almost nothing', (tester) async {
|
||||
await ready(tester);
|
||||
expect(
|
||||
bottomReservationFor(inset: 0, live: false, unreleased: false),
|
||||
lessThan(StartRoundBar.maxHeight),
|
||||
bottomReservationFor(inset: 0, live: false),
|
||||
lessThan(ActivePickupBanner.maxHeight),
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('both surfaces declare a real height', (tester) async {
|
||||
testWidgets('the floating surface declares a real height', (tester) async {
|
||||
await ready(tester);
|
||||
// Measured, not guessed. Each is the only thing that knows how much of
|
||||
// the list it covers.
|
||||
// Measured, not guessed. It is the only thing that knows how much of the
|
||||
// list it covers.
|
||||
expect(ActivePickupBanner.maxHeight, greaterThan(48));
|
||||
expect(StartRoundBar.maxHeight, greaterThan(48));
|
||||
});
|
||||
});
|
||||
|
||||
group('the command surface', () {
|
||||
Future<void> pumpBar(
|
||||
WidgetTester tester, {
|
||||
double width = 390,
|
||||
double textScale = 1.0,
|
||||
int count = 5,
|
||||
}) async {
|
||||
ServiceProfile.setActive(ServiceProfile.milkMan);
|
||||
tester.view.physicalSize = Size(width * 3, 844 * 3);
|
||||
tester.view.devicePixelRatio = 3.0;
|
||||
addTearDown(tester.view.reset);
|
||||
|
||||
await tester.pumpWidget(
|
||||
ScreenUtilInit(
|
||||
designSize: const Size(390, 844),
|
||||
builder: (_, _) => MaterialApp(
|
||||
builder: (context, child) => MediaQuery(
|
||||
data: MediaQuery.of(
|
||||
context,
|
||||
).copyWith(textScaler: TextScaler.linear(textScale)),
|
||||
child: child!,
|
||||
),
|
||||
home: Scaffold(
|
||||
backgroundColor: ColorConstants.daylightSurface,
|
||||
body: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: StartRoundBar(
|
||||
count: count,
|
||||
busy: false,
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
testWidgets('it says what is in hand and what the press does', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpBar(tester);
|
||||
// Setting off is reversible and operational, so it is a press — unlike
|
||||
// Picked and Delivered, which are assertions about custody.
|
||||
expect(find.textContaining('Start'), findsOneWidget);
|
||||
});
|
||||
|
||||
for (final (width, scale) in const [
|
||||
(390.0, 1.0),
|
||||
(390.0, 1.3),
|
||||
(390.0, 2.0),
|
||||
(375.0, 2.0),
|
||||
(320.0, 1.0),
|
||||
(320.0, 2.0),
|
||||
]) {
|
||||
testWidgets('${width.toInt()}px @ ${scale}x lays out clean', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpBar(tester, width: width, textScale: scale, count: 12);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('it never wraps itself in a second SafeArea', (tester) async {
|
||||
await pumpBar(tester);
|
||||
// `BottomPage.bottomInset` is the one owner of the device inset on this
|
||||
// screen. A `SafeArea` here would count it twice and float the bar a
|
||||
// navigation bar's height off the bottom of the screen.
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(StartRoundBar),
|
||||
matching: find.byType(SafeArea),
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
});
|
||||
});
|
||||
// ── The "command surface" group is gone with its control ──
|
||||
//
|
||||
// It covered the **Start delivery** bar: what it said, how it laid out at six
|
||||
// widths and text scales, and that it never double-counted the device inset.
|
||||
// The bar was removed at the rider's request — the release it made is made
|
||||
// per stop now, by the Start ride slider on the map, at the moment he
|
||||
// actually sets off. See `startRound` for the whole argument.
|
||||
//
|
||||
// Nothing replaced it in that corner, so there is nothing here to test. The
|
||||
// reservation rule above still pins the geometry the corner has to keep.
|
||||
}
|
||||
|
||||
/// Real addresses from the live tenant, added after seeing them render on a
|
||||
|
||||
Reference in New Issue
Block a user