앱 단위·화면·통합 테스트
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import 'package:fancake/features/eclipse/eclipse_data.dart';
|
||||
import 'package:fancake/features/galaxy/galaxy_data.dart';
|
||||
import 'package:fancake/features/planet/planet_data.dart';
|
||||
import 'package:fancake/features/galaxy/galaxy_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
/// 기기 위에서 재는 갤럭시 맵 프레임 타이밍.
|
||||
///
|
||||
/// 위젯 테스트는 실제로 래스터화하지 않으므로 「끊기는가」를 답하지 못한다.
|
||||
/// 이 테스트는 프로파일 빌드로 기기에 올라가 **실제 프레임 시간**을 남긴다.
|
||||
/// 별첨 1 ① 판정 기준 「기준 단말에서 행성/맵/애니메이션 체감 지연 없음」의 근거다.
|
||||
void main() {
|
||||
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
testWidgets('갤럭시 맵을 팬·줌하는 동안의 프레임 시간', (tester) async {
|
||||
await binding.watchPerformance(() async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: GalaxyScreen(
|
||||
repository: SampleGalaxyRepository(),
|
||||
planetRepository: samplePlanetRepository,
|
||||
eclipse: SampleEclipseRepository(),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
|
||||
final field = find.byType(GalaxyScreen);
|
||||
expect(field, findsOneWidget);
|
||||
|
||||
// 궤도가 도는 동안 드래그를 섞는다. 애니메이션과 제스처가 겹치는 구간이
|
||||
// 가장 무거우므로, 나눠 재면 실제로 끊기는 순간을 놓친다.
|
||||
for (var round = 0; round < 6; round++) {
|
||||
await tester.drag(field, const Offset(-120, -40));
|
||||
await tester.pump(const Duration(milliseconds: 16));
|
||||
await tester.drag(field, const Offset(120, 40));
|
||||
await tester.pump(const Duration(milliseconds: 16));
|
||||
for (var frame = 0; frame < 20; frame++) {
|
||||
await tester.pump(const Duration(milliseconds: 16));
|
||||
}
|
||||
}
|
||||
}, reportKey: 'galaxy_pan');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user