Skip to content

Commit 6f0df20

Browse files
[CI] - Configure golden tests (Resolves #36)
1 parent ccc7033 commit 6f0df20

38 files changed

+46
-10
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
test/**/failures/
2+
test_goldens/**/failures/
3+
14
# Miscellaneous
25
*.class
36
*.log

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2022 Declarative, Inc.
1+
Copyright (c) 2025 Declarative, Inc.
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

doc/website/source/styles/docs_page_layout.scss

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,15 @@ main.page-content {
263263

264264
p {
265265
margin-bottom: 1.5em;
266+
}
266267

267-
code {
268-
padding: 3px 6px;
269-
background: #7f00a6;
270-
border: 1px solid #a218cc;
271-
border-radius: 4px;
268+
code {
269+
padding: 3px 6px;
270+
background: #7f00a6;
271+
border: 1px solid #a218cc;
272+
border-radius: 4px;
272273

273-
color: WHITE;
274-
}
274+
color: WHITE;
275275
}
276276

277277
li {

golden_tester.Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ubuntu:latest
2+
3+
ENV FLUTTER_HOME=${HOME}/sdks/flutter
4+
ENV PATH ${PATH}:${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin
5+
6+
USER root
7+
8+
RUN apt update
9+
10+
RUN apt install -y git curl unzip
11+
12+
# Print the Ubuntu version. Useful when there are failing tests.
13+
RUN cat /etc/lsb-release
14+
15+
# Invalidate the cache when flutter pushes a new commit.
16+
ADD https://api.github.com/repos/flutter/flutter/git/refs/heads/master ./flutter-latest-master
17+
18+
RUN git clone https://github.com/flutter/flutter.git ${FLUTTER_HOME}
19+
20+
RUN flutter doctor
21+
22+
# Copy the whole repo.
23+
# We need this because we use local dependencies.
24+
COPY ./ /golden_tester

lib/src/scenes/gallery.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,11 @@ class Gallery {
369369
}
370370

371371
Widget _buildItem(
372-
WidgetTester tester, GoldenSceneItemScaffold itemScaffold, BoxConstraints? constraints, Widget content) {
372+
WidgetTester tester,
373+
GoldenSceneItemScaffold itemScaffold,
374+
BoxConstraints? constraints,
375+
Widget content,
376+
) {
373377
return itemScaffold(
374378
tester,
375379
ConstrainedBox(
@@ -593,8 +597,10 @@ Image.memory(
593597

594598
if (mismatches.mismatches.isEmpty) {
595599
FtgLog.pipeline.info("No golden mismatches found");
600+
return;
596601
}
597602

603+
FtgLog.pipeline.info("Found ${mismatches.mismatches.length} golden mismatches in scene.");
598604
final report = GoldenSceneReport(
599605
metadata: metadata,
600606
items: items,

lib/src/scenes/golden_scene.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ Widget defaultGoldenSceneItemDecorator(
217217
mainAxisSize: MainAxisSize.min,
218218
crossAxisAlignment: CrossAxisAlignment.stretch,
219219
children: [
220-
content,
220+
Align(
221+
alignment: Alignment.centerLeft,
222+
child: content,
223+
),
221224
Padding(
222225
padding: const EdgeInsets.all(24),
223226
child: Text(
-359 Bytes
Loading
-263 Bytes
Binary file not shown.
-618 Bytes
Loading
-436 Bytes
Loading

0 commit comments

Comments
 (0)