Resolve rewrite of pixelDensity to settings.

Per https://github.com/processing/processing4/issues/58, pixelDensity should run in settings and currently results in failure if used in static context. This will rewrite pixelDensity into the setting section if found in static or settings context. Adds unit tests for both scenarios.
This commit is contained in:
A Pottinger
2020-01-20 09:16:11 -08:00
parent 8c082293af
commit 17e28256f5
6 changed files with 175 additions and 18 deletions

View File

@@ -378,6 +378,16 @@ public class ParserTests {
expectGood("packageTest", true, Optional.of("test.subtest"));
}
@Test
public void testStaticPixelDensity() {
expectGood("staticpixeldensity");
}
@Test
public void testParamPixelDensity() {
expectGood("parampixeldensity");
}
private static boolean compile(String id, String program) {
// Create compilable AST to get syntax problems
CompilationUnit compilableCU = JdtCompilerUtil.makeAST(