feat: 实现起卦、设置与积分系统
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meeyao_qianwen/features/divination/data/models/divination_params.dart';
|
||||
import 'package:meeyao_qianwen/shared/widgets/divination/yao_glyph.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('youngYang renders one solid segment', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(body: YaoGlyph(type: YaoType.youngYang)),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byKey(const Key('yao_glyph_solid')), findsOneWidget);
|
||||
expect(find.byKey(const Key('yao_glyph_split_left')), findsNothing);
|
||||
expect(find.byKey(const Key('yao_glyph_split_right')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('youngYin renders two split segments', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(body: YaoGlyph(type: YaoType.youngYin)),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byKey(const Key('yao_glyph_solid')), findsNothing);
|
||||
expect(find.byKey(const Key('yao_glyph_split_left')), findsOneWidget);
|
||||
expect(find.byKey(const Key('yao_glyph_split_right')), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meeyao_qianwen/shared/widgets/divination/yao_legend.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('legend shows yang yin and changing symbols', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(home: Scaffold(body: YaoLegend())),
|
||||
);
|
||||
|
||||
expect(find.text('— 阳'), findsOneWidget);
|
||||
expect(find.text('-- 阴'), findsOneWidget);
|
||||
expect(find.text('○ 老阳(变)'), findsOneWidget);
|
||||
expect(find.text('× 老阴(变)'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meeyao_qianwen/features/divination/data/models/divination_params.dart';
|
||||
import 'package:meeyao_qianwen/shared/widgets/divination/yao_line_row.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('oldYang shows circle mark when enabled', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: YaoLineRow(
|
||||
name: '初爻',
|
||||
type: YaoType.oldYang,
|
||||
showChangeMark: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('初爻'), findsOneWidget);
|
||||
expect(find.text('○'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('oldYin does not show mark when showChangeMark=false', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Scaffold(
|
||||
body: YaoLineRow(
|
||||
name: '二爻',
|
||||
type: YaoType.oldYin,
|
||||
showChangeMark: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('×'), findsNothing);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user