1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.layer.geoimage;
|
---|
3 |
|
---|
4 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
5 | import org.junit.jupiter.api.Disabled;
|
---|
6 | import org.junit.jupiter.api.Test;
|
---|
7 | import org.junit.jupiter.api.extension.RegisterExtension;
|
---|
8 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
9 | import org.openstreetmap.josm.tools.StreamUtils;
|
---|
10 |
|
---|
11 | import java.nio.file.DirectoryStream;
|
---|
12 | import java.nio.file.Files;
|
---|
13 | import java.nio.file.Path;
|
---|
14 | import java.nio.file.Paths;
|
---|
15 | import java.util.List;
|
---|
16 | import java.util.stream.Collectors;
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * Unit tests of {@link ThumbsLoader} class.
|
---|
20 | */
|
---|
21 | class ThumbsLoaderTest {
|
---|
22 | /**
|
---|
23 | * Setup test.
|
---|
24 | */
|
---|
25 | @RegisterExtension
|
---|
26 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
27 | public JOSMTestRules test = new JOSMTestRules().main();
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Performance test for {@link ThumbsLoader}
|
---|
31 | * @throws Exception if any error occurs
|
---|
32 | */
|
---|
33 | @Test
|
---|
34 | @Disabled("Set working directory to image folder and run manually")
|
---|
35 | void testPerformance() throws Exception {
|
---|
36 | List<ImageEntry> imageEntries;
|
---|
37 | try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(".").toAbsolutePath(), "*.{JPG,jpg}")) {
|
---|
38 | imageEntries = StreamUtils.toStream(stream).map(Path::toFile).map(ImageEntry::new).collect(Collectors.toList());
|
---|
39 | }
|
---|
40 | new ThumbsLoader(imageEntries).run();
|
---|
41 | }
|
---|
42 |
|
---|
43 | }
|
---|