miler map
This commit is contained in:
@@ -60,7 +60,19 @@ void main() {
|
||||
/// 2 pending, no phone → the same, with nothing to call
|
||||
/// 3 rejected + phone → no tick; it is already decided
|
||||
/// 4 skipped, no phone → not listed at all
|
||||
Future<void> pumpRoute(WidgetTester tester, {String? kitchen}) async {
|
||||
/// [uniform] forces every stop to one kind, for the tests that are about a
|
||||
/// row's **state** rather than its shape.
|
||||
///
|
||||
/// A mixed route no longer draws one shape: drops gather under the hub they
|
||||
/// were loaded at and collections stay their own doors, so a rung and a node
|
||||
/// legitimately sit at different indents. See `hub_pickup_group_test.dart`.
|
||||
/// Comparing across the two measures the grouping, not the thing under test.
|
||||
Future<void> pumpRoute(
|
||||
WidgetTester tester, {
|
||||
String? kitchen,
|
||||
String? uniform,
|
||||
bool secondAddress = false,
|
||||
}) async {
|
||||
tester.view.physicalSize = const Size(1170, 2532);
|
||||
tester.view.devicePixelRatio = 3.0;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
@@ -69,11 +81,28 @@ void main() {
|
||||
final trip = Trip.fromStops(
|
||||
id: 'mixed',
|
||||
stops: [
|
||||
stop('A', type: 'pickup', phone: '9876543210', kitchen: kitchen),
|
||||
stop('B', type: 'delivery', kitchen: kitchen),
|
||||
stop('C', type: 'combined', phone: '9876500000', kitchen: kitchen),
|
||||
stop(
|
||||
'A',
|
||||
type: uniform ?? 'pickup',
|
||||
phone: '9876543210',
|
||||
kitchen: kitchen,
|
||||
),
|
||||
{
|
||||
...stop('D', type: 'pickup', kitchen: kitchen),
|
||||
...stop('B', type: uniform ?? 'delivery', kitchen: kitchen),
|
||||
if (secondAddress) ...{
|
||||
'pickupaddress': '4, Avinashi Rd, Coimbatore',
|
||||
'kitchenid': 'K2',
|
||||
'kitchenname': 'Second Counter',
|
||||
},
|
||||
},
|
||||
stop(
|
||||
'C',
|
||||
type: uniform ?? 'combined',
|
||||
phone: '9876500000',
|
||||
kitchen: kitchen,
|
||||
),
|
||||
{
|
||||
...stop('D', type: uniform ?? 'pickup', kitchen: kitchen),
|
||||
'orderstatus': 'skipped',
|
||||
},
|
||||
],
|
||||
@@ -102,10 +131,17 @@ void main() {
|
||||
}
|
||||
|
||||
testWidgets('every node sits on one vertical axis', (tester) async {
|
||||
await pumpRoute(tester);
|
||||
ServiceProfile.setActive(ServiceProfile.milkMan);
|
||||
await pumpRoute(tester, kitchen: 'K1', secondAddress: true);
|
||||
|
||||
// ── A logistics run is one node, so the axes are compared on a milk round ──
|
||||
//
|
||||
// Home groups the parcel line's whole day under the rider's base now, which
|
||||
// is the point of the change but leaves a single node with nothing to
|
||||
// compare against. A kitchen line still draws one node per counter, which
|
||||
// is the shape this test was written for.
|
||||
final nodes = find.byType(PickupTimelineGroup);
|
||||
expect(nodes.evaluate().length, greaterThan(1), reason: 'a mixed route');
|
||||
expect(nodes.evaluate().length, greaterThan(1), reason: 'two counters');
|
||||
|
||||
// The spine is a fixed-width rail with the node centred in it, so this
|
||||
// holds by construction — which is exactly why it is worth pinning. The
|
||||
@@ -123,7 +159,9 @@ void main() {
|
||||
testWidgets('the rail does not move when a row changes state', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpRoute(tester);
|
||||
// One kind throughout: this is about **state**, and a mixed route now draws
|
||||
// two shapes on purpose — see [pumpRoute]'s `uniform`.
|
||||
await pumpRoute(tester, uniform: 'pickup');
|
||||
|
||||
// Two of the four are listed now. The skipped one has always been
|
||||
// Activity's row; the **rejected** one joined it — a declined stop leaves
|
||||
|
||||
Reference in New Issue
Block a user