1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 21:15:09 +00:00

Fix broken A000*_Test tests on macOS

This commit is contained in:
matthew16550 2021-10-24 15:10:28 +11:00
parent 1f922c2650
commit 1f68cc262a

View File

@ -57,7 +57,7 @@ public class UFont {
public String toStringDebug() {
final StringBuilder sb = new StringBuilder();
sb.append(font.getFontName());
sb.append(getPortableFontName());
sb.append("/");
sb.append(font.getSize());
return sb.toString();
@ -168,6 +168,20 @@ public class UFont {
return family;
}
// Kludge for testing because font names on some machines (only macOS?) do not end with <DOT><STYLE>
// See https://github.com/plantuml/plantuml/issues/720
private String getPortableFontName() {
final String name = font.getFontName();
if (font.isBold() && font.isItalic())
return name.endsWith(".bolditalic") ? name : name + ".bolditalic";
else if (font.isBold())
return name.endsWith(".bold") ? name : name + ".bold";
else if (font.isItalic())
return name.endsWith(".italic") ? name : name + ".italic";
else
return name.endsWith(".plain") ? name : name + ".plain";
}
@Override
public String toString() {
return font.toString()/* + " " + font.getPSName() */;