37 lines
978 B
Dart
37 lines
978 B
Dart
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';
|
|
import 'package:ffi/ffi.dart';
|
|
import 'package:test/test.dart';
|
|
import "package:path/path.dart" show dirname, join;
|
|
|
|
final assets = join(HERE.path, "assets");
|
|
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);
|
|
});
|
|
});
|
|
}
|