Skip to content

Commit

Permalink
[prmr#512] Fix unit tests which require a default font.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkcoding7 committed May 9, 2024
1 parent 3f353ec commit 2058ea8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/org/jetuml/layouttests/AbstractTestDiagramLayout.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*******************************************************************************/
package org.jetuml.layouttests;

import static org.jetuml.rendering.FontMetrics.DEFAULT_FONT_NAME;
import static org.jetuml.rendering.FontMetrics.DEFAULT_FONT_SIZE;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand All @@ -33,6 +34,7 @@

import org.jetuml.application.UserPreferences;
import org.jetuml.application.UserPreferences.IntegerPreference;
import org.jetuml.application.UserPreferences.StringPreference;
import org.jetuml.diagram.Diagram;
import org.jetuml.diagram.DiagramType;
import org.jetuml.diagram.Edge;
Expand All @@ -55,18 +57,22 @@
*/
public abstract class AbstractTestDiagramLayout
{
private static String userDefinedFontName;
private static int userDefinedFontSize;

@BeforeAll
public static void setupClass()
{
userDefinedFontName = UserPreferences.instance().getString(UserPreferences.StringPreference.fontName);
UserPreferences.instance().setString(StringPreference.fontName, DEFAULT_FONT_NAME);
userDefinedFontSize = UserPreferences.instance().getInteger(UserPreferences.IntegerPreference.fontSize);
UserPreferences.instance().setInteger(IntegerPreference.fontSize, DEFAULT_FONT_SIZE);
}

@AfterAll
public static void restorePreferences()
{
UserPreferences.instance().setString(StringPreference.fontName, userDefinedFontName);
UserPreferences.instance().setInteger(IntegerPreference.fontSize, userDefinedFontSize);
}

Expand Down

0 comments on commit 2058ea8

Please sign in to comment.