Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions super_editor/test/super_editor/supereditor_test_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:ui' as ui;

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_test_goldens/flutter_test_goldens.dart';
import 'package:mockito/mockito.dart';
import 'package:super_editor/super_editor.dart';
import 'package:super_editor/super_editor_test.dart';
Expand Down Expand Up @@ -306,6 +307,28 @@ class TestSuperEditorConfigurator {
return this;
}

/// Configures the [SuperEditor] to use a widget compatible with a [Gallery] test.
///
/// The widget tree contains:
/// - The [scaffold] at the top.
/// - A [GoldenImageBounds] under the [scaffold].
/// - The [SuperEditor] widget, decorated with the [decorator].
///
/// See [Gallery.itemFromPumper] for more details.
TestSuperEditorConfigurator withGalleryScaffold(GalleryItemScaffold scaffold, GalleryItemDecorator? decorator) {
_config.widgetTreeBuilder = (superEditor) {
return scaffold(
_widgetTester,
GoldenImageBounds(
child: decorator != null //
? decorator.call(_widgetTester, superEditor)
: superEditor,
),
);
};
return this;
}

/// Configures the [SuperEditor] to display an [AppBar] with the given height above the [SuperEditor].
///
/// If [withCustomWidgetTreeBuilder] is used, this setting is ignored.
Expand Down
Loading
Loading