libdart_openmvg/tests/main_test.dart

37 lines
978 B
Dart
Raw Normal View History

2024-03-11 18:42:48 +01:00
import 'dart:ffi';
import 'dart:io';
import 'package:dart_openmvg/openmvg_c_shim.dart';
import 'package:dart_openmvg/dynloader.dart';
import 'package:dart_openmvg/util.dart';
2024-03-11 18:42:48 +01:00
import 'package:ffi/ffi.dart';
import 'package:test/test.dart';
import "package:path/path.dart" show dirname, join;
final assets = join(HERE.path, "assets");
2024-03-11 18:42:48 +01:00
final testFrames = join(assets, "test", "frames");
final firstFrame = join(testFrames, "0001.png");
void main() {
group('Unit Tests', () {
setUp(() {});
tearDown(() {
// Tear down code
});
test('newFrame', () {
final frameData = readUint8Ptr(File(firstFrame));
final frame = newFrame(frameData.ptr, frameData.length, 768, 768, 1204);
expect(frame.ref.h, 768);
expect(frame.ref.w, 768);
expect(frame.ref.h, 768);
final data = getImageData(frame);
expect(data.ref.error, 0);
// clean up the memory. ;-)
calloc.free(data);
calloc.free(frame);
2024-03-11 18:42:48 +01:00
});
});
}