first commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:sign_checker/domain/letterbox.dart';
|
||||
import 'package:sign_checker/domain/rotation.dart';
|
||||
|
||||
void main() {
|
||||
test('letterbox centers a wide frame in the square', () {
|
||||
final box = Letterbox.fit(srcWidth: 200, srcHeight: 100, inputSize: 100);
|
||||
expect(box.scale, 0.5);
|
||||
expect(box.padX, 0);
|
||||
expect(box.padY, 25);
|
||||
final source = box.uprightFromModel(50, 25);
|
||||
expect(source.$1, 100);
|
||||
expect(source.$2, 0);
|
||||
});
|
||||
|
||||
test('portrait compensation rotates the back-camera buffer', () {
|
||||
expect(
|
||||
uprightClockwiseDegrees(
|
||||
sensorOrientation: 90,
|
||||
deviceDegrees: 0,
|
||||
frontCamera: false,
|
||||
),
|
||||
90,
|
||||
);
|
||||
final raw = rawPixelFromUpright(
|
||||
ux: 1,
|
||||
uy: 0,
|
||||
rawWidth: 4,
|
||||
rawHeight: 2,
|
||||
clockwiseDegrees: 90,
|
||||
);
|
||||
expect(raw, (0, 0));
|
||||
expect(uprightSize(rawWidth: 4, rawHeight: 2, clockwiseDegrees: 90), (
|
||||
2,
|
||||
4,
|
||||
));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user