FakeMediaTransform class final
A MediaTransform that records what it was asked to do and writes small real files, with no platform channel involved.
Slices 3, 4 and 5 of MOB-027 test against this (contract §11). It writes
real files rather than returning a File at a made-up path because the
picker builds a PickedAsset from the result and reads its length.
- Implemented types
Constructors
-
FakeMediaTransform({Directory? outputDirectory, List<
int> fileBytes = const <int>[0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A], List<int> ? frameBytes, VideoInfo videoInfo = const VideoInfo(duration: Duration(seconds: 10), codedWidth: 1920, codedHeight: 1080, rotationDegrees: 0, isHdr: false, hasAudio: true)}) - Creates a fake.
Properties
- exportedVideoInfo ↔ VideoInfo?
-
What probeVideo returns for a file this fake itself produced.
getter/setter pair
- failure ↔ TransformException?
-
When non-null, every method throws this instead of succeeding.
getter/setter pair
-
fileBytes
→ List<
int> -
The bytes written into every produced file.
final
-
frameBytes
→ List<
int> ? -
What extractFrames returns per frame. Null falls back to fileBytes;
a filmstrip test that has to decode its frames passes a real image.
final
-
frameExtractions
→ List<
FakeFrameExtraction> -
Every extractFrames call, in full.
final
-
frameRequests
→ List<
List< Duration> > -
Every extractFrames time list, in order.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
imageExports
→ List<
FakeImageExport> -
Every exportImage call, in order.
final
- latency ↔ Duration
-
Artificial latency, so a test can observe that exports do not overlap
(spec §7.5).
getter/setter pair
-
onExportVideo
↔ Future<
void> Function(void report(double))? -
Runs inside exportVideo, before it returns.
reportforwards straight to the caller'sonProgress. A test uses it to stall an export (proving the queue is sequential), to script progress, or to throw.getter/setter pair - outputDirectory → Directory
-
Where produced files are written.
final
-
probedPaths
→ List<
String> -
Every probeVideo path, in order.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scriptedProgress
↔ List<
double> ? -
Progress values exportVideo replays, in order, instead of the default
0then1.getter/setter pair -
videoExports
→ List<
FakeVideoExport> -
Every exportVideo call, in order.
final
- videoInfo → VideoInfo
-
What probeVideo returns.
final
Methods
-
dispose(
) → Future< void> - Deletes outputDirectory and everything in it.
-
exportImage(
String srcPath, CropRect crop, ImageEncodeSettings settings) → Future< File> -
Decodes
srcPathwithsettings' size cap applied at decode time, crops it tocrop, re-encodes it, and returns the written file.override -
exportVideo(
String srcPath, CropRect crop, DurationRange trim, VideoEncodeSettings settings, {void onProgress(double progress)?, TransformCancelToken? cancelToken}) → Future< File> -
Crops
srcPathtocrop, clips it totrim, transcodes it persettings, and returns the written file.override -
extractFrames(
String srcPath, List< Duration> times, ThumbSize size) → Future<List< Uint8List> > -
Extracts one frame per entry in
times, each scaled to fitsize.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
probeVideo(
String srcPath) → Future< VideoInfo> -
Reads duration, coded size, rotation, HDR and audio presence from
srcPathwithout decoding it.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited