mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Reduce flakiness of getProgress tests around percentage values.
There is no requirement for the first progress value to be 0, if progress is made instantly. PiperOrigin-RevId: 642245457
This commit is contained in:
parent
fd376bea07
commit
06e95ad2fb
1 changed files with 14 additions and 4 deletions
|
|
@ -1379,8 +1379,8 @@ public final class MediaItemExportTest {
|
||||||
progressStatesAndValues = runTransformerForProgressStateAndValueUpdates(transformer);
|
progressStatesAndValues = runTransformerForProgressStateAndValueUpdates(transformer);
|
||||||
ImmutableList<Integer> progressValues = progressStatesAndValues.second;
|
ImmutableList<Integer> progressValues = progressStatesAndValues.second;
|
||||||
|
|
||||||
assertThat(progressValues).isNotEmpty();
|
assertThat(progressValues.size()).isAtLeast(2);
|
||||||
assertThat(progressValues.get(0)).isEqualTo(0);
|
assertThat(progressValues.get(0)).isAtLeast(0);
|
||||||
assertThat(progressValues).isInStrictOrder();
|
assertThat(progressValues).isInStrictOrder();
|
||||||
assertThat(Iterables.getLast(progressValues)).isAtMost(100);
|
assertThat(Iterables.getLast(progressValues)).isAtMost(100);
|
||||||
}
|
}
|
||||||
|
|
@ -1444,8 +1444,8 @@ public final class MediaItemExportTest {
|
||||||
progressStatesAndValues = runTransformerForProgressStateAndValueUpdates(transformer);
|
progressStatesAndValues = runTransformerForProgressStateAndValueUpdates(transformer);
|
||||||
ImmutableList<Integer> progressValues = progressStatesAndValues.second;
|
ImmutableList<Integer> progressValues = progressStatesAndValues.second;
|
||||||
|
|
||||||
assertThat(progressValues).isNotEmpty();
|
assertThat(progressValues.size()).isAtLeast(2);
|
||||||
assertThat(progressValues.get(0)).isEqualTo(0);
|
assertThat(progressValues.get(0)).isAtLeast(0);
|
||||||
assertThat(progressValues).isInStrictOrder();
|
assertThat(progressValues).isInStrictOrder();
|
||||||
assertThat(Iterables.getLast(progressValues)).isAtMost(100);
|
assertThat(Iterables.getLast(progressValues)).isAtMost(100);
|
||||||
}
|
}
|
||||||
|
|
@ -1665,6 +1665,16 @@ public final class MediaItemExportTest {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Do once more when transformer has finished running.
|
||||||
|
@Transformer.ProgressState int progressState = transformer.getProgress(progressHolder);
|
||||||
|
if (progressStates.isEmpty() || progressState != progressStates.getLast()) {
|
||||||
|
progressStates.add(progressState);
|
||||||
|
}
|
||||||
|
if (progressState == PROGRESS_STATE_AVAILABLE
|
||||||
|
&& (progressValues.isEmpty() || progressHolder.progress != progressValues.getLast())) {
|
||||||
|
progressValues.add(progressHolder.progress);
|
||||||
|
}
|
||||||
|
|
||||||
return new Pair<>(ImmutableList.copyOf(progressStates), ImmutableList.copyOf(progressValues));
|
return new Pair<>(ImmutableList.copyOf(progressStates), ImmutableList.copyOf(progressValues));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue