@Test public void testProcessWithNamedStringOverride() throws Exception { classUnderTest.namedString("include1.glsl", "// Included via override"); String source = loadSource("testNamedStringOverrides.vert"); String expected = loadSource("testNamedStringOverrides_expected.vert"); String result = classUnderTest.process(source); assertEqualsIgnoreLineEndings(expected, result); }
@Test public void testProcessWithNestedIncludes() throws Exception { classUnderTest.namedString("include2.glsl", "#include include3.glsl"); classUnderTest.namedString("bob", "// bob"); String source = loadSource("testNestedIncludes.vert"); String expected = loadSource("testNestedIncludes_expected.vert"); String result = classUnderTest.process(source); assertEqualsIgnoreLineEndings(expected, result); }
@Test public void testProcessWithNamedStringInclude() throws Exception { classUnderTest.namedString("include1", "uniform float included_1;"); classUnderTest.namedString( "include2", "float includedFunction(float arg)\n{\n\treturn arg;\n}"); String source = loadSource("testNamedStringIncludes.vert"); String expected = loadSource("testNamedStringIncludes_expected.vert"); String result = classUnderTest.process(source); assertEqualsIgnoreLineEndings(expected, result); }
@Test public void testProcessWithSameFolderInclude() throws Exception { String source = loadSource("testSameFolderIncludes.vert"); String expected = loadSource("testSameFolderIncludes_expected.vert"); String result = classUnderTest.process(source); assertEqualsIgnoreLineEndings(expected, result); }
@Test public void testProcessResourceWithWrongLoaderLocationRelativeResourceQiet() throws Exception { Class<?> loader = String.class; String expected = null; String result = classUnderTest.processResource(loader, "testNoIncludes.vert", true); assertEqualsIgnoreLineEndings(expected, result); }
@Test public void testProcessResourceWithNonNullLoader() throws Exception { Class<?> loader = getClass(); String expected = loadSource("testNoIncludes.vert"); String result = classUnderTest.processResource(loader, "testNoIncludes.vert"); assertEqualsIgnoreLineEndings(expected, result); }
@Test public void testProcessWithMissingIncludesFailQuiet() throws Exception { String source = loadSource("testMissingIncludes.vert"); String expected = loadSource("testMissingIncludes_expected.vert"); String result = classUnderTest.process(source, true); assertEqualsIgnoreLineEndings(expected, result); }
@Test public void testProcessResourceWithWrongLoaderLocationAbsoluteResource() throws Exception { Class<?> loader = GLTestUtil.class; String expected = loadSource("testNoIncludes.vert"); String result = classUnderTest.processResource( loader, "/au/gov/ga/earthsci/model/core/shader/include/testNoIncludes.vert"); assertEqualsIgnoreLineEndings(expected, result); }
@Test public void testProcessWithEmpty() throws Exception { assertEquals("", classUnderTest.process("")); }
@Test public void testProcessWithNull() throws Exception { assertNull(classUnderTest.process(null)); }