feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,86 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:cutdex_native/cutdex_native.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('moving a cached layer updates native bounds', (tester) async {
|
||||
final offset = ValueNotifier(Offset.zero);
|
||||
addTearDown(offset.dispose);
|
||||
final reports = <Rect>[];
|
||||
final content = RepaintBoundary(
|
||||
child: NativeBoundsReporter(
|
||||
onBounds: reports.add,
|
||||
child: const SizedBox(width: 100, height: 40),
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: offset,
|
||||
child: content,
|
||||
builder: (_, position, child) =>
|
||||
Transform.translate(offset: position, child: child),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(reports.last, const Rect.fromLTWH(0, 0, 100, 40));
|
||||
offset.value = const Offset(50, 25);
|
||||
await tester.pump();
|
||||
expect(reports.last, const Rect.fromLTWH(50, 25, 100, 40));
|
||||
final count = reports.length;
|
||||
await tester.pump();
|
||||
expect(reports, hasLength(count));
|
||||
expect(tester.binding.hasScheduledFrame, isFalse);
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
await tester.pump();
|
||||
expect(reports, hasLength(count));
|
||||
});
|
||||
|
||||
for (final rotated in [false, true]) {
|
||||
testWidgets('native bounds include ${rotated ? 'rotation' : 'scaling'}', (
|
||||
tester,
|
||||
) async {
|
||||
Rect? bounds;
|
||||
final reporter = NativeBoundsReporter(
|
||||
onBounds: (rect) => bounds = rect,
|
||||
child: const SizedBox(width: 100, height: 40),
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 120, top: 100),
|
||||
child: rotated
|
||||
? Transform.rotate(
|
||||
angle: math.pi / 2,
|
||||
alignment: Alignment.topLeft,
|
||||
child: reporter,
|
||||
)
|
||||
: Transform.scale(
|
||||
scale: 2,
|
||||
alignment: Alignment.topLeft,
|
||||
child: reporter,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(bounds, isNotNull);
|
||||
final expected = rotated
|
||||
? const Rect.fromLTWH(80, 100, 40, 100)
|
||||
: const Rect.fromLTWH(120, 100, 200, 80);
|
||||
expect(bounds!.left, closeTo(expected.left, 1e-8));
|
||||
expect(bounds!.top, closeTo(expected.top, 1e-8));
|
||||
expect(bounds!.width, closeTo(expected.width, 1e-8));
|
||||
expect(bounds!.height, closeTo(expected.height, 1e-8));
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user