feat: horizontal flip with R key, baked into crop save (v1.6.0)
- R mirrors the view about the viewport centre and clears the active effects (same reset as double right click); pressing R again restores the original orientation. Pan/zoom are kept. - Image switch, fill/fit toggle and right double click also clear the flip. - Crop save (Ctrl+S) mirrors the output too, so the saved JPEG matches the on-screen view (verified in combination with rotation). - Shortcut lists (tr/en), README and CHANGELOG updated; deb rebuilt as 1.6.0.
This commit is contained in:
1 parent
24cab6f908
commit
bad48167c8
14 files changed
+130
-10
No files matched your search
@@ -0,0 +1,51 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:image/image.dart' as img;
|
||||
import 'package:imajviewer/widgets/image_canvas.dart';
|
||||
|
||||
/// Aynalama uygulandiginda render zincirinde negatif x olcekli bir Transform bulunur.
|
||||
bool _mirrored(WidgetTester tester) => tester
|
||||
.widgetList<Transform>(find.byType(Transform))
|
||||
.any((t) => t.transform.entry(0, 0) < 0);
|
||||
|
||||
Future<void> _pressR(WidgetTester tester) async {
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.keyR);
|
||||
await tester.sendKeyUpEvent(LogicalKeyboardKey.keyR);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
void main() {
|
||||
late Directory tmp;
|
||||
late String pngPath;
|
||||
|
||||
setUpAll(() {
|
||||
tmp = Directory.systemTemp.createTempSync('flip_test');
|
||||
pngPath = '${tmp.path}/a.png';
|
||||
File(pngPath).writeAsBytesSync(img.encodePng(img.Image(width: 4, height: 2))!);
|
||||
});
|
||||
|
||||
tearDownAll(() => tmp.deleteSync(recursive: true));
|
||||
|
||||
testWidgets('R yatay aynalamayi acar, tekrar basinca kapatir', (tester) async {
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: SizedBox(
|
||||
width: 400,
|
||||
height: 300,
|
||||
child: ImageCanvas(filePath: pngPath),
|
||||
),
|
||||
));
|
||||
await tester.pump();
|
||||
|
||||
expect(_mirrored(tester), isFalse, reason: 'baslangicta aynalama olmamali');
|
||||
|
||||
await _pressR(tester);
|
||||
expect(_mirrored(tester), isTrue, reason: 'R sonrasi aynalama acik olmali');
|
||||
|
||||
await _pressR(tester);
|
||||
expect(_mirrored(tester), isFalse, reason: 'ikinci R sonrasi eski haline donmeli');
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user