Exemplo n.º 1
0
 @Test
 public void imageWithWidth() throws Exception {
   ParserTestHelper.assertParses("!img -w 640 name", "SymbolList[Image[Link[SymbolList[Text]]]]");
   TestRoot root = new TestRoot();
   WikiPage testPage = root.makePage("ImagePage", "!img -w 640 name");
   ParserTestHelper.assertTranslatesTo(testPage, "<img src=\"name\" width=\"640\"/>");
 }
Exemplo n.º 2
0
 @Test
 public void translatesImages() {
   ParserTestHelper.assertTranslatesTo("!img name", "<img src=\"name\"/>");
   ParserTestHelper.assertTranslatesTo("!img http://name", "<img src=\"http://name\"/>");
   ParserTestHelper.assertTranslatesTo("!img-l name", "<img src=\"name\" class=\"left\"/>");
   ParserTestHelper.assertTranslatesTo("!img-r name", "<img src=\"name\" class=\"right\"/>");
 }
Exemplo n.º 3
0
 @Test
 public void imageWithBorder() throws Exception {
   ParserTestHelper.assertParses("!img -b 1 name", "SymbolList[Image[Link[SymbolList[Text]]]]");
   TestRoot root = new TestRoot();
   WikiPage testPage = root.makePage("ImagePage", "!img -b 1 name");
   ParserTestHelper.assertTranslatesTo(
       testPage, "<img src=\"name\" style=\"border:1px solid black;\"/>");
 }
Exemplo n.º 4
0
 @Test
 public void imageWithMargin() throws Exception {
   ParserTestHelper.assertParses("!img -m 10 name", "SymbolList[Image[Link[SymbolList[Text]]]]");
   TestRoot root = new TestRoot();
   WikiPage testPage = root.makePage("ImagePage", "!img -m 10 name");
   ParserTestHelper.assertTranslatesTo(
       testPage, "<img src=\"name\" style=\"margin:10px 10px 10px 10px;\"/>");
 }
Exemplo n.º 5
0
 @Test
 public void parsesImages() throws Exception {
   ParserTestHelper.assertParses("!img name", "SymbolList[Image[Link[SymbolList[Text]]]]");
   ParserTestHelper.assertParses("!img http://name", "SymbolList[Image[Link[SymbolList[Text]]]]");
   ParserTestHelper.assertParses("!imgx name", "SymbolList[Text, Whitespace, Text]");
   ParserTestHelper.assertParses("!img-l name", "SymbolList[Image[Link[SymbolList[Text]]]]");
   ParserTestHelper.assertParses("!img-r name", "SymbolList[Image[Link[SymbolList[Text]]]]");
 }
Exemplo n.º 6
0
 @Test
 public void imageWidthHandleMistyped() throws Exception {
   TestRoot root = new TestRoot();
   WikiPage testPage = root.makePage("ImagePage", "!img -w name");
   ParserTestHelper.assertTranslatesTo(testPage, "!img -w name");
   testPage = root.makePage("ImagePage", "!img -w nnn name");
   ParserTestHelper.assertTranslatesTo(testPage, "<img src=\"name\" width=\"nnn\"/>");
   testPage = root.makePage("ImagePage", "!img -w N");
   ParserTestHelper.assertTranslatesTo(testPage, "!img -w N");
   testPage = root.makePage("ImagePage", "'''!img -w N'''");
   ParserTestHelper.assertTranslatesTo(testPage, "<b>!img -w N</b>");
 }
Exemplo n.º 7
0
 @Test
 public void translatesEvaluators() {
   ParserTestHelper.assertTranslatesTo("${= 8 =}", "8", injector);
   ParserTestHelper.assertTranslatesTo("${=42.24=}", "42.24", injector);
   ParserTestHelper.assertTranslatesTo("${=1.2E+3=}", "1200", injector);
   ParserTestHelper.assertTranslatesTo("${=-123=}", "-123", injector);
   ParserTestHelper.assertTranslatesTo("${=%d:3.2=}", "3", injector);
   ParserTestHelper.assertTranslatesTo("${==}", "", injector);
   ParserTestHelper.assertTranslatesTo("${= =}", "", injector);
   ParserTestHelper.assertTranslatesTo("${=3+4=}", "7", injector);
   ParserTestHelper.assertTranslatesTo(
       "${=abort=}", "<span class=\"meta\">invalid expression: abort</span>", injector);
 }
Exemplo n.º 8
0
 @Test
 public void scansEvaluators() {
   ParserTestHelper.assertScansTokenType("${=3+4=}", "Evaluator", true, injector);
 }
Exemplo n.º 9
0
 @Test
 public void parsesEMail() throws Exception {
   ParserTestHelper.assertParses("*****@*****.**", "SymbolList[EMail]");
 }
Exemplo n.º 10
0
 @Test
 public void translatesEMail() {
   ParserTestHelper.assertTranslatesTo(
       "*****@*****.**", "<a href=\"mailto:[email protected]\">[email protected]</a>");
 }
Exemplo n.º 11
0
 @Test
 public void scansImages() {
   ParserTestHelper.assertScansTokenType("!img name", "Image", true);
 }