Skip to content

Commit

Permalink
Attempt to fix a flaky test
Browse files Browse the repository at this point in the history
Add more documentation.

Affects: #70
  • Loading branch information
io7m committed Sep 29, 2024
1 parent 11bb95e commit 9cf3ab8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
id="405b6ebe-a489-4849-8b02-57129078ab7e"
title="Images">
<Paragraph>
Images...
An <Term type="term">image</Term> is a rectangular array of pixels. The application does not do any special
processing of images beyond storing them in the dataset. Images are, in practice, expected to be in one of the
various popular image formats such as
<LinkExternal target="https://www.w3.org/TR/png-3/">PNG</LinkExternal>.
</Paragraph>
<Paragraph>
Each image in the dataset may have zero or more
<Link target="605e7b9d-a54f-4c3c-914c-c6978d2d50f7">captions</Link>
assigned.
</Paragraph>
</Section>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import com.io7m.laurel.filemodel.LExportRequest;
import com.io7m.laurel.filemodel.LFileModelEventType;
import com.io7m.laurel.filemodel.LFileModelStatusIdle;
import com.io7m.laurel.filemodel.LFileModelStatusLoading;
import com.io7m.laurel.filemodel.LFileModels;
import com.io7m.laurel.filemodel.internal.LCaptionFiles;
import com.io7m.laurel.gui.internal.LPerpetualSubscriber;
Expand All @@ -38,7 +40,9 @@
import java.nio.file.Path;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.zip.ZipInputStream;

Expand Down Expand Up @@ -86,7 +90,16 @@ public void testExportDatasetGood()
}

try (var model = LFileModels.open(this.outputFile, false)) {
Thread.sleep(1_000L);
final var loadLatch = new CountDownLatch(1);

model.status().subscribe((oldValue, newValue) -> {
if (oldValue instanceof LFileModelStatusLoading && newValue instanceof LFileModelStatusIdle) {
loadLatch.countDown();
}
});

loadLatch.await();
assertEquals(new LFileModelStatusIdle(), model.status().get());

model.export(
new LExportRequest(outputPath, true))
Expand Down

0 comments on commit 9cf3ab8

Please sign in to comment.