1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.nuiton.jrst.bugs;
24
25 import org.apache.commons.io.FileUtils;
26 import org.junit.Test;
27 import org.nuiton.jrst.JRST;
28 import org.nuiton.jrst.JRSTAbstractTest;
29
30 import java.io.File;
31
32
33
34
35
36
37
38
39
40
41 public class DirectiveTest extends JRSTAbstractTest {
42
43
44
45
46
47
48
49 @Test
50 public void testImageDirectiveOption() throws Exception {
51 File in = getBugTestFile("testImages21.rst");
52 File out = getOutputTestFile("jrst-testImages.html");
53
54 new JRSTTestGenerator(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME) {
55
56 @Override
57 public void assertJRST(File in, File out) throws Exception {
58 String content = FileUtils.readFileToString(out, JRST.UTF_8);
59 log.info(content);
60 assertTrue(content.indexOf("alt=\"alternate text\"") > 0);
61 assertTrue(content.indexOf("width=\"200px\"") > 0
62 || content.indexOf("width=\"200 px\"") > 0);
63 assertTrue(content.indexOf("align=\"center\"") > 0);
64 assertTrue(content.indexOf("alt=\"tab alternate text\"") > 0);
65
66 assertTrue(content.indexOf("alt=\"tab alternate text\"") > 0);
67
68 }
69 };
70 }
71
72
73
74
75
76
77 @Test
78 public void testContentDirective() throws Exception {
79 File in = getBugTestFile("testContent877.rst");
80 File out = getOutputTestFile("jrst-testContent.html");
81
82
83 new JRSTTestGenerator(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME) {
84
85 @Override
86 public void assertJRST(File in, File out) throws Exception {
87 String content = FileUtils.readFileToString(out, JRST.UTF_8);
88 assertTrue(content.indexOf("Table des matières") > 0);
89 }
90 };
91 }
92
93
94
95
96
97
98 @Test
99 public void testContentsDirective() throws Exception {
100 File in = getBugTestFile("testContents.rst");
101 File out = getOutputTestFile("jrst-testContents.html");
102
103
104 new JRSTTestGenerator(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME) {
105
106 @Override
107 public void assertJRST(File in, File out) throws Exception {
108 String content = FileUtils.readFileToString(out, JRST.UTF_8);
109 assertTrue(content.indexOf("<b>") > 0);
110 assertTrue(content.indexOf("<em>") > 0);
111 }
112 };
113 }
114 }