mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-28 23:10:32 +00:00
Crossfade between palettes instead of flashing empty
Switching source kept nothing on screen until the new one drew. The old frame now stays until the first new frame lands, then fades out over it in 150 ms. Model used: Claude Opus 5.5
This commit is contained in:
1 parent
806a33976a
commit
547c52540a
3 files changed
+183
No files matched your search
@@ -0,0 +1,62 @@
|
||||
package art.arcane.iris.studio.map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public final class FrameCrossfadeTest {
|
||||
private final FrameCrossfade crossfade = new FrameCrossfade(() -> {
|
||||
});
|
||||
|
||||
@Test
|
||||
public void heldFrameStaysFullyVisibleUntilTheNextFrameArrives() {
|
||||
NoiseRenderCoordinator.Result frame = frame();
|
||||
|
||||
crossfade.hold(frame);
|
||||
|
||||
assertSame(frame, crossfade.outgoing());
|
||||
assertEquals(1F, crossfade.outgoingOpacity(), 0F);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void heldFrameFadesOnceTheNextFrameArrives() throws InterruptedException {
|
||||
crossfade.hold(frame());
|
||||
crossfade.reveal();
|
||||
Thread.sleep(20L);
|
||||
|
||||
assertTrue(crossfade.outgoingOpacity() < 1F);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void switchingAgainBeforeAnythingDrewKeepsTheFrameHeld() {
|
||||
NoiseRenderCoordinator.Result frame = frame();
|
||||
crossfade.hold(frame);
|
||||
|
||||
crossfade.hold(null);
|
||||
|
||||
assertSame(frame, crossfade.outgoing());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void frameWithoutAHeldFrameHasNothingToFade() {
|
||||
crossfade.reveal();
|
||||
|
||||
assertNull(crossfade.outgoing());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clearDropsTheHeldFrame() {
|
||||
crossfade.hold(frame());
|
||||
|
||||
crossfade.clear();
|
||||
|
||||
assertNull(crossfade.outgoing());
|
||||
}
|
||||
|
||||
private static NoiseRenderCoordinator.Result frame() {
|
||||
return new NoiseRenderCoordinator.Result(null, null, 1D, 1L, 0D, 1D, 0.5D, 0L, 0L, 0L);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user