Skip to content

Commit 2e3f573

Browse files
committed
Allow for emulated Preferences in testing.
1 parent 65d4ea9 commit 2e3f573

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

app/src/processing/app/Preferences.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ static public void init() {
129129
}
130130

131131

132+
/**
133+
* For testing, pretend to load preferences without a real file.
134+
*/
135+
static public void skipInit() {
136+
initalized = true;
137+
}
138+
139+
132140
static void handleProxy(String protocol, String hostProp, String portProp) {
133141
String proxyHost = get("proxy." + protocol + ".host");
134142
String proxyPort = get("proxy." + protocol + ".port");

java/test/processing/mode/java/ProcessingTestUtil.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class ProcessingTestUtil {
1717
static void init() {
1818
// noop; just causes class to be loaded
1919
}
20-
20+
2121
private static final String RESOURCES = "test/resources/";
2222
private static final String RESOURCES_UP_DIR = "../java/test/resources";
2323
static final UTCompiler COMPILER;
@@ -64,9 +64,10 @@ static String preprocess(final String name, final File resource, Optional<String
6464

6565
return normalize(out);
6666
}
67-
67+
6868
static String format(final File resource)
6969
{
70+
Preferences.skipInit();
7071
return format(read(resource));
7172
}
7273

0 commit comments

Comments
 (0)