0.7.9, but flutter_test pins test_api 0.7.9
mocktail: ^1.0.3
file: ^7.0.0
shared_preferences: ^2.2.0
@@ -68,6 +68,10 @@ dev_dependencies:
# rules and activating additional ones.
flutter_lints: ^6.0.0
full_coverage: ^1.0.0
+ # custom_lint removed: custom_lint 0.8.1 requires analyzer ^8, but
+ # riverpod_lint >=3.1.1 requires analyzer ^9. riverpod_lint 3.1.3
+ # migrated from custom_lint to analysis_server_plugin, so custom_lint
+ # is no longer needed here.
riverpod_lint: ^3.1.3
integration_test:
sdk: flutter
diff --git a/test/assets-en/html-en-main/Time_with_God.html b/test/assets-en/html-en-main/Time_with_God.html
new file mode 100644
index 0000000..17c8316
--- /dev/null
+++ b/test/assets-en/html-en-main/Time_with_God.html
@@ -0,0 +1,87 @@
+
Time with God
+
If we want to know a person, we need to have regular contact with them. It’s the same in our relationship with God: To get to know Him better, we need to make the time to spend with Him.
+
+
The purpose of our time with God
+
- To worship God: God is worthy of our praise and deserves our time.
+- To talk with God: In prayer, we share with Him what is on our hearts. We listen to Him so that He can speak to us and lead us.
+- To learn from God: God wants to teach us through His Word, the Bible, and His Spirit. This is like spiritual food for us so that we can grow.
+
Examples from the Bible
+
Look up the following Bible verses and fill out the table: Which person is it talking about? When, where and how exactly does this person spend time with God?
+
+
+
+| Verse
+ |
+Person
+ |
+Time
+ |
+Place
+ |
+What exactly?
+ |
+
+| Psalms 5:3
+ |
+David
+ |
+in the morning
+ |
+?
+ |
+praying and waiting for answer
+ |
+
+| Daniel 6:11 |
+ |
+ |
+ |
+
+ |
+
+| Mark 1:35 |
+ |
+ |
+ |
+
+ |
+
+| Luke 6:12 |
+ |
+ |
+ |
+
+ |
+
+| Acts 10:9 |
+ |
+ |
+ |
+
+ |
+
+| Acts 16:25 |
+ |
+ |
+ |
+
+ |
+
Tools and suggestions for our time with God
+
- Bible: Read a passage from the Bible and then think and pray about it. You can use the head-heart-hands questions for this:
 | Head: What do I learn here? |
 | Heart: What touches my heart? |
 | Hands: How can I apply this? |
