Files
cutdex/integration_test/README.md
T
lingjhf aa5255d1e4
Gitea CI / Build Windows x64 app (push) Successful in 2m38s
Gitea CI / Check code and tests (push) Successful in 5m19s
Gitea CI / Build Android APK (push) Successful in 3m13s
Gitea CI / Audit and package Windows x64 (push) Successful in 2m49s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 59s
Gitea CI / Gitea CI passed (push) Successful in 2s
fix(preview): 接入已合并 SDK 与 Android 0.1.3 预览验证 (#12)
2026-10-07 18:30:29 +00:00

531 lines
31 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Application integration tests
`integration_test/` contains opt-in tests for the real application and native
backends. `test_driver/integration_test.dart` is the host driver used by
`fvm dart tool/flutter_local.dart drive` for Profile measurements. Both directories contain test source;
media, models, reports and credentials are supplied locally and stay outside
version control. Normal release builds use `lib/main.dart`.
## Android navigation and playhead measurements
`android_decoder_material_performance_test.dart` extends the production workspace
benchmark to other source rates and variable timestamps. Supply
`CUTDEX_TEST_SOURCE_PTS` as an independent, sorted list of original frame PTS
(one integer source tick per line), with `CUTDEX_TEST_SOURCE_TIMESCALE` set to
that clock's denominator, such as 90000. The default timescale is 1000000 for
existing integer-microsecond fixtures; preserve original source ticks for frame
boundaries that cannot be represented in microseconds. `CUTDEX_TEST_FRAME_STEP_US`
is the nominal frame period rounded to microseconds. Its eight `matchedSeeks` use
the standalone benchmark's exact request sequence. Full-source ruler drags and
20-frame local drags use the production timeline and are reported separately;
their inputs differ from the standalone source replay.
`CUTDEX_TEST_CALIBRATE=true` explicitly runs native/software calibration before
opening the workspace and verifies both sets against the external PTS list.
It asserts the admitted backend throughout later navigation and gestures.
The application opens no calibration workload automatically.
If the device's installed application has a different signing certificate,
build the development flavor with
`CUTDEX_VALIDATION_APPLICATION_ID=com.example.cutdex.decoder_validation`.
This creates `com.example.cutdex.decoder_validation.dev`, labeled
`Cutdex Decoder Test`, while preserving the installed application and its data.
For a cache baseline, set `CUTDEX_PREVIEW_REVERSE_CACHE_MIB=24`;
set it to `0` for normal device policy. These properties affect development only.
Use matching private file paths and retain the app between runs.
`android_navigation_performance_test.dart` mounts the production `EditorWorkspace`
with real `Projects`, preview and native playback providers. Its project and
application database are isolated. Supply a complete original video through
`CUTDEX_TEST_SOURCE` and an app-writable JSON path through `CUTDEX_TEST_REPORT`.
The test keeps production audible-skimming policy and uses touch input on real
timeline tabs and the timeline ruler. It measures cold/cached selection, rapid
selection replacement, exact seeks, full-source fit-to-viewport and local
20-frame drags, and both immediate release and a one-second stationary hold.
The source-frame containment checks currently require an untrimmed CFR
2997/100 fps source.
Use `--dart-define=CUTDEX_TEST_DECODER=ffmpeg` to assert the actual decoder
from initial load through seeks, both drag directions and final release.
Reports retain per-layer backend and selection-reason diagnostics.
```powershell
fvm dart tool/flutter_local.dart drive --profile --flavor development -d DEVICE_ID --keep-app-running `
--driver=test_driver/integration_test.dart `
--target=integration_test/android_navigation_performance_test.dart `
--dart-define=CUTDEX_TEST_SOURCE=/data/user/0/com.example.cutdex.dev/files/cutdex-validation/source.mp4 `
--dart-define=CUTDEX_TEST_REPORT=/data/user/0/com.example.cutdex.dev/files/cutdex-validation/results.json
```
The pinned SDK uses the published Android 0.1.3 Maven artifacts. Use explicit SDK
and Android source overrides only when comparing unpublished changes. Calibration
requires a `--debug` build; profile/production hosts do not register its channel.
UI timing ends at the
target workspace's post-frame callback. Native diagnostics record queued output
frames/content timestamps and backend seek/reuse counters; those do not measure
physical display refresh. The planned drag input rate is 60 Hz; retain actual
input timestamps and report achieved input cadence. The test uses `fullyLive`
frame scheduling and does not pump a Flutter frame for every pointer input.
Native polling has at most
one outstanding request, so decoder latency cannot accumulate diagnostic reads.
Source PTS is distinct from the requested timeline sample. A stationary release
must preserve source PTS, output-frame count and seek count; the final source
frame must cover the target tick. These counters measure queued native output,
not physical scanout. A cached timeline's nonzero frame counter alone does not
prove that its new Surface has displayed the retained frame.
Rebuild/install the normal `lib/main.dart` entry point after testing. Do not clear
app data or uninstall merely to obtain a cold sample.
Always pass `--keep-app-running`: Flutter drive otherwise uninstalls the Android
application during cleanup, which also deletes its application data.
On devices that deny access to ADB-created external app directories, copy the
fixture into the installed debuggable development app's internal files using
`run-as`, and export its report with `adb exec-out run-as PACKAGE cat PATH`.
## Desktop plugin registration
`native_desktop_plugins_test.dart` checks the real application's registration of
window chrome, dynamically configured file destinations, and the macOS fullscreen
channel. It requires no media or models and does not simulate Finder/Explorer drops.
```sh
fvm dart tool/flutter_local.dart test integration_test/native_desktop_plugins_test.dart -d macos --flavor development
```
Use `-d windows` on Windows. Rebuild the normal application entry point afterwards.
## Desktop processing
`processing_e2e_test.dart` checks Cutdex's connection to real desktop processing:
app resource configuration, applying results to the timeline, and cancellation or
closing the owning session.
Provide an external processing package, installed models in the app's resource
directory, and a short speech fixture. A local Dart-define JSON specifies
`CUTDEX_PROCESSING_ROOT` and `CUTDEX_ASR_FIXTURE`:
```sh
fvm dart tool/flutter_local.dart test integration_test/processing_e2e_test.dart -d macos --flavor development \
--dart-define-from-file=/absolute/path/to/processing-e2e.json
```
Use `-d windows` on Windows. The test skips without a configured source. It does not
download models. Check that completed results appear in the timeline and that
cancelled tasks do not apply results to a closed session.
## Editing diagnostics and logging measurements
`edit_diagnostics_test.dart` mounts the production timeline toolbar, speed slider
and native preview. Supply a video with audio of at least 25 seconds; generated
H.264/AAC test media is suitable. The test creates isolated projects, an in-memory
application database, per-run diagnostic storage, exports and `results.json` under
the output directory. It never opens a user project or changes the source media.
Four controlled failures are injected at the authoritative commit boundary:
split, left/right trim and speed adjustment. Each failure must export the original
stack, operation ID, clip/timeline/project IDs and unchanged before/after versions.
Recovery then repeats the same UI path without the injected failure. These are
fault-injection checks with real media and native playback, not evidence that the
native backend itself produced these failures.
```sh
fvm dart tool/flutter_local.dart drive --profile -d macos --flavor production \
--driver=test_driver/integration_test.dart \
--target=integration_test/edit_diagnostics_test.dart \
--dart-define=CUTDEX_TEST_SOURCE=/absolute/path/to/generated-720p30.mp4 \
--dart-define=CUTDEX_TEST_REPORT=/absolute/path/to/output/profile
```
After a native-decoder warmup, six measured runs alternate the same-build
application diagnostic recording off/on (three pairs, alternating pair order). Each run uses
the toolbar to split and trim with undo, drags the speed slider, plays the edited
clip, and restores 1×. Reports include Flutter build/raster frame percentiles,
frames over 16.67 ms, synchronous diagnostic-call costs and durable log
appends/bytes. Bounded 16 ms pumps collect rendering samples during playback.
Flutter frame timings do not measure the independently rendered native video or
physical display refresh. No latency/FPS guarantee follows from this small sample.
macOS 14.4+ can separately measure the mounted sample-buffer renderer's delivered
and dropped frames in an opt-in **Debug** run. Keep its window visible and
unoccluded throughout the observation; the test checks both conditions. This
native diagnostics channel is compiled only in Debug, so its frame statistics
must not be presented as Profile measurements.
```sh
CUTDEX_PREVIEW_CADENCE_DIAGNOSTICS=1 fvm dart tool/flutter_local.dart drive --debug -d macos --flavor development \
--driver=test_driver/integration_test.dart \
--target=integration_test/edit_diagnostics_test.dart \
--dart-define=CUTDEX_DIAGNOSTIC_CADENCE=true \
--dart-define=CUTDEX_TEST_SOURCE=/absolute/path/to/generated-720p30.mp4 \
--dart-define=CUTDEX_TEST_REPORT=/absolute/path/to/output/native-debug
```
Retain failed reports and their logs. Rebuild `lib/main.dart` for each tested
flavor afterwards, since integration entry points are not distribution builds.
## Windows
Run against the original files in a separate output directory. The Windows
test mounts the real editor panels, imports through the production workspace,
and exercises the play/pause and split controls and speed slider. It also checks
independent scale/rotation/position transforms, multi-channel keyframe interpolation,
mask animation and stack ordering, audio edits, exported pixels and PCM, and exact
saved project data after close/reopen. Segmented speed changes also check the
source clock, source duration and undo. No playback backend is mocked. ISO import is accepted only
when the native backend can probe an unprotected video stream.
```powershell
fvm dart tool/flutter_local.dart test integration_test/windows_real_media_test.dart -d windows `
--dart-define=CUTDEX_VALIDATION_SOURCE='D:\validation\media-originals' `
--dart-define=CUTDEX_VALIDATION_ROOT='D:\validation\windows-editing'
```
`CUTDEX_VALIDATION_FILTER` optionally selects filenames containing any of the
comma-separated substrings.
`CUTDEX_VALIDATION_PREVIEW_SECONDS` sets each full-source playback observation
(default 2); use 30 for a longer frame-delivery audit. Reports include dropped
native frames, delivered frames per second and the maximum frame gap. These
measure native preview delivery, not physical monitor refresh or speaker sound.
`CUTDEX_VALIDATION_SOURCE_ROOTS` accepts semicolon-separated source directories
when validating multiple collections. For Flutter performance measurements use
`fvm dart tool/flutter_local.dart drive --profile -d windows --flavor production
--driver=test_driver/integration_test.dart
--target=integration_test/windows_real_media_test.dart` with the same Dart
defines: `fvm dart tool/flutter_local.dart test` forces Debug mode. Playback observations additionally
record process/time boundaries and Flutter build/raster timings for correlation
with actual Windows audio-session peaks. Native textures can redraw without Dart
frames, so the observation uses live frames and a continuous 16 ms viewport
refresh to collect build/raster timings. Rendering timings measure framework
work, rather than proving the physical display refreshed every source frame.
The test scans subdirectories, creates one timeline per source, records each
stage in `results.json`, and checks that source size and modification time stay
unchanged. Full-duration preview checks sample 60 seconds, quarter, middle and end;
editing checks use short clips. Exports use the selected video and audio tracks.
Frame counters verify native frame delivery,
without measuring physical display latency or judging speaker output. Keep the
output outside the media directory and rebuild the normal `lib/main.dart`
application after running an integration target.
The harness opens another project at the editor's 50-timeline limit. For a
source with independently confirmed undecodable audio, a filtered diagnostic
can set `CUTDEX_VALIDATION_FULL_PREVIEW_AUDIO=false` to check full-source video
preview separately. The short editing clip still includes audio. Record the
failed audio interval alongside this diagnostic; do not report it as successful
full-source audio playback.
`CUTDEX_VALIDATION_FULL_PREVIEW_MUTE=true` keeps the full-source audio layer
but sets its gain to zero and verifies the native
muted-audio path. Short-clip audio edits still run normally. Constant mute must
avoid decoding unreadable audio; keyed volume curves remain eligible to play.
`CUTDEX_VALIDATION_MUTE_DAMAGED_ASF=true` restricts that full-source mute diagnostic
to ASF files in this corpus. Use it only alongside independent evidence of source
audio damage. The report identifies every muted source; all selected editing
clips still include audio. An accepted play command alone is insufficient:
checks wait for clock/frame progress and inspect delayed playback errors.
`CUTDEX_VALIDATION_LONG_SPEED_ONLY=true` imports a full-length clip (the common
audio/video duration minus 100 ms), applies exact 2×, 0.5× and 1× edits, and observes
playback from the start and across the 30.72-second preview-window boundary. It
checks unchanged source timing, timeline duration and exact project data after
close/reopen. This diagnostic skips the short-clip transform/mask/export matrix;
run the normal matrix separately. It samples full-length edited clips and does
not play or export every frame of the original movies.
## Windows seek measurements
`windows_seek_latency_test.dart` measures real Profile preview requests and continuous
playhead dragging with any playable video at least five seconds long. It probes the
source duration and scales the seek points and drag spans to that duration. Provide
`CUTDEX_SEEK_SOURCE` and `CUTDEX_SEEK_REPORT`; run it with the shared
`test_driver/integration_test.dart` entry point using `fvm dart tool/flutter_local.dart drive --profile`.
```powershell
fvm dart tool/flutter_local.dart drive --profile --flavor production -d windows `
--driver=test_driver/integration_test.dart `
--target=integration_test/windows_seek_latency_test.dart `
--dart-define=CUTDEX_SEEK_SOURCE='D:/validation/media-originals/video.mp4' `
--dart-define=CUTDEX_SEEK_REPORT='D:/validation/results/editor-seek.json'
```
The report records request acknowledgment, pump timing, observed native positions
and the final release position. It does not measure physical display latency or
independently verify pixels/audio. For before/after comparisons, preserve both
complete builds, use identical media and run serially without concurrent builds
or exports. This test target is for measurement, not application distribution.
## Windows audio samples
`windows_audio_media_test.dart` validates original audio files with the production
source preview, import service, editor widgets and Windows runtime. It creates
isolated projects and settings, checks source SHA-256 after each file, and writes
an incremental `results.json` report. The source should contain audio-only files
longer than ten seconds, with audible content in the 2–6 second edit interval.
```powershell
fvm dart tool/flutter_local.dart test integration_test/windows_audio_media_test.dart -d windows `
--dart-define=CUTDEX_VALIDATION_SOURCE=D:/validation/audio-originals `
--dart-define=CUTDEX_VALIDATION_ROOT=D:/validation/audio-results
```
Each file exercises full-source waveform decoding, preview seeks near the start,
middle and end, playback/pause, import, editor scrubbing, split/undo/redo, speed
slider, gain/mute, audio gain keyframes and saved keyframe records. Six native
H.264/AAC exports check baseline duration, 2×/0.5× duration, -6 dB RMS ratio,
silence and the keyframe fade envelope. The visual output is a black canvas for
audio-only timelines. Masks and position keyframes use the video validation test.
`CUTDEX_VALIDATION_FILTER` selects comma-separated filename substrings.
`CUTDEX_VALIDATION_METADATA_ONLY=true` runs just the probe and full waveform
checks for faster diagnosis. Speaker sound is not measured by these assertions.
Keep downloaded external samples outside the repository and retain their source
URLs, hashes and license attribution. Rebuild `lib/main.dart` for distribution
after integration testing.
## Android physical device
`android_real_media_test.dart` owns the editing workflow. Helpers in `support/`
handle incremental reports (`real_media_report.dart`), full-length preview
measurements (`android_preview_measurement.dart`) and edited-export pixel/audio
checks (`real_media_export_checks.dart`).
The suite first checks the application's real device-information and version
channels, then runs the media workflow. Its editor harness stacks the preview and
properties on narrow phone displays. It uses an isolated in-memory settings
database and creates a separate project.
Use the debug development app's private directory to avoid scoped-storage and
device-specific restrictions on directories created by `adb push`. Install the
normal APK before copying fixtures; `-d` permits a debug version-code downgrade
after installing an ABI split, without deleting the app's data. Keep complete
originals on the host. On a POSIX shell:
```sh
fvm dart tool/flutter_local.dart build apk --debug --flavor development
adb -s DEVICE_SERIAL install -r -d build/app/outputs/flutter-apk/app-development-debug.apk
adb -s DEVICE_SERIAL shell run-as com.example.cutdex.dev mkdir -p files/real-media files/real-validation
adb -s DEVICE_SERIAL shell -T run-as com.example.cutdex.dev tee files/real-media/source.mp4 \
< /absolute/path/to/source.mp4 > /dev/null
fvm dart tool/flutter_local.dart test integration_test/android_real_media_test.dart -d DEVICE_SERIAL \
--flavor development --no-uninstall \
--dart-define=CUTDEX_VALIDATION_SOURCE=/data/user/0/com.example.cutdex.dev/files/real-media \
--dart-define=CUTDEX_VALIDATION_ROOT=/data/user/0/com.example.cutdex.dev/files/real-validation
```
Keep `--no-uninstall`: uninstalling also removes copied fixtures and validation
reports. With `fvm dart tool/flutter_local.dart drive`, use `--debug --keep-app-running` to retain them.
An optional
`CUTDEX_VALIDATION_FILTER` selects filenames containing any comma-separated
substring. `CUTDEX_VALIDATION_SAMPLE_START` selects the edit sample start in
seconds (default 60); use a visibly nonblack scene for pixel comparisons.
`CUTDEX_VALIDATION_PREVIEW_WIDTH` / `CUTDEX_VALIDATION_PREVIEW_HEIGHT` set the
native preview render size and project canvas (defaults 640 / 360). Set 1920 /
1080 for a full-HD preview run. `CUTDEX_VALIDATION_OBSERVATION_SECONDS` sets each
full-source playback window (default 2); use 30 for a longer observation. The
tail window leaves enough media for the configured observation. Reports include
seek latency, surface presentations per second and timeline progress. Maximum
frame gap is cumulative over the session. These counters do not measure unique
decoded pictures, physical display refresh or speaker synchronization. Exports
remain short 320×180 functional checks regardless of preview size.
`CUTDEX_VALIDATION_PREVIEW_ONLY=true` runs probing and the three full-source
preview windows, then checks the source file and closes the controller. This
diagnostic skips editing and exports; its report must not be counted as an
editing validation run. `CUTDEX_VALIDATION_CONCURRENT_IO` records whether fixture
transfer is running alongside playback so that such runs can be excluded from
controlled performance comparisons.
Incomplete `.xltd` downloads and torrent descriptors are excluded.
The test verifies full-duration preview seeks at the start, middle and end,
then imports each original, selects eight seconds and exercises playback,
scrubbing, splitting, undo/redo and the 2×/0.5×/normal speed slider. It uses the
editor command service for audio gain/mute, transform keyframes and rectangular,
elliptical, feathered and inverted masks. Native exports verify duration, masked
pixels and the RMS ratio for -6 dB audio; additional audio streams are exported
and decoded separately. Each completed stage updates `results.json`.
An additional export keeps transform keyframes without masks so that native
composition is checked independently of masked rendering. Compare its one-second
frame with the baseline shifted by the authored position, as well as its gain.
Preview controllers are closed between sources to bound memory.
Full-source playback allows up to ten seconds for frame progress and records
observation time and slow playback separately. Short clips that reach their
natural end during polling are accepted only with both clock and frame progress.
Frame counters measure delivery to the native surface writer. The short samples
do not constitute watching the entire movie, measuring physical display latency,
or independently judging audible sound through the tablet speakers.
Restore the normal development APK with target `lib/main.dart` after testing,
using `adb install -r` to preserve fixtures and reports.
## macOS
Run the real macOS editor and native playback backend against a local media
directory. This opt-in test creates a separate project and one timeline per
video source, references originals without copying them, and writes an incremental
JSON report into the output directory. It does not restore or edit an existing
project. The test uses an in-memory recent-project registry and does not write
to the normal application database. Without the required Dart defines, it skips.
```sh
fvm dart tool/flutter_local.dart test integration_test/downloads_workflow_test.dart -d macos \
--flavor development \
--dart-define=CUTDEX_VALIDATION_SOURCE=/absolute/path/to/media \
--dart-define=CUTDEX_VALIDATION_ROOT=/absolute/path/to/output
```
`CUTDEX_VALIDATION_FILTER` optionally selects filenames containing a substring
for diagnosis. Omit it for the complete directory run. Set
`--dart-define=CUTDEX_VALIDATION_DIRECT_DROP=true` to exercise external
file-drop messages directly on the timeline, including import into the media
library, instead of importing first and dragging a library tile.
The test sends the same native file-drop messages as Finder to the actual
media panel, then uses pointer gestures to drag each tile into the timeline.
It exercises the play/pause controls, split toolbar, 2× and 0.5× speed slider,
and detach audio context menu, checks native playback after edits, and verifies
saved timeline structure. File-drop messages are injected; this test does not
drive Finder itself. Only the AppKit menu bridge is disabled inside the test,
to exercise the application's existing Flutter context-menu fallback. No
playback or import backend is mocked. Verify AppKit menu selection separately
in the normally launched application.
Playback checks are short samples around edits. They verify the transport clock
and errors, but do not measure sustained frame cadence or physical display
latency. Use `downloads_preview_cadence_test.dart` for mounted renderer frame cadence
and pause delivery checks. It requires macOS 14.4+, the host environment variable
`CUTDEX_PREVIEW_CADENCE_DIAGNOSTICS=1`, the same source/output Dart defines, and
a visible window activated through macOS accessibility.
## iPhone native media validation
`ios_device_test.dart` runs seven shared regressions in one installation: real-media
playback with audio, nested/reverse/freeze/transition composition, image/canvas
composition, grouped keyframes and export, painted thumbnails, repeated canvas
drags, and the full application playback/editing lifecycle. The application test
uses the phone's Cut navigation destination when present. Desktop packaged-worker
capability fixtures, Finder drops, and macOS display-cadence diagnostics are outside
this iPhone suite; it does not validate model inference or physical display latency.
Use an unlocked developer-enabled iPhone and a valid signing team. Select the iOS
`Runner` scheme explicitly because the default `development` flavor belongs to the
other platforms. First install the test host using the shared empty-timeline test:
```sh
fvm dart tool/flutter_local.dart test integration_test/preview_startup_test.dart -d <iphone-udid> \
--flavor Runner --no-uninstall \
--plain-name 'opening a timeline initializes native preview through App providers'
```
Copy a synthetic or nonpersonal H.264 Rec.709 + AAC fixture at least 30 seconds long
into the installed app's sandbox. Keeping the app installed preserves this fixture
through subsequent test builds:
```sh
xcrun devicectl device copy to --device <iphone-udid> \
--source /absolute/path/to/source.mp4 \
--destination Documents/cutdex-validation-source.mp4 \
--domain-type appDataContainer --domain-identifier com.example.cutdex
fvm dart tool/flutter_local.dart test integration_test/ios_device_test.dart -d <iphone-udid> \
--flavor Runner --no-uninstall --reporter expanded \
--dart-define=CUTDEX_TEST_SOURCE_DOCUMENT=cutdex-validation-source.mp4 \
--dart-define=CUTDEX_TEST_OUTPUT=ios-keyframes
```
The shared fixture helper also preserves `CUTDEX_TEST_SOURCE` for host paths and
`CUTDEX_TEST_SOURCE_BASE64` for small embedded fixtures. Large Base64 defines can
exceed Xcode's command/environment size limit; use the sandbox copy for full videos.
Temporary embedded fixtures are deleted after the owning test. The explicitly
copied sandbox fixture and optional keyframe artifacts remain available for inspection.
`KEYFRAME_ARTIFACTS`, `THUMBNAIL_TIMING`, `DRAG_TIMING`, and `ACCEPTANCE` lines record
artifact locations and completed phases in the test log.
The app and native dependency require iOS 17. If a stale generated
`ios/Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage/Package.swift`
still declares iOS 15, align its generated platform declaration to iOS 17 before
retrying. This derived file is ignored; preserve the project's iOS 17 deployment
settings rather than lowering the native package's supported platform.
## Arbitrary media timebases on macOS
`media_timebase_drop_test.dart` uses the native probe and the same drop target as
Finder and project assets. It checks provisional placement, committing, exact
saved timeline ticks, playback and long-distance seeks, a three-second native
video/audio export, and undo after trimming. The source must have at least three
seconds of usable video. Supply a file outside the repository with
`CUTDEX_TEST_SOURCE`; `CUTDEX_TEST_OUTPUT` optionally preserves the export.
```sh
fvm dart tool/flutter_local.dart test integration_test/media_timebase_drop_test.dart -d macos \
--flavor production \
--dart-define=CUTDEX_TEST_SOURCE=/absolute/path/to/source.mp4 \
--dart-define=CUTDEX_TEST_OUTPUT=/absolute/path/to/export.mp4
```
The production scheme uses a separate build product from the default development
scheme, so a running development App does not need to be replaced for this test.
## Android system document import
`android_document_import_test.dart` opens the real system picker. Use a generated
H.264/AAC MP4 fixture in Downloads and select only that fixture. The test checks
streamed import into managed project storage, duplicate selection, byte identity,
native probing, thumbnails, playback, seeking and a video/audio export.
```sh
fvm dart tool/flutter_local.dart drive --debug --keep-app-running \
--driver=test_driver/integration_test.dart \
--target=integration_test/android_document_import_test.dart \
-d DEVICE_SERIAL --flavor development \
--dart-define=CUTDEX_DOCUMENT_SELECT=true \
--dart-define=CUTDEX_DOCUMENT_ROOT=/data/user/0/com.example.cutdex.dev/files/document-validation \
--dart-define=CUTDEX_DOCUMENT_SHA256=FIXTURE_SHA256
```
After `import.json` reports `complete: true`, remove the generated original from
Downloads. Re-run the same command without `CUTDEX_DOCUMENT_SELECT=true` to start
a new app process and verify the managed original independently of provider
access. `reopen.json` records the repeated hash, playback and export checks. Keep
app data between runs; `--keep-app-running` prevents the driver from uninstalling
the app. Use `adb shell run-as com.example.cutdex.dev` to retrieve reports and
remove the test's own project and exports afterward.
Some devices disconnect the host driver while DocumentsUI is foreground. In
that case, inspect the original application's log and private JSON reports; a
driver disconnection alone does not establish whether the import succeeded.
## Android native Surface preview comparison
The development build can enable the experimental native source with the Gradle
property `cutdexNativeSurfacePreview=true` or environment variable
`CUTDEX_NATIVE_SURFACE_PREVIEW=true`. Production and default development builds
leave it disabled. `android_decoder_material_performance_test.dart` uses the real
EditorWorkspace with the whole original clip fitted into the timeline viewport.
Set `CUTDEX_TEST_DECODER=media3-surface` to fail if the source falls back; use
`ffmpeg` for the paired baseline. `CUTDEX_TEST_PLAYBACK=true` additionally records
three seconds of unique frame changes, play/pause acknowledgments and a frozen
paused frame. The existing seek/drag assertions independently check every observed
frame against original rational packet PTS and require zero extra release seek
or presentation for an already precise held picture.
Use a separate validation application ID to preserve the installed development
application and its projects. Supply media and PTS files inside that validation
app's sandbox; no personal fixture or benchmark report is committed here.
For example, an explicitly admitted 60 fps / 90000 Hz source can be measured with:
```powershell
$env:CUTDEX_VALIDATION_APPLICATION_ID = 'com.example.cutdex.decoder_validation'
$env:CUTDEX_NATIVE_SURFACE_PREVIEW = 'true'
fvm dart tool/flutter_local.dart drive --profile --flavor development -d DEVICE_ID --keep-app-running `
--driver=test_driver/integration_test.dart `
--target=integration_test/android_decoder_material_performance_test.dart `
--dart-define=CUTDEX_TEST_SOURCE=/data/user/0/com.example.cutdex.decoder_validation.dev/files/source.mp4 `
--dart-define=CUTDEX_TEST_SOURCE_PTS=/data/user/0/com.example.cutdex.decoder_validation.dev/files/source-pts.txt `
--dart-define=CUTDEX_TEST_SOURCE_TIMESCALE=90000 --dart-define=CUTDEX_TEST_FRAME_STEP_US=16667 `
--dart-define=CUTDEX_TEST_DECODER=media3-surface --dart-define=CUTDEX_TEST_PLAYBACK=true `
--dart-define=CUTDEX_TEST_REPORT=/data/user/0/com.example.cutdex.decoder_validation.dev/files/native-results.json
```
Repeat with `CUTDEX_NATIVE_SURFACE_PREVIEW=false`, `CUTDEX_TEST_DECODER=ffmpeg`
and another report path for the software baseline. Restore the default environment
and normal application entry point after testing. Record first-source indexing
separately from warm seek timings. Only compare inputs with matching source clocks,
targets, drag trajectories, audio/UI workloads and achieved input cadence.