fix(app): meaning colours for common outcomes; detail pages fill the pane
Timeline outcomes: success-like words are green, failures red, rejections orange, retries/advisories amber, skips/cancellations grey; a second word of the same family takes the family's next shade and any other word a distinct hue outside the families, so different outcomes still never share a colour. Run detail, stage page and pipeline Summary no longer cap their width at 840: on an unfolded foldable the sections fill the pane. The unused ReadingWidth helper is removed.
This commit is contained in:
@@ -218,8 +218,8 @@ void main() {
|
||||
);
|
||||
// The grid spans the Summary, and its one fact is at the start of the
|
||||
// line rather than a half-width block centred on the page.
|
||||
// Full Summary width, up to the shared reading cap (840) on wide panes.
|
||||
expect(grid.width, moreOrLessEquals(840));
|
||||
// The grid spans the whole Summary width.
|
||||
expect(grid.width, moreOrLessEquals(900));
|
||||
expect(stage.left, moreOrLessEquals(16));
|
||||
expect(stage.center.dx, lessThan(450));
|
||||
expect(find.byType(CupertinoListSection), findsNothing);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/layout/reading_width.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_graph_preview.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_more_menu.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart';
|
||||
@@ -114,10 +113,9 @@ void main() {
|
||||
expect(widePill.right, 1000 - 16);
|
||||
expect(widePill.bottom, 844 - 16);
|
||||
expect(widePill.width, lessThan(1000 * 0.6));
|
||||
// Beside the bar the content takes taps: the body spans the reading
|
||||
// width from the leading edge (Summary is capped on a wide pane).
|
||||
// Beside the bar the content takes taps: the body fills the pane.
|
||||
expect(tester.getRect(body).left, 0);
|
||||
expect(tester.getRect(body).width, kReadingMaxWidth);
|
||||
expect(tester.getRect(body).width, 1000);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} missing graph states the exact wording', (
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/pipelines/pipeline_repository.dart';
|
||||
import 'package:pipelines_app/features/pipelines/pipelines_controller.dart';
|
||||
import 'package:pipelines_app/features/pipelines/widgets/pipeline_detail_panel.dart';
|
||||
import 'package:pipelines_app/features/pipelines/widgets/pipeline_summary_view.dart';
|
||||
import 'package:pipelines_app/ui/layout/reading_width.dart';
|
||||
|
||||
import '../../features/pipelines/fixtures.dart';
|
||||
import '../../features/pipelines/test_helpers.dart';
|
||||
import '../../features/runs/ui/run_detail_graph_support.dart';
|
||||
import '../../features/runs/ui/run_detail_visit_support.dart';
|
||||
|
||||
/// Reading bodies (run Summary, stage page sections, pipeline Summary) keep
|
||||
/// [kReadingMaxWidth] from the leading edge on a wide window and the full
|
||||
/// width on a phone.
|
||||
void main() {
|
||||
Future<void> setSize(WidgetTester tester, Size size) async {
|
||||
tester.view.physicalSize = size;
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
}
|
||||
|
||||
testWidgets('ReadingWidth caps from the leading edge and keeps its child '
|
||||
'across the cap', (tester) async {
|
||||
await setSize(tester, const Size(1200, 600));
|
||||
final scroll = ScrollController();
|
||||
addTearDown(scroll.dispose);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: ReadingWidth(
|
||||
child: ListView(
|
||||
key: const Key('body'),
|
||||
controller: scroll,
|
||||
children: [
|
||||
for (var index = 0; index < 50; index++)
|
||||
SizedBox(height: 40, child: Text('row $index')),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
final wide = tester.getRect(find.byKey(const Key('body')));
|
||||
expect(wide.left, 0);
|
||||
expect(wide.width, kReadingMaxWidth);
|
||||
expect(wide.height, 600);
|
||||
scroll.jumpTo(300);
|
||||
await tester.pump();
|
||||
|
||||
await setSize(tester, const Size(500, 600));
|
||||
await tester.pump();
|
||||
expect(tester.getRect(find.byKey(const Key('body'))).width, 500);
|
||||
expect(scroll.offset, 300, reason: 'the body was not remounted');
|
||||
});
|
||||
|
||||
for (final platform in RunDetailTestPlatform.values) {
|
||||
testWidgets('${platform.name} 1200: run Summary is capped', (tester) async {
|
||||
await pumpRunDetail(tester, platform, size: const Size(1200, 800));
|
||||
final body = tester.getRect(
|
||||
find.byKey(const Key('run-detail-tab-body-summary')),
|
||||
);
|
||||
expect(body.left, 0);
|
||||
expect(body.width, kReadingMaxWidth);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} 390: run Summary keeps the full width', (
|
||||
tester,
|
||||
) async {
|
||||
await pumpRunDetail(tester, platform, size: const Size(390, 844));
|
||||
final body = tester.getRect(
|
||||
find.byKey(const Key('run-detail-tab-body-summary')),
|
||||
);
|
||||
expect(body.width, 390);
|
||||
});
|
||||
|
||||
testWidgets('${platform.name} 1200: stage page Summary is capped', (
|
||||
tester,
|
||||
) async {
|
||||
await openVisit(tester, platform, size: const Size(1200, 900));
|
||||
final body = tester.getRect(
|
||||
find.byKey(const Key('run-visit-body-summary')),
|
||||
);
|
||||
expect(body.left, 0);
|
||||
expect(body.width, kReadingMaxWidth);
|
||||
// The section's trailing copy button sits within the cap.
|
||||
final copy = find.byKey(const ValueKey('run-visit-copy-Input'));
|
||||
expect(tester.getRect(copy).right, lessThanOrEqualTo(kReadingMaxWidth));
|
||||
});
|
||||
}
|
||||
|
||||
testWidgets('1200: pipeline Summary is capped, the pane still scrolls', (
|
||||
tester,
|
||||
) async {
|
||||
await setSize(tester, const Size(1200, 800));
|
||||
final gateway = gatewayFor(PipelineFixture());
|
||||
final controller = PipelinesController(PipelinesRepository(gateway));
|
||||
addTearDown(controller.dispose);
|
||||
await controller.openPipeline(1);
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: PipelineDetailPanel(
|
||||
controller: controller,
|
||||
gateway: gateway,
|
||||
showBack: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final summary = tester.getRect(find.byType(PipelineSummaryView));
|
||||
expect(summary.left, 0);
|
||||
expect(summary.width, kReadingMaxWidth);
|
||||
});
|
||||
}
|
||||
@@ -3,29 +3,62 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/status/outcome_palette.dart';
|
||||
|
||||
void main() {
|
||||
test('same outcome names share a colour; different names never do', () {
|
||||
final palette = OutcomePalette([
|
||||
'success',
|
||||
'rejected',
|
||||
'Success',
|
||||
'approved',
|
||||
'',
|
||||
'rejected ',
|
||||
]);
|
||||
expect(palette.indexOf('success'), 0);
|
||||
expect(palette.indexOf('SUCCESS'), 0);
|
||||
expect(palette.indexOf('rejected'), 1);
|
||||
expect(palette.indexOf('approved'), 2);
|
||||
expect(palette.indexOf(''), isNull);
|
||||
expect(palette.indexOf('never seen'), isNull);
|
||||
});
|
||||
for (final brightness in Brightness.values) {
|
||||
Color colour(OutcomePalette palette, String name) =>
|
||||
palette.colorForBrightness(name, brightness)!;
|
||||
final dark = brightness == Brightness.dark;
|
||||
Color shade(MaterialColor c) => dark ? c.shade300 : c.shade800;
|
||||
|
||||
test('the first fifty outcome colours are all distinct in both themes', () {
|
||||
for (final brightness in Brightness.values) {
|
||||
final colours = {
|
||||
for (var i = 0; i < 50; i++) outcomeColorAt(i, brightness).toARGB32(),
|
||||
};
|
||||
expect(colours, hasLength(50), reason: '$brightness');
|
||||
}
|
||||
test('well-known outcomes take their meaning colour ($brightness)', () {
|
||||
final palette = OutcomePalette([
|
||||
'rejected',
|
||||
'retry',
|
||||
'Success',
|
||||
'error',
|
||||
'skipped',
|
||||
]);
|
||||
expect(colour(palette, 'success'), shade(Colors.green));
|
||||
expect(colour(palette, 'error'), shade(Colors.red));
|
||||
expect(colour(palette, 'rejected'), shade(Colors.deepOrange));
|
||||
expect(colour(palette, 'retry'), shade(Colors.amber));
|
||||
expect(colour(palette, 'skipped'), shade(Colors.blueGrey));
|
||||
// Case and surrounding space do not make a different outcome.
|
||||
expect(colour(palette, ' SUCCESS '), shade(Colors.green));
|
||||
});
|
||||
|
||||
test('different names never share a colour ($brightness)', () {
|
||||
final names = [
|
||||
'success',
|
||||
'approved',
|
||||
'passed',
|
||||
'done',
|
||||
'error',
|
||||
'failed',
|
||||
'fail',
|
||||
'rejected',
|
||||
'blocked',
|
||||
'denied',
|
||||
'retry',
|
||||
'advisory',
|
||||
'warning',
|
||||
'skipped',
|
||||
'canceled',
|
||||
'stopped',
|
||||
for (var i = 0; i < 30; i++) 'custom-$i',
|
||||
];
|
||||
final palette = OutcomePalette(names);
|
||||
final colours = {for (final name in names) colour(palette, name)};
|
||||
expect(colours, hasLength(names.length));
|
||||
// Two success-like words: both green family, but distinct shades.
|
||||
expect(colour(palette, 'approved'), shade(Colors.lightGreen));
|
||||
});
|
||||
}
|
||||
|
||||
test('unseen or blank names have no colour of their own', () {
|
||||
final palette = OutcomePalette(['success', '']);
|
||||
expect(palette.contains('success'), isTrue);
|
||||
expect(palette.contains(''), isFalse);
|
||||
expect(palette.contains('other'), isFalse);
|
||||
expect(palette.colorForBrightness('other', Brightness.light), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user