1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
---|
5 |
|
---|
6 | import java.io.IOException;
|
---|
7 |
|
---|
8 | import org.junit.jupiter.api.Test;
|
---|
9 | import org.junit.jupiter.api.BeforeAll;
|
---|
10 | import org.junit.jupiter.api.Disabled;
|
---|
11 | import org.openstreetmap.josm.JOSMFixture;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Tests the {@link GettingStarted} class.
|
---|
15 | */
|
---|
16 | class GettingStartedTest {
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * Setup test.
|
---|
20 | */
|
---|
21 | @BeforeAll
|
---|
22 | public static void init() {
|
---|
23 | JOSMFixture.createFunctionalTestFixture().init();
|
---|
24 | }
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * Tests that image links are replaced.
|
---|
28 | *
|
---|
29 | * @throws IOException if any I/O error occurs
|
---|
30 | */
|
---|
31 | @Test
|
---|
32 | @Disabled("see #15240, inactive for /browser/trunk/nodist/images/download.png")
|
---|
33 | void testImageReplacement() throws IOException {
|
---|
34 | final String motd = new GettingStarted.MotdContent().updateIfRequiredString();
|
---|
35 | // assuming that the MOTD contains one image included, fixImageLinks changes the HTML string
|
---|
36 | assertNotEquals(GettingStarted.fixImageLinks(motd), motd);
|
---|
37 | }
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * Tests that image links are replaced.
|
---|
41 | */
|
---|
42 | @Test
|
---|
43 | void testImageReplacementStatic() {
|
---|
44 | final String html = "the download button <img src=\"/browser/trunk/resources/images/download.svg?format=raw\" " +
|
---|
45 | "alt=\"source:trunk/resources/images/download.svg\" title=\"source:trunk/resources/images/download.svg\" />.";
|
---|
46 | assertNotEquals(GettingStarted.fixImageLinks(html), html);
|
---|
47 | }
|
---|
48 | }
|
---|