⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testhtmlstringtowikitranslator.java

📁 JSP 的一个wiki 系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        assertEquals(
                      " [http://www.startup.de] ",
                      html2wiki
                              .translate( "<a class=\"external\" href=\"http://www.startup.de\">http://www.startup.de</a><img class=\"outlink\" src=\"images/out.png\" alt=\"\">" ) );

        assertEquals( "%(( text-align: center; display: block; )Hello \\\\World!%)", html2wiki
                .translate( "<div style=\"text-align: center;\">Hello<br>World!</div>" ) );

        assertEquals( "__%(( text-align: center; display: block; )Hello \\\\World!%)__", html2wiki
                .translate( "<span style=\"font-weight: bold; text-align: center;\">Hello<br>World!</span>" ) );

        assertEquals(
                      "[{Image src='Homunkulus/homunculus4.jpg' align='left'}]",
                      html2wiki
                              .translate( "<table class=\"imageplugin\" align=\"left\" border=\"0\"> <tbody><tr><td><img src=\"attach?page=Homunkulus%2Fhomunculus4.jpg\"></td></tr> </tbody></table>" ) );

        assertEquals( "[{Image src=\'AbenteuerQuilpins/Quilpins.jpg\' align=\'left\'}]", html2wiki
                .translate( "<table class=\"imageplugin\" align=\"left\" border=\"0\"> \r\n"
                            + "  <tbody><tr><td><img src=\"attach?page=AbenteuerQuilpins%2FQuilpins.jpg\"></td></tr> </tbody>\r\n"
                            + "</table> " ) );

        assertEquals(
                      "[{Image src=\'AbenteuerQuilpins/Quilpins.jpg\' caption=\'Testing Image\' style=\'font-size: 120%; color: green;\'}]",
                      html2wiki
                              .translate( "<table class=\"imageplugin\" style=\"font-size: 120%; color: green;\" border=\"0\"> \r\n"
                                          + "  <caption align=\"bottom\">Testing Image</caption> \r\n"
                                          + "  <tbody><tr><td><img src=\"attach?page=AbenteuerQuilpins%2FQuilpins.jpg\"></td></tr> </tbody>\r\n"
                                          + "</table> " ) );

        assertEquals(
                      "[{Image src=\'http://opi.yahoo.com/online?u=YahooUser1234&m=g&t=2\' link=\'http://edit.yahoo.com/config/send_webmesg?.target=YahooUser1234&.src=pg\'}]",
                      html2wiki
                              .translate( "<table class=\"imageplugin\" border=\"0\"> \r\n"
                                          + "  <tbody><tr><td>\r\n"
                                          + "  <a href=\"http://edit.yahoo.com/config/send_webmesg?.target=YahooUser1234&amp;.src=pg\">\r\n"
                                          + "  <img src=\"http://opi.yahoo.com/online?u=YahooUser1234&amp;m=g&amp;t=2\">\r\n"
                                          + "  </a></td></tr> \r\n" + "  </tbody>\r\n" + "</table> " ) );

        assertEquals(
                      "[{Image src=\'homunculus4.jpg\' align=\'left\' height=\'100px\' width=\'100px\' alt=\'alt text\' caption=\'caption text\' link=\'http://google.de\' border=\'1\'}]",
                      html2wiki
                              .translate( "<table class=\"imageplugin\" align=\"left\" border=\"0\"> \r\n"
                                          + "  <caption align=\"bottom\">caption text</caption> \r\n"
                                          + "  <tbody><tr><td>\r\n"
                                          + "    <a href=\"http://google.de\"><img src=\"homunculus4.jpg\" alt=\"alt text\" border=\"1\" height=\"100px\" width=\"100px\">\r\n"
                                          + "    </a></td></tr> \r\n" + "  </tbody>  \r\n" + "</table>" ) );

        assertEquals(
                      "[{Image src=\'http://opi.yahoo.com/online?u=YahooUser1234&m=g&t=2\' link=\'http://edit.yahoo.com/config/send_webmesg?.target=YahooUser1234&.src=pg\'}]",
                      html2wiki
                              .translate( "  <a href=\"http://edit.yahoo.com/config/send_webmesg?.target=YahooUser1234&amp;.src=pg\">\r\n"
                                          + "  <img src=\"http://opi.yahoo.com/online?u=YahooUser1234&amp;m=g&amp;t=2\">\r\n"
                                          + "  </a" ) );

        assertEquals( " [AbsolutelyTestNotExisting]\n\n", html2wiki
                .translate( "<table class=\"imageplugin\" align=\"left\" border=\"0\">\r\n" + "<tbody><tr><td><br>\r\n"
                            + "</td></tr>\r\n" + "</tbody></table>\r\n" + "\r\n" + "[AbsolutelyTestNotExisting]<p>\r\n"
                            + "<table class=\"imageplugin\" align=\"left\" border=\"0\">\r\n" + "\r\n" + "<tbody>\r\n"
                            + "</tbody></table>\r\n" + "\r\n" + "</p><p>\r\n" + "</p>" ) );

        assertEquals( "[ThisPageDoesNotExist] ", html2wiki
                .translate( "<u>ThisPageDoesNotExist</u><a href=\"Edit.jsp?page=ThisPageDoesNotExist\">?</a>" ) );

        assertEquals( "[/JSPWiki/wysiwyg/FCKeditor/editor/images/smiley/msn/sad_smile.gif] ", html2wiki
                .translate( "<img src=\"/JSPWiki/wysiwyg/FCKeditor/editor/images/smiley/msn/sad_smile.gif\" alt=\"\"/>" ) );

        assertEquals( "\\\\\\", html2wiki.translate( "\\\\\\" ) );

        assertEquals( "[{Test\nHello World!}]", html2wiki.translate( "[{Test\\\\Hello World!}]" ) );

        assertEquals( "{{{[{Test\\\\Hello World!}]}}}", html2wiki.translate( "{{{[{Test\\\\Hello World!}]}}}" ) );

        assertEquals(
                      "{{{[{Test\\\\Hello World!}]}}}{{{[{Test\\\\\\\\Hello World!}]}}}[{Test\n\nHello World!}][{Test\n\nHello World!}]",
                      html2wiki
                              .translate( "{{{[{Test\\\\Hello World!}]}}}{{{[{Test\\\\\\\\Hello World!}]}}}[{Test\\\\\\\\Hello World!}][{Test\\\\\\\\Hello World!}]" ) );

        assertEquals(
                      "\n* Diese Karte kann von jedem editiert und um neue Links erweitert werden. \\\\Klickt einfach unten neben der Karte auf {{{[edit]}}}\n",
                      html2wiki
                              .translate( "<ul><li> Diese Karte kann von jedem editiert und um neue Links erweitert werden.<br>Klickt einfach unten neben der Karte auf <span style=\"font-family: monospace;\">[edit]</span></li></ul>" ) );

        assertEquals(
                      "\n* Diese Karte kann von jedem editiert und um neue Links erweitert werden. \\\\Klickt einfach unten neben der Karte auf {{{[edit]}}}\n",
                      html2wiki
                              .translate( "<ul><li> Diese Karte kann von jedem editiert und um neue Links erweitert werden.<br>Klickt einfach unten neben der Karte auf <span style=\"font-family: monospace;\">[edit]</span></li></ul>" ) );

        assertEquals( "Diese Karte{{{ kann }}} von", html2wiki
                .translate( "Diese Karte<span style=\"font-family: courier new,courier,mono;\"> kann </span> von" ) );

        assertEquals(
                      "Fahrt einfac{{{h mit\u00A0\u00A0 \n der \u00A0 Maus}}} drueber",
                      html2wiki
                              .translate( "Fahrt einfac<span style=\"font-family: monospace;\">h mit&nbsp;&nbsp; <br> der &nbsp; Maus</span> drueber" ) );

        assertEquals( "%(( color: rgb(255, 0, 0); )Und niemand wird sie sehen%), die", html2wiki
                .translate( "<span style=\"color: rgb(255, 0, 0);\">Und niemand wird sie sehen</span>, die" ) );

        assertEquals( "by\n" + "----\n" + "Dies", html2wiki.translate( "by\n" + "<hr>\n" + "Dies" ) );

        assertEquals( "This is a private homepage done by\n" + "----\n"
                      + "Dies ist eine private, nicht-kommerzielle Homepage von\n" + "\n"
                      + "[{Text2gif width=\'150\' height=\'100\' \n" + " \n" + "Sebastian L. Baltes \n" + "Lange Str. 53 \n"
                      + "44137 Dortmund \n" + " \n" + "email: info@sorokan.de \n" + "}]\n" + "\n", html2wiki
                .translate( "This is a private homepage done by\n" + "<hr>\n"
                            + "Dies ist eine private, nicht-kommerzielle Homepage von\n" + "<p>\n"
                            + "[{Text2gif width=\'150\' height=\'100\'\n" + "<br> <br>Sebastian L. Baltes\n"
                            + "<br>Lange Str. 53\n" + "<br>44137 Dortmund\n" + "<br> <br>email: info@sorokan.de\n" + "<br>}]\n"
                            + "</p><p>" ) );
    }

    public static void assertEquals( String a, String b )
    {
        if( !a.equals( b ) )
        {
            throw new AssertionFailedError( "\nexpected: " + PropertiesUtils.saveConvert( a, true ) + "\n" + "but was : "
                                            + PropertiesUtils.saveConvert( b, true ) + "\n" );
        }
    }

    public static Test suite()
    {
        return new TestSuite( FilterManagerTest.class );
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -