1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-06-16 23:22:23 +00:00
plantuml-server/src/test/java/net/sourceforge/plantuml/servlet/TestCharset.java
Florian f727c6dd13 frontend 2.0: initial version
- auto refresh function
- light and dark theme
- monaco editor (vscode) with "apex" as syntax highlighting language
  * apex seems to work quite fine (better than no highlighting)
  * future possibility: own plantuml language syntax support
  * future possibility: autocomplete (to much work but maybe partial)
    - implemented example for `!theme ...`
    - implemented example for `<&icon>`
  * future possibility: code validation
    - implemented example for `@start...` and `@end...`:
      * should be the first or last command
      * should be of the some type (e.g. `@startyaml` and @endyaml)
      * should be used exactly once per document/diagram
- editor and preview is splitable into two windows like the
  "Extract window" functionality on
  (plantuml.com)[https://www.plantuml.com/plantuml]
- multi index / multi paging diagram support
- diagram can be displayed/rended as PNG, SVG, ASCII Art or PDF
- Ctrl+s download the PlantUML Code as code file (diagram.puml)
- Ctrl+, opens the settings and Esc closes the settings
2023-05-03 13:23:47 -04:00

53 lines
1.9 KiB
Java

package net.sourceforge.plantuml.servlet;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import net.sourceforge.plantuml.servlet.utils.WebappTestCase;
public class TestCharset extends WebappTestCase {
/**
* Verifies the preservation of unicode characters for the "Bob -> Alice : hell‽" sample
*/
public void testUnicodeSupport() throws IOException {
final URL url = new URL(getServerUrl() + "/txt/SyfFKj2rKt3CoKnELR1Io4ZDoNdKi1S0");
final URLConnection conn = url.openConnection();
// Analyze response
// Verifies the Content-Type header
assertEquals(
"Response content type is not TEXT PLAIN or UTF-8",
"text/plain;charset=utf-8",
conn.getContentType().toLowerCase()
);
// Get the content and verify that the interrobang unicode character is present
String diagram = getContentText(conn);
assertTrue("Interrobang unicode character is not preserved", diagram.contains(""));
}
/**
* Verifies the preservation of unicode characters for the
* "participant Bob [[http://www.snow.com/❄]]\nBob -> Alice" sample
*/
public void testUnicodeInCMap() throws IOException {
final URL url = new URL(
getServerUrl() +
"/map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzShpiilrqlEpzL_DBSbDfOB9Azhf-2OavcS2W00"
);
final URLConnection conn = url.openConnection();
// Analyze response
// Verifies the Content-Type header
assertEquals(
"Response content type is not TEXT PLAIN or UTF-8",
"text/plain;charset=utf-8",
conn.getContentType().toLowerCase()
);
// Get the content and verify that the snow unicode character is present
String map = getContentText(conn);
assertTrue("Snow unicode character is not preserved", map.contains(""));
}
}