迁移 Flutter 端与训练脚本,模型/训练产物移出 git(遵循纯代码约定)
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:observer/detection/coordinate_mapper.dart';
|
||||
|
||||
void main() {
|
||||
test('rotation90_center_mapsToViewCenter', () {
|
||||
final rect = CoordinateMapper.mapToView(
|
||||
0.4, 0.4, 0.6, 0.6,
|
||||
90, 1280, 720, 1080, 1920,
|
||||
);
|
||||
expect(rect.centerX, closeTo(540, 1));
|
||||
expect(rect.centerY, closeTo(960, 1));
|
||||
});
|
||||
|
||||
test('rotation90_corner_appliesFitCenterOffset', () {
|
||||
final rect = CoordinateMapper.mapToView(
|
||||
0, 0, 0.5, 0.5,
|
||||
90, 1280, 720,
|
||||
1080, 2400,
|
||||
);
|
||||
expect(rect.left, closeTo(540, 1));
|
||||
expect(rect.top, closeTo(240, 1));
|
||||
expect(rect.right, closeTo(1080, 1));
|
||||
expect(rect.bottom, closeTo(1200, 1));
|
||||
});
|
||||
|
||||
test('rotation0_keepsCoordinates', () {
|
||||
final rect = CoordinateMapper.mapToView(
|
||||
0.2, 0.3, 0.5, 0.7,
|
||||
0, 1080, 1920,
|
||||
1080, 1920,
|
||||
);
|
||||
expect(rect.left, closeTo(216, 1));
|
||||
expect(rect.top, closeTo(576, 1));
|
||||
expect(rect.right, closeTo(540, 1));
|
||||
expect(rect.bottom, closeTo(1344, 1));
|
||||
});
|
||||
|
||||
test('rotation180_flipsBothAxes', () {
|
||||
final rect = CoordinateMapper.mapToView(
|
||||
0.2, 0.2, 0.4, 0.4,
|
||||
180, 1080, 1920,
|
||||
1080, 1920,
|
||||
);
|
||||
expect(rect.left, closeTo(648, 1));
|
||||
expect(rect.top, closeTo(1152, 1));
|
||||
expect(rect.right, closeTo(864, 1));
|
||||
expect(rect.bottom, closeTo(1536, 1));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user