+- Place: Choose a place where you can meet with God without being distracted.
+- Time: Find the best time when you can consistently meet with God.
+- Plan: Choose a Bible book to read through. For the beginning, read Luke and Acts (in the New Testament).
+- Making notes and sharing: Write down or share with your friends your thoughts, what you feel God is saying to you, your questions, the prayer requests of you or your friends, how God answered prayer, encouraging verses, …
+
My commitment for my time with God
+
Time:
+
+
+
Place:
+
+
+
Plan:
+
+
+
+
+
\ No newline at end of file
diff --git a/test/html_view_table_test.dart b/test/html_view_table_test.dart
new file mode 100644
index 0000000..bb00a9c
--- /dev/null
+++ b/test/html_view_table_test.dart
@@ -0,0 +1,221 @@
+import 'dart:io';
+
+import 'package:app4training/widgets/html_view.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+/// Reproduces the "RenderBox was not laid out" crashes reported on pages
+/// like Essentials > Time With God that contain tables. Only goal here:
+/// make sure HtmlView can render common table shapes without throwing.
+void main() {
+ Future
pump(WidgetTester tester, String body) async {
+ await tester.pumpWidget(MaterialApp(
+ home: Scaffold(
+ body: HtmlView(
+ '$body',
+ TextDirection.ltr,
+ ),
+ ),
+ ));
+ await tester.pumpAndSettle();
+ }
+
+ testWidgets('renders a simple 2x2 table', (tester) async {
+ await pump(tester, '''
+
+''');
+ expect(tester.takeException(), isNull);
+ });
+
+ testWidgets('wraps each in a visible horizontal Scrollbar',
+ (tester) async {
+ // Guards the UX affordance: users need a visible scroll thumb to
+ // discover that wide tables are horizontally scrollable.
+ await pump(tester, '''
+
+
+''');
+ expect(tester.takeException(), isNull);
+ // Expect one Scrollbar per table. The outer page scroll is a
+ // SingleChildScrollView without a Scrollbar, so every Scrollbar found
+ // here belongs to a _HorizontalTableScroll wrapper.
+ expect(find.byType(Scrollbar), findsNWidgets(2));
+ // And the scroll direction inside each wrapper must be horizontal.
+ final horizontalScrolls = tester
+ .widgetList(find.byType(SingleChildScrollView))
+ .where((w) => w.scrollDirection == Axis.horizontal)
+ .toList();
+ expect(horizontalScrolls.length, 2);
+ });
+
+ testWidgets('renders a table with long non-breaking cell content', (tester) async {
+ // Long single token that cannot wrap — this is the kind of content that
+ // causes layout problems on some translations of Time With God.
+ await pump(tester, '''
+
+ | Heading | Another heading |
+
+ | Supercalifragilisticexpialidocious_long_word_that_cannot_wrap_naturally |
+ Short |
+
+
+''');
+ expect(tester.takeException(), isNull);
+ });
+
+ testWidgets('renders a wide many-column table', (tester) async {
+ await pump(tester, '''
+
+
+ | Col1 | Col2 | Col3 | Col4 |
+ Col5 | Col6 | Col7 | Col8 |
+
+
+ | row 1 cell 1 with some text |
+ row 1 cell 2 with some text |
+ row 1 cell 3 with some text |
+ row 1 cell 4 with some text |
+ row 1 cell 5 with some text |
+ row 1 cell 6 with some text |
+ row 1 cell 7 with some text |
+ row 1 cell 8 with some text |
+
+
+''');
+ expect(tester.takeException(), isNull);
+ });
+
+ testWidgets('renders a table with th[style] (stripped by sanitize)',
+ (tester) async {
+ await pump(tester, '''
+
+
+ | One |
+ Two |
+ Three |
+
+
+ | Short cell |
+ Medium length cell content that wraps |
+ Some other content here that is longer than the others |
+
+
+''');
+ expect(tester.takeException(), isNull);
+ });
+
+ testWidgets('renders a table with empty cells (fill-in-the-blank)',
+ (tester) async {
+ // Real Time_with_God table shape: lots of empty cells for users to fill in.
+ await pump(tester, '''
+
+
+
+ | Verse |
+ Person |
+ Time |
+ Place |
+ What exactly? |
+
+
+ | Psalms 5:3 |
+ David |
+ in the morning |
+ ? |
+ praying and waiting for answer |
+
+ | Daniel 6:11 | | | | |
+ | Mark 1:35 | | | | |
+ | Luke 6:12 | | | | |
+ | Acts 10:9 | | | | |
+ | Acts 16:25 | | | | |
+
+
+''');
+ expect(tester.takeException(), isNull);
+ });
+
+ testWidgets('renders a nested inside a (Time_with_God shape)',
+ (tester) async {
+ // This is the exact shape from Time_with_God line 70: a table inside a
+ // list item inside a ul. It uses a before the nested table.
+ await pump(tester, '''
+
+ - Bible: Read a passage and think about it. Use the head-heart-hands questions:
+
+
+
+ ![Head-32.png]() |
+ Head: What do I learn here? |
+
+
+ ![Heart-32.png]() |
+ Heart: What touches my heart? |
+
+
+ ![Hands-32.png]() |
+ Hands: How can I apply this? |
+
+
+
+
+ - Place: Choose a quiet place.
+ - Time: Find the best time.
+
+''');
+ expect(tester.takeException(), isNull);
+ });
+
+ testWidgets('renders the real Time_with_God fixture end-to-end',
+ (tester) async {
+ // Pumping the exact page content that was crashing in production.
+ // Critically:
+ // 1. enable semantics — on a real device the semantics pass walks the
+ // render tree and trips `RenderBox.size` assertions on any unlaid
+ // RenderParagraph; without this handle flutter_test skips
+ // flushSemantics and hides the bug;
+ // 2. use a phone-sized surface — the default 800x600 flutter_test
+ // surface is wide enough that the Time_with_God table fits without
+ // horizontal overflow, so the horizontal-scroll / LayoutGrid path
+ // that triggers the assertion on real devices never runs.
+ final semantics = tester.ensureSemantics();
+ try {
+ await tester.binding.setSurfaceSize(const Size(390, 844));
+ final html = File('test/assets-en/html-en-main/Time_with_God.html')
+ .readAsStringSync();
+ await pump(tester, html);
+ expect(tester.takeException(), isNull);
+ } finally {
+ await tester.binding.setSurfaceSize(null);
+ semantics.dispose();
+ }
+ });
+
+ testWidgets('renders a table wrapped in the standard page chrome',
+ (tester) async {
+ // Mimics the structure of a real Time With God page: headings,
+ // paragraphs, and a table together.
+ await pump(tester, '''
+Time with God
+Introduction paragraph describing the topic.
+Three different voices
+
+ | Voice | Source | Effect |
+ | Yourself | Your own thoughts | Self-centered |
+ | Enemy | The enemy | Accusing, fearful |
+ | God | Holy Spirit | Loving, convicting |
+
+Follow-up text after the table.
+''');
+ expect(tester.takeException(), isNull);
+ });
+}
|