Release RuleGel 1.0.1 with Realbooru
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:gel_rule_app/backend/models/post.dart';
|
||||
import 'package:gel_rule_app/features/post/presentation/widgets/post_tags_panel.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('post tags panel renders category rows compactly',
|
||||
(tester) async {
|
||||
final router = GoRouter(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
builder: (_, __) => Scaffold(
|
||||
body: PostTagsPanel(
|
||||
post: _post(
|
||||
tagGroups: {
|
||||
'artist': ['artist_name'],
|
||||
'character': ['hero'],
|
||||
'general': List.generate(30, (index) => 'tag_$index'),
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
await tester.pumpWidget(MaterialApp.router(routerConfig: router));
|
||||
|
||||
expect(find.text('Artist'), findsOneWidget);
|
||||
expect(find.text('Character'), findsOneWidget);
|
||||
expect(find.text('General'), findsOneWidget);
|
||||
expect(find.text('tag_0'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
Post _post({required Map<String, List<String>> tagGroups}) {
|
||||
return Post(
|
||||
id: '1',
|
||||
providerId: 'test',
|
||||
providerName: 'Test',
|
||||
previewUrl: 'https://example.test/preview.jpg',
|
||||
sampleUrl: 'https://example.test/sample.jpg',
|
||||
fileUrl: 'https://example.test/file.jpg',
|
||||
tags: const [],
|
||||
rating: 'general',
|
||||
width: 100,
|
||||
height: 100,
|
||||
createdAt: DateTime(2026),
|
||||
fileType: 'photo',
|
||||
score: 1,
|
||||
tagGroups: tagGroups,
|
||||
);
|
||||
}
|
||||
@@ -84,6 +84,24 @@ void main() {
|
||||
expect(find.text('touhou'), findsWidgets);
|
||||
expect(applied, 'touhou');
|
||||
});
|
||||
|
||||
testWidgets('many chips stay in a single compact row', (tester) async {
|
||||
await tester.pumpWidget(_Harness(
|
||||
child: SizedBox(
|
||||
width: 320,
|
||||
child: TagInputSearchBar(
|
||||
initialValue:
|
||||
'touhou video hakurei_reimu kirisame_marisa kochiya_sanae cirno',
|
||||
onSubmitted: (_) {},
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
final size = tester.getSize(find.byType(TagInputSearchBar));
|
||||
|
||||
expect(size.height, lessThan(96));
|
||||
expect(find.text('touhou'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
|
||||
class _Harness extends StatelessWidget {
|
||||
|
||||
Reference in New Issue
Block a user