1 /*
2 * #%L
3 * JRst :: Api
4 * %%
5 * Copyright (C) 2011 Codelutin, Chatellier Eric
6 * %%
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Lesser Public License for more details.
16 *
17 * You should have received a copy of the GNU General Lesser Public
18 * License along with this program. If not, see
19 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
20 * #L%
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 * Test concernant les tables en général.
34 *
35 * @author chatellier
36 * @version $Revision$
37 *
38 * Last update : $Date$
39 * By : $Author$
40 */
41 public class TableTest extends JRSTAbstractTest {
42
43 /**
44 * Test que la présence d'un caractères | ne fait pas planter
45 * la generation des tables.
46 *
47 * @throws Exception
48 */
49 @Test
50 public void testTableSpecialChar() throws Exception {
51 File in = getBugTestFile("testTable1290.rst");
52 File out = getOutputTestFile("jrst-tables.html");
53 // out.deleteOnExit();
54
55 new JRSTTestGenerator(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME) {
56
57 @Override
58 public void assertJRST(File in, File out) throws Exception {
59 String content = FileUtils.readFileToString(out, JRST.UTF_8);
60 assertTrue(content.indexOf("Annee|Trait|Espece") > 0);
61 assertTrue(content.indexOf("<p>Fatal</p>") > 0);
62 }
63 };
64 }
65
66 /**
67 * Test que la generation de tableau ne genere pas de paragraphe en trop.
68 *
69 * @throws Exception
70 */
71 @Test
72 public void testTableIndentation() throws Exception {
73 File in = getBugTestFile("testTable1375.rst");
74 File out = getOutputTestFile("jrst-tables.html");
75 // out.deleteOnExit();
76
77 new JRSTTestGenerator(JRST.TYPE_HTML, in, out, JRST.Overwrite.ALLTIME) {
78
79 @Override
80 public void assertJRST(File in, File out) throws Exception {
81 String content = FileUtils.readFileToString(out, JRST.UTF_8);
82 assertTrue(content.indexOf("<em>légérs</em>") > 0);
83 }
84 };
85 }
86 